RDBMS and PL/SQL Assignment Answers
## Assignment-01: Codds Rules in Detail
Dr. Edgar F. Codd introduced 13 rules that define a relational database management system
(RDBMS). These rules ensure data consistency, integrity, and efficiency.
1. Rule 0: Foundation Rule - A system must use relational methods for data storage and retrieval.
2. Rule 1: Information Rule - All information should be stored in tables.
3. Rule 2: Guaranteed Access Rule - Data must be accessible using table name, primary key, and
column name.
4. Rule 3: Systematic Treatment of NULL Values - NULL values represent missing or unknown data.
5. Rule 4: Active Online Catalog - Metadata must be stored as relational tables.
6. Rule 5: Comprehensive Data Sublanguage - The database must support SQL.
7. Rule 6: View Updating Rule - Views should be updatable.
8. Rule 7: High-Level Insert, Update, and Delete - Operations should work on sets of data.
9. Rule 8: Physical Data Independence - Changes in storage should not affect data retrieval.
10. Rule 9: Logical Data Independence - Table structure changes should not impact applications.
11. Rule 10: Integrity Independence - Constraints must be enforced by the database.
12. Rule 11: Distribution Independence - The database should work consistently whether centralized
or distributed.
13. Rule 12: Non-Subversion Rule - Integrity rules must not be bypassed.
## Assignment-02: Relational Algebra Operations
Relational Algebra is a procedural query language that retrieves data using operations on tables.
1. Selection () - Filters rows based on a condition.
2. Projection () - Selects specific columns.
3. Union ( ) - Combines tables (removes duplicates).
4. Intersection ( ) - Retrieves common records.
5. Difference ( ) - Finds records in one table but not another.
6. Cartesian Product ( ) - Returns all possible row combinations.
7. Join () - Combines two tables based on a common column.
8. Division ( ) - Used for queries involving "for all" conditions.
## Assignment-03: Subqueries and Nested Queries
A subquery is a query inside another SQL query, used in SELECT, INSERT, UPDATE, or DELETE
statements.
1. Single-row subquery - Returns one result.
2. Multi-row subquery - Returns multiple results.
3. Correlated subquery - Uses values from the outer query.
4. Nested subquery - A subquery inside another subquery.
## Assignment-04: Exception Handling in PL/SQL
Exception handling in PL/SQL helps catch and handle errors gracefully.
### Types of Exceptions:
1. Predefined Exceptions (Automatically Raised) - NO_DATA_FOUND, ZERO_DIVIDE.
2. User-Defined Exceptions - Created using EXCEPTION.
3. Handling Multiple Exceptions - Using WHEN OTHERS to catch unknown errors.
Exception handling ensures smooth program execution and prevents abrupt termination.