0% found this document useful (0 votes)
2 views

Relational-Model-in-DBMSLecture (1)

The relational model in DBMS represents data using tables, known as relations, which consist of rows (tuples) and columns (attributes). It includes important concepts such as relation schema, keys, and constraints, as well as Codd's twelve rules and ACID properties that ensure data integrity and consistency. While the model is widely used due to its simplicity and flexibility, it may face challenges with very large databases and complex relationships.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Relational-Model-in-DBMSLecture (1)

The relational model in DBMS represents data using tables, known as relations, which consist of rows (tuples) and columns (attributes). It includes important concepts such as relation schema, keys, and constraints, as well as Codd's twelve rules and ACID properties that ensure data integrity and consistency. While the model is widely used due to its simplicity and flexibility, it may face challenges with very large databases and complex relationships.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Relational Model in DBMS

The relational model uses a collection of tables to represent both data and the relationships among those data. Each table has
multiple columns, and each column has a unique name. Tables are also known as relations. The relational model is an example of a
record-based model. Record-based models are named so because the database is structured in fixed-format records of several
types. Each table contains records of a particular type, defining a fixed number of fields, or attributes. The relational data model is
the most widely used data model, and a vast majority of current database systems are based on the relational model.

What is the Relational Model?

The relational model represents how data is stored in relational databases. A relational database consists of a collection of tables,
each of which is assigned a unique name. Consider a relation STUDENT with attributes ROLL_NO, NAME, ADDRESS, PHONE, and AGE.

Table: STUDENT

Roll_No Name Address Phone Age


1 John Lapinig +639234567812 18
2 Jame Gamay +639234567813 19
s
3 Mike Arteche +639234567814 17
4 Kevin Oras NULL 18

Important Terminologies

 Attribute: Properties defining an entity (e.g., ROLL_NO, NAME, ADDRESS).


 Relation Schema: Defines the structure of a relation. Example: STUDENT (ROLL_NO, NAME, ADDRESS, PHONE, AGE).
 Tuple: Each row in a relation. Example: (1, John, Lapinig, +639234567812, 18).
 Relation Instance: The set of tuples at a given time.
 Degree: Number of attributes in a relation (e.g., STUDENT has a degree of 5).
 Cardinality: Number of tuples in a relation (STUDENT has a cardinality of 4).
 NULL Values: Unknown or unavailable values (e.g., PHONE of Kevin is NULL).
 Relation Keys: Keys uniquely identifying rows.
o Primary key
o Candidate key
o Super Key
o Foreign key
o Alternate Key
o Composite Key

Constraints in the Relational Model

 Domain Constraints: Attribute values must lie within a specified range (e.g., AGE > 0).
 Key Integrity: A relation must have a unique key (e.g., ROLL_NO in STUDENT is unique and non-null).
 Referential Integrity: Attributes in one table must reference valid values in another table.

Example: Referential Integrity Constraint

Table: BRANCH

Branch_Code Branch_Name
CS Computer Science
IT Information Technology
ECE Electronics & Communication
CV Civil Engineering

Table: STUDENT

Roll_N Name Addres Phone Age Branch_Code


o s
1 John Lapinig +639234567812 18 CS
2 James Gamay +639234567813 19 IT
3 Mike Arteche +639234567814 17 ECE
4 Kevin Oras NULL 18 NULL

BRANCH_CODE in STUDENT can only take values present in BRANCH_CODE of BRANCH.

Anomalies in the Relational Model


 Insertion Anomaly: Cannot insert a student with an undefined BRANCH_CODE.
 Deletion Anomaly: Cannot delete a referenced BRANCH_CODE.
 Update Anomaly: Modifying BRANCH_CODE in BRANCH requires updating all related records in STUDENT.

Codd’s Twelve Rules of Relational Database

Edgar F. Codd proposed 12 rules to define a true relational DBMS:

1. Foundation Rule: The system must use relational capabilities.


2. Information Rule: Data is stored in table cells.
3. Guaranteed Access Rule: Data elements must be accessible by table name, primary key, and attribute name.
4. Systematic Treatment of NULL Values: NULL represents missing or unknown values.
5. Active Online Catalog: Metadata must be stored in an online catalog.
6. Comprehensive Data Sub-language Rule: A database must support a complete data manipulation language.
7. View Updating Rule: Views should be automatically updatable.
8. High-Level Insert, Update, Delete: Operations should support sets of records.
9. Physical Data Independence: Changing data storage should not affect applications.
10. Logical Data Independence: Schema changes should not affect applications.
11. Integrity Independence: Integrity constraints must be definable in the database.
12. Non-Subversion Rule: Bypassing integrity constraints should not be possible.

ACID Properties

1. Atomicity: Transactions are all-or-nothing.


2. Consistency: Transactions maintain database consistency.
3. Isolation: Concurrent transactions do not interfere.
4. Durability: Committed transactions persist.

Advantages of the Relational Model

 Simple and easy to understand.


 Flexible structure.
 Secure data management.
 Ensures data accuracy and integrity.
 Supports easy data manipulation.

Disadvantages of the Relational Model

 Not ideal for very large databases.


 Complex relations between tables may be hard to manage.
 High query response time for complex queries.

Characteristics of the Relational Model

 Data is represented in tables (relations).


 Relationships are maintained between tables.
 Supports operations like data definition, manipulation, and transaction management.
 Each column represents an attribute with a unique name.
 Each row represents a unique entity.

This snippet provides a comprehensive understanding of the relational model in DBMS, covering key concepts, terminologies,
constraints, Codd's rules, and ACID properties.

You might also like