Below is a simplified version of the breakdown without stars or hash marks. Important points are in bold.
1. Database System Overview
1.1 Database System Applications
o Examples:
▪ Banking: Manage accounts, loans, transactions.
▪ Airlines: Flight schedules, reservations, ticketing.
▪ Universities: Student records, course registrations, grades.
▪ Healthcare: Patient records, appointments, billing.
o Purpose: Handle large-scale data efficiently with security, consistency, and accessibility.
1.2 Purpose of Database Systems
o Problems with File-Based Systems:
▪ Data Redundancy: Same data stored in multiple files.
▪ Data Inconsistency: Conflicting versions of data.
▪ Lack of Concurrency Control: Multiple users can’t access data simultaneously.
o Solutions:
▪ Centralized Management: Single repository for data.
▪ ACID Compliance: Ensures transaction reliability.
1.3 View of Data (3-Level Architecture)
5. Physical Level:
▪ How data is stored (e.g., files, indices, storage structures).
▪ Managed by the Storage Manager.
6. Logical Level:
▪ Structure of data (e.g., tables, relationships).
▪ Defined using DDL (Data Definition Language).
7. View Level:
▪ User-specific presentation (e.g., customized interfaces for students vs. faculty).
1.4 Database Languages
o DDL (Data Definition Language): Defines schema (e.g., CREATE TABLE, ALTER
TABLE).
o DML (Data Manipulation Language): Manages data (e.g., SELECT, INSERT, UPDATE).
o DCL (Data Control Language): Manages permissions (e.g., GRANT, REVOKE).
1.5 Relational Databases
o Structure: Data organized into tables (relations) with rows (tuples) and columns (attributes).
o Keys:
▪ Primary Key: Uniquely identifies a row (e.g., Student_ID).
▪ Foreign Key: Links two tables (e.g., Course_ID in the Enrollment table).
1.6 Database Design
o Phases:
1. Conceptual Design: ER diagrams.
2. Logical Design: Convert ER to relational schema.
3. Physical Design: Optimize storage (indexing, partitioning).
o Normalization: Eliminate redundancy (e.g., 1NF, 2NF, 3NF).
1.7 Data Storage & Querying
o Storage Manager: Manages disk storage, buffering, and indexing (e.g., B+ trees).
o Query Processor:
▪ Parser: Checks syntax.
▪ Optimizer: Generates efficient execution plans.
1.8 Transaction Management
o ACID Properties:
▪ Atomicity: Transactions are all-or-nothing.
▪ Consistency: Valid state transitions (e.g., no negative balance).
▪ Isolation: Concurrent transactions don’t interfere.
▪ Durability: Committed changes persist even after crashes.
1.9 Database Architecture
o Centralized: Single system (e.g., small businesses).
o Client-Server: Separates front-end (client) and back-end (server).
o Distributed: Data spread across multiple locations.
o Cloud-Based: Scalable, pay-as-you-go (e.g., AWS RDBMS).
2. Entity-Relationship (ER) Model
2.1 ER Model Concepts
o Entity: Real-world object (e.g., Student, Course).
o Attributes:
▪ Simple: Atomic (e.g., Age).
▪ Composite: Sub-attributes (e.g., Address → {Street, City}).
▪ Derived: Calculated (e.g., Age from DOB).
▪ Multi-valued: Multiple values (e.g., Phone_Numbers).
o Relationship: Association between entities (e.g., Student enrolls in Course).
2.2 ER Diagram Notation
o Entity: Represented by a rectangle.
o Attribute: Represented by an oval (connected to the entity).
o Relationship: Represented by a diamond (connected to entities).
o Key Attribute: Underlined.
o Weak Entity: Represented by a double rectangle.
2.3 Constraints
o Key Constraints:
▪ Super Key: Any set of attributes that uniquely identifies an entity.
▪ Candidate Key: Minimal super key (e.g., Student_ID).
▪ Primary Key: Chosen candidate key.
o Participation Constraints:
▪ Total: Every entity must participate (e.g., Employee must work in a Department).
▪ Partial: Optional participation (e.g., Employee may have a Project).
o Mapping Cardinality:
▪ 1:1: One student → One library card.
▪ 1:N: One department → Many students.
▪ N:1: Many students → One department.
▪ M:N: Many students → Many courses.
2.4 Weak Entity Sets
o Definition: Depends on a strong entity for existence (e.g., Dependent in an insurance DB
depends on Employee).
o Representation: Double rectangle plus an identifying relationship (double diamond).
2.5 Extended ER Model
o Generalization:
▪ Group entities into categories (e.g., Vehicle → Car, Truck).
▪ Uses "is-a" relationship.
o Aggregation:
▪ Treats a relationship as an entity for higher-level relationships (e.g., Employee works on
Project → aggregated into Works_On entity).
2.6 Codd’s 12 Rules
o Key Rules:
1. Information Rule: All data represented as table values.
2. Guaranteed Access: Every value accessible via table name + primary key.
3. Null Support: Handle missing/unknown values.
4. Dynamic Catalog: Metadata accessible via queries.
5. Comprehensive Language: SQL supports DDL, DML, etc.
2.7 Reduction of ER Diagrams to Tables
17. Entities → Tables:
▪ Student entity → Student(Student_ID, Name, Age).
18. Relationships → Foreign Keys:
▪ Enrolls(Student_ID, Course_ID) with foreign keys.
19. Weak Entities: Include owner’s primary key (e.g., Dependent(Employee_ID, Dep_Name)).
20. Composite Attributes: Split into columns (e.g., Address_Street, Address_City).
21. M:N Relationships: Create junction table (e.g., Enrollment table for Students ↔ Courses).
3. Sample 6-Mark Answer
Q: Explain the ER model with an example.
A: The ER (Entity-Relationship) model is a conceptual tool for designing databases.
1. Entities: Objects like Student and Course.
2. Attributes: Properties like Student_ID (key) and Course_Name.
3. Relationships: Associations like Enrolls (Student ↔ Course).
4. Constraints:
▪ Cardinality: A student can enroll in many courses (M:N).
▪ Participation: Total (every student must enroll in at least one course).
5. ER Diagram:
▪ Student (rectangle) connected to Enrolls (diamond), linked to Course (rectangle).
6. Example:
▪ In a university DB, Student enrolls in Course, stored in an Enrollment table with foreign
keys.
Below is a simplified version of the 6-mark exam questions and answers. The questions are formatted in bold
and italic and the important points in the answers are in bold.
1. Explain the three-level architecture of a database system with examples.
Answer:
• Physical Level:
o Describes how data is stored (for example, files, indices, storage structures).
o Example: Data stored as student_records.dat on a hard drive.
• Logical Level:
o Defines data relationships (for example, tables, schemas).
o Example: A Student table with columns ID, Name, Age.
• View Level:
o Provides user-specific interfaces.
o Example: A student portal showing only enrolled courses while hiding financial data.
2. Describe ACID properties in transaction management with real-world examples.
Answer:
• Atomicity:
o Transactions are all-or-nothing.
o Example: In a bank transfer, both the debit and credit operations must occur.
• Consistency:
o Ensures valid state transitions (for example, no negative balance).
• Isolation:
o Ensures that concurrent transactions do not interfere with each other.
o Example: When two users try to book the same flight seat, only one transaction succeeds.
• Durability:
o Once a transaction is committed, the changes persist despite failures.
o Example: A flight booking remains confirmed even after a server crash.
3. What are weak entity sets? Explain with an example and their representation in ER diagrams.
Answer:
• Definition:
o Entities that depend on a strong entity for existence (they do not have a primary key of their
own).
• Example:
o Dependent in an insurance database that relies on Employee.
• ER Representation:
o Weak entity: Represented with a double rectangle.
o Identifying relationship: Represented with a double diamond.
o The primary key is formed by combining the owner’s key with a partial key (for example,
Employee_ID + Dependent_Name).
4. Compare Super Key, Candidate Key, and Primary Key with examples.
Answer:
• Super Key:
o Any set of attributes that uniquely identifies an entity.
o Example: {Student_ID, Name} for a Student table.
• Candidate Key:
o A minimal super key with no redundant attributes.
o Example: Student_ID alone is sufficient.
• Primary Key:
o The chosen candidate key for unique identification.
o Example: Student_ID is selected as the primary key.
5. Explain the steps to convert an ER diagram into relational tables.
Answer:
1. Entities → Tables:
o Create a table for each entity with its attributes.
o Example: Student(Student_ID, Name, Age).
2. Relationships → Foreign Keys:
o For 1:1 or 1:N relationships, add a foreign key to the table on the "many" side.
o For M:N relationships, create a junction table (for example, Enrollment(Student_ID,
Course_ID)).
3. Weak Entities:
o Include the owner’s primary key in the weak entity’s table (for example,
Dependent(Employee_ID, Dep_Name)).
4. Composite Attributes:
o Split composite attributes into separate columns (for example, Address_Street, Address_City).
6. What is normalization? Explain 1NF, 2NF, and 3NF with examples.
Answer:
• Normalization: The process to eliminate redundancy and anomalies in a database.
• 1NF (First Normal Form):
o Requires that all values are atomic (no repeating groups).
o Example: Splitting comma-separated Phone_Numbers into separate rows.
• 2NF (Second Normal Form):
o Ensures that there is no partial dependency; all non-key attributes depend on the whole
primary key.
o Example: Removing Course_Name from an Enrollment table if it depends only on Course_ID.
• 3NF (Third Normal Form):
o Ensures that there is no transitive dependency; non-key attributes depend only on the primary
key.
o Example: Removing Department_Location from an Employee table if it depends on
Department_ID rather than the primary key.
7. Explain the Extended ER Model concepts: Generalization and Aggregation.
Answer:
• Generalization:
o Involves grouping entities into a superclass.
o Example: Vehicle is a superclass for Car and Bike with an "is-a" relationship (for example,
Car is a Vehicle).
• Aggregation:
o Involves treating a relationship as an entity to handle higher-level relationships.
o Example: An Employee works on a Project, which can be aggregated into a Works_On entity
to link with a Client.
8. Describe Codd’s Rules. Explain any four rules in detail.
Answer:
Codd’s 12 rules define a true relational database management system (DBMS). Key rules include:
1. Information Rule: All data is represented as table values.
2. Guaranteed Access: Every value is accessible via table name and primary key.
3. Null Support: The system should handle missing or unknown values systematically.
4. Dynamic Catalog: Metadata (such as table schemas) is accessible via queries.
9. Differentiate between Mapping Cardinalities and Participation Constraints with examples.
Answer:
• Mapping Cardinality:
o Defines the numerical relationships between entities.
o Example: 1:N (One department has many students).
• Participation Constraints:
o Determines whether participation is mandatory (total) or optional (partial).
o Example: Total participation – every student must enroll in at least one course.
10. What is the role of DDL and DML in databases? Provide SQL examples.
Answer:
• DDL (Data Definition Language):
o Used to define or modify the database structure.
o Example:
o CREATE TABLE Student (
o Student_ID INT PRIMARY KEY,
o Name VARCHAR(50)
o );
• DML (Data Manipulation Language):
o Used to manage data within tables.
o Example:
o INSERT INTO Student VALUES (101, 'Alice');
o SELECT * FROM Student;
Tips for Writing 6-Mark Answers:
1. Structure: Use clear headings and bullet points.
2. Define Terms: Start with clear definitions (for example, "ACID stands for...").
3. Examples: Always include real-world examples.
4. Diagrams: If allowed, mention ER diagrams or SQL snippets.