Chapter :-2 (English)
| Site: | AssessmentKaro |
| Course: | Database Management System |
| Book: | Chapter :-2 (English) |
| Printed by: | Guest user |
| Date: | Saturday, 18 April 2026, 6:50 PM |
Description
Topic wise chapter (English)
1. Data Model
Data Model
definition:
A data model is a structured way to describe how data is stored, organized, related, and managed in a database.
It defines:
· Data structure (tables, objects, attributes)
· Relationships between data
· Constraints and rules
Examples: Hierarchical model, Network model, Relational model, Object-oriented model, ER model.
ü Advantages of Data Models
1. Clear Understanding of Data
Provides a clear structure of the database, making it easier to understand how data is organized.
2. Improves Communication
Helps designers, developers, and users communicate using a common framework.
3. Ensures Data Consistency
Defines rules and constraints, helping maintain accurate and consistent data.
4. Simplifies Design
Guides the creation of databases by showing relationships and data flow.
5. Supports Better Database Performance
Well-modeled data can lead to faster queries and efficient storage.
ü Disadvantages of Data Models
1. Time-Consuming
Creating a good data model requires analysis and planning, which takes time.
2. Needs Skilled Designers
Requires knowledge and experience; poor modeling leads to poor database design.
3. Rigid Structure
Once a model is created, modifying it later can be difficult and costly.
4. Not Always Real-World Perfect
Sometimes real-world situations are too complex to fit perfectly into a model.
5. Additional Development Cost
Detailed modeling increases the initial cost of projects.
2. Types of Data Models
Types of Data Models
1. Hierarchical Data Model
Definition:
Organizes data in a tree structure with a parent–child (one-to-many) relationship.
✔ Advantages
· Simple and fast for hierarchical data
· Provides high performance
· Easy to understand structure
✔Disadvantages
· Cannot represent many-to-many relationships
· Rigid structure; difficult to modify
· Requires knowledge of access paths
2. Network Data Model
Definition:
Uses a graph structure allowing many-to-many relationships.
✔ Advantages
· Supports complex relationships
· Faster access due to direct pointers
· More flexible than hierarchical model
✔ Disadvantages
· Very complex to design
· Difficult for users to navigate
· Hard to modify once implemented
3. Relational Data Model
Definition:
Organizes data in tables (relations) using rows and columns.
✔ Advantages
· Easy to use and understand
· Supports SQL (powerful query language)
· Strong data integrity and flexibility
✔ Disadvantages
· Slower than hierarchical/network models for very large datasets
· Requires powerful hardware for huge databases
· Joins can reduce performance
4. Object-Oriented Data Model
Definition:
Stores data as objects similar to object-oriented programming.
✔ Advantages
· Handles complex data (images, videos, objects)
· Reusability through inheritance
· Good for multimedia and engineering applications
✔ Disadvantages
· More complex to design
· Not widely used as relational models
· Difficult to integrate with existing relational databases
5. Entity–Relationship (ER) Model
Definition:
Uses ER diagrams with entities, attributes, and relationships to design databases.
✔ Advantages
· Excellent for database design and visualization
· Easy to understand
· Helps identify relationships and constraints
✔ Disadvantages
· Not a physical implementation model
· Limited in handling complex constraints
· Needs conversion to relational model before use
6. Object-Relational Data Model
Definition:
Combines relational and object-oriented features.
✔ Advantages
· Supports complex data types and relationships
· More flexible than pure relational model
· Good for modern applications
✔ Disadvantages
· Higher complexity
· Requires advanced skill to design and manage
· May reduce performance if not optimized
📌 Short Table
|
Data Model |
Structure |
Advantage |
Disadvantage |
|
Hierarchical |
Tree |
Simple, fast |
Rigid, no M:N |
|
Network |
Graph |
Supports M:N |
Complex |
|
Relational |
Tables |
Easy, powerful |
Slower with huge data |
|
Object-Oriented |
Objects |
Handles complex data |
Hard to implement |
|
ER Model |
Diagram |
Great for design |
Not for implementation |
|
Object-Relational |
Hybrid |
Flexible, supports complex types |
Complex, costly |
Concept of Key in DBMS
3. Concept of Key in DBMS
Concept of Key in DBMS
Definition:
A key is an attribute or a set of attributes in a database table that is used to uniquely identify each record in that table.
It also helps to establish and enforce relationships between tables.
1. Primary Key (PK)
Definition:
A Primary Key is a field (or combination of fields) in a database table that uniquely identifies each record in that table.
· It cannot have NULL values.
· Each table can have only one primary key.
Example:
In a Student table, StudentID can be the primary key because it uniquely identifies each student.
✅ Advantages of Primary Key
1. Ensures Uniqueness – No two records can have the same primary key value.
2. Maintains Data Integrity – Helps enforce correct relationships between tables.
3. Faster Data Retrieval – Often indexed automatically, speeding up searches.
4. Supports Referential Integrity – Can be referenced by foreign keys in other tables.
5. Simplifies Updates and Deletes – Clear identification of records reduces errors.
✅ Disadvantages of Primary Key
1. Cannot Change Easily – Changing a primary key value may affect related tables.
2. Cannot Be NULL – Every record must have a value, which may not always be practical.
3. Adds Complexity – Choosing an appropriate primary key can be difficult.
4. Dependency Issues – Updates or deletions in parent table require handling in child tables.
5. Overhead for Large Tables – Indexing and maintaining a primary key in very large tables may slightly affect performance.
2. Candidate Key
Definition:
A Candidate Key is an attribute (or a set of attributes) in a table that can uniquely identify each record.
· A table can have one or more candidate keys.
· One of these candidate keys is selected as the Primary Key.
Example:
In a Student table:
· StudentID and Email could both uniquely identify a student.
· Either can be chosen as the primary key; the other remains a candidate key.
✅ Advantages of Candidate Key
1. Ensures Uniqueness – Can uniquely identify each record in a table.
2. Provides Options for Primary Key – Helps in selecting the best attribute as primary key.
3. Maintains Data Integrity – Supports consistent and reliable data.
4. Supports Relationships – Can be used as a foreign key in related tables.
5. Flexible – Multiple candidate keys allow alternate ways to identify records.
✅ Disadvantages of Candidate Key
1. Increases Complexity – More candidate keys make design slightly more complex.
2. Maintenance Overhead – Each candidate key must maintain uniqueness.
3. Cannot Handle NULL Values – Must have valid values to identify records.
4. Dependency Issues – Changing a candidate key may affect foreign key relationships.
5. Requires Careful Selection – Choosing the most suitable key is sometimes difficult.
3. Foreign Key (FK)
Definition:
A Foreign Key is an attribute (or set of attributes) in a table that refers to the primary key of another table.
· It is used to establish and enforce a link between two tables.
· It ensures referential integrity, meaning data in one table must match values in the related table.
Example:
· StudentID in an Enrollment table can be a foreign key referencing StudentID in the Student table.
✅ Advantages of Foreign Key
1. Maintains Referential Integrity – Ensures related data in different tables is consistent.
2. Prevents Orphan Records – Cannot insert a value in the child table unless it exists in the parent table.
3. Defines Relationships – Clearly establishes one-to-many or many-to-one relationships.
4. Supports Data Accuracy – Invalid or inconsistent data is prevented.
5. Improves Database Organization – Helps structure relational data effectively.
✅ Disadvantages of Foreign Key
1. Insert/Update/Delete Restrictions – Must satisfy constraints; otherwise, operations fail.
2. Slower Performance – Checking foreign key constraints can slow down inserts and updates.
3. Complexity – Makes database design more complex with multiple linked tables.
4. Dependency Issues – Changes in the parent table may require cascading changes in the child table.
5. Cannot Be NULL Easily – If a foreign key must reference a parent record, NULL values may be restricted depending on the design.
4. Composite Key
Definition:
A Composite Key is a primary key made up of two or more attributes in a table that together uniquely identify a record.
· Single attributes alone cannot uniquely identify the record.
Example:
In an Enrollment table:
| StudentID | CourseID | Grade |
· Neither StudentID nor CourseID alone is unique.
· The combination (StudentID + CourseID) forms a composite key.
✅ Advantages of Composite Key
1. Ensures Uniqueness – Can uniquely identify records when a single attribute is insufficient.
2. Maintains Data Integrity – Helps prevent duplicate entries for the same combination.
3. Supports Relationships – Can be used as a foreign key in related tables.
4. Flexible – Can combine multiple attributes as needed for uniqueness.
5. Efficient for Many-to-Many Relationships – Commonly used in junction tables.
❌ Disadvantages of Composite Key
1. Complexity – More difficult to design and use than a single primary key.
2. Larger Indexes – Indexing on multiple columns may reduce performance.
3. Difficult to Maintain – Updating any part of the composite key affects all relationships.
4. Not User-Friendly – Harder to read and remember composite key values.
5. Foreign Key Complications – Referencing a composite key in another table requires all components.
Concept of Key in DBMS
Definition:
A key is an attribute or a set of attributes in a database table that is used to uniquely identify each record in that table.
It also helps to establish and enforce relationships between tables.
1. Primary Key (PK)
Definition:
A Primary Key is a field (or combination of fields) in a database table that uniquely identifies each record in that table.
· It cannot have NULL values.
· Each table can have only one primary key.
Example:
In a Student table, StudentID can be the primary key because it uniquely identifies each student.
✅ Advantages of Primary Key
1. Ensures Uniqueness – No two records can have the same primary key value.
2. Maintains Data Integrity – Helps enforce correct relationships between tables.
3. Faster Data Retrieval – Often indexed automatically, speeding up searches.
4. Supports Referential Integrity – Can be referenced by foreign keys in other tables.
5. Simplifies Updates and Deletes – Clear identification of records reduces errors.
✅ Disadvantages of Primary Key
1. Cannot Change Easily – Changing a primary key value may affect related tables.
2. Cannot Be NULL – Every record must have a value, which may not always be practical.
3. Adds Complexity – Choosing an appropriate primary key can be difficult.
4. Dependency Issues – Updates or deletions in parent table require handling in child tables.
5. Overhead for Large Tables – Indexing and maintaining a primary key in very large tables may slightly affect performance.
2. Candidate Key
Definition:
A Candidate Key is an attribute (or a set of attributes) in a table that can uniquely identify each record.
· A table can have one or more candidate keys.
· One of these candidate keys is selected as the Primary Key.
Example:
In a Student table:
· StudentID and Email could both uniquely identify a student.
· Either can be chosen as the primary key; the other remains a candidate key.
✅ Advantages of Candidate Key
1. Ensures Uniqueness – Can uniquely identify each record in a table.
2. Provides Options for Primary Key – Helps in selecting the best attribute as primary key.
3. Maintains Data Integrity – Supports consistent and reliable data.
4. Supports Relationships – Can be used as a foreign key in related tables.
5. Flexible – Multiple candidate keys allow alternate ways to identify records.
✅ Disadvantages of Candidate Key
1. Increases Complexity – More candidate keys make design slightly more complex.
2. Maintenance Overhead – Each candidate key must maintain uniqueness.
3. Cannot Handle NULL Values – Must have valid values to identify records.
4. Dependency Issues – Changing a candidate key may affect foreign key relationships.
5. Requires Careful Selection – Choosing the most suitable key is sometimes difficult.
3. Foreign Key (FK)
Definition:
A Foreign Key is an attribute (or set of attributes) in a table that refers to the primary key of another table.
· It is used to establish and enforce a link between two tables.
· It ensures referential integrity, meaning data in one table must match values in the related table.
Example:
· StudentID in an Enrollment table can be a foreign key referencing StudentID in the Student table.
✅ Advantages of Foreign Key
1. Maintains Referential Integrity – Ensures related data in different tables is consistent.
2. Prevents Orphan Records – Cannot insert a value in the child table unless it exists in the parent table.
3. Defines Relationships – Clearly establishes one-to-many or many-to-one relationships.
4. Supports Data Accuracy – Invalid or inconsistent data is prevented.
5. Improves Database Organization – Helps structure relational data effectively.
✅ Disadvantages of Foreign Key
1. Insert/Update/Delete Restrictions – Must satisfy constraints; otherwise, operations fail.
2. Slower Performance – Checking foreign key constraints can slow down inserts and updates.
3. Complexity – Makes database design more complex with multiple linked tables.
4. Dependency Issues – Changes in the parent table may require cascading changes in the child table.
5. Cannot Be NULL Easily – If a foreign key must reference a parent record, NULL values may be restricted depending on the design.
4. Composite Key
Definition:
A Composite Key is a primary key made up of two or more attributes in a table that together uniquely identify a record.
· Single attributes alone cannot uniquely identify the record.
Example:
In an Enrollment table:
| StudentID | CourseID | Grade |
· Neither StudentID nor CourseID alone is unique.
· The combination (StudentID + CourseID) forms a composite key.
✅ Advantages of Composite Key
1. Ensures Uniqueness – Can uniquely identify records when a single attribute is insufficient.
2. Maintains Data Integrity – Helps prevent duplicate entries for the same combination.
3. Supports Relationships – Can be used as a foreign key in related tables.
4. Flexible – Can combine multiple attributes as needed for uniqueness.
5. Efficient for Many-to-Many Relationships – Commonly used in junction tables.
❌ Disadvantages of Composite Key
1. Complexity – More difficult to design and use than a single primary key.
2. Larger Indexes – Indexing on multiple columns may reduce performance.
3. Difficult to Maintain – Updating any part of the composite key affects all relationships.
4. Not User-Friendly – Harder to read and remember composite key values.
5. Foreign Key Complications – Referencing a composite key in another table requires all components.
4. Constraints in DBMS
Constraints in DBMS
Definition:
A constraint is a rule applied on a database table to restrict the type of data that can be inserted, updated, or deleted, ensuring data accuracy, consistency, and integrity.
Common Types of Constraints:
1. Primary Key Constraint – Uniquely identifies each record.
2. Foreign Key Constraint – Maintains referential integrity between tables.
3. Unique Constraint – Ensures all values in a column are unique.
4. Not Null Constraint – Ensures a column cannot have NULL values.
5. Check Constraint – Ensures column values satisfy a specific condition.
6. Default Constraint – Assigns a default value to a column if no value is provided.
✅ Advantages of Constraints
1. Maintains Data Integrity – Ensures the accuracy and consistency of data.
2. Prevents Invalid Data – Restricts incorrect or inappropriate values.
3. Supports Referential Integrity – Foreign keys prevent orphan records.
4. Simplifies Application Logic – Reduces the need to validate data at the application level.
5. Improves Reliability – Helps ensure the database reflects real-world rules and conditions.
❌ Disadvantages of Constraints
1. Slower Performance – Checking constraints during insert, update, or delete operations can reduce speed.
2. Complexity – Designing and managing multiple constraints increases database complexity.
3. Rigid Structure – Constraints may make schema changes or updates more difficult.
4. Dependency Issues – Violating a constraint can block operations, requiring careful management.
5. Extra Storage Overhead – Some constraints (like unique indexes) may require additional storage.
5. Entity Set
Strong Entity Set
Definition:
A Strong Entity Set is an entity set that has a primary key and can be uniquely identified independently of other entities.
· It does not rely on any other entity for identification.
Example:
· Student(StudentID,
Name, Age) – StudentID uniquely identifies each student.
✅ Advantages of Strong Entity Set
1. Independent Identification – Can be uniquely identified without other entities.
2. Simpler Design – Easier to model and understand.
3. Data Integrity – Primary key ensures uniqueness.
4. Supports Relationships – Can participate in relationships with other entities.
✅ Disadvantages of Strong Entity Set
1. Limited Context – Cannot represent dependent entities naturally.
2. May Require Additional Attributes – For complex relationships, extra attributes may be needed.
⭐ Weak Entity Set
Definition:
A Weak Entity Set is an entity set that cannot be uniquely identified by its own attributes alone.
· It depends on a strong entity (owner) for identification via a partial key.
· The relationship connecting them is called an identifying relationship.
Example:
· Dependent(DependentName,
StudentID) – DependentName alone is not unique; together with StudentID (from Student), it forms a unique key.
✅ Advantages of Weak Entity Set
1. Represents Dependent Data – Useful for entities that depend on others.
2. Maintains Referential Integrity – Always linked to a strong entity.
3. Supports Complex Relationships – Handles one-to-many dependent scenarios effectively.
✅ Disadvantages of Weak Entity Set
1. Cannot Exist Independently – Requires a strong entity for identification.
2. More Complex Design – Needs identifying relationship and composite key.
3. Dependency Overhead – Changes in the strong entity may affect weak entities.
Table form
|
Entity Set Type |
Definition |
Advantage |
Disadvantage |
|
Strong Entity |
Can be uniquely identified by its own attributes |
Independent, simple design, supports relationships |
Cannot represent dependent data naturally |
|
Weak Entity |
Cannot be uniquely identified alone; depends on strong entity |
Represents dependent data, maintains integrity, supports complex relationships |
Cannot exist independently, more complex design, dependency overhead |