SlideShare a Scribd company logo
1 of 21
The Relational Model
Logical View of Data
Keys
Integrity Rules
Relational Model:
Relational Model represents how data is stored in Relational Databases. A
relational database stores data in the form of relations (tables).
Objectives
- To promote high degree of data independence
- Eliminate redundancy and consistency problems.
- Ease of use of DBA as well as normal users.
- To provide a community view of the data of spartan simplicity, so that a wide
variety of users can interact with a common model.
The main use of Relational model is data storage and processing.
Relational Model
Relational Database:
A Relational database is a database that organizes data into tables which can be linked—
or related—based on data common to each.
Relational Database Components
1. Relation: A relation is nothing but a table with rows and columns.
2. Attributes: Attributes are the properties that define a relation.
3. Tuple: Each row in the relation is known as tuple.
4. Domain: A domain is a unique set of values permitted for an attribute in a table.
5. Degree: The number of attributes in a relation.
6. Cardinality: The number of tuples in a relation.
Relational Database
Properties of
Relations
• Relation name is distinct from all other relation
names in relational schema.
• Each cell of relation contains exactly one atomic
(single) value.
• Each attribute has a distinct name.
• Values of an attribute are all from the same domain.
• Each tuple is distinct; there are no duplicate tuples.
• Order of attributes has no significance.
• Order of tuples has no significance, theoretically.
• Key – every table must have a unique key to identify
each row
Relational Keys
• Key
A key is an attribute or set of attributes which helps us in uniquely identifying the
rows of a table. It also helps in establishing relationship among tables.
Types
i. Super Key
ii. Candidate Key
iii. Primary Key
iv. Foreign Key
v. Composite Key
Relational Keys
Super Key
A Super key or simply key is a
combination of all possible attribute which
can uniquely identify the rows(tuples) in a
table. This means that a super key may
Have some extra attribute which isn’t
Necessary for uniquely identifying
the rows in the table.
Super Key
Candidate Key
Candidate Key is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes. The Primary key should
be selected from the candidate keys. Every table must have at least a single
candidate key.
Candidate Key
Primary Key
Primary Key is a column/ that uniquely identify every row in that table.
The Primary Key can't be a duplicate meaning the same value can't appear
more than once in the table. A table cannot have more than one primary
key.
Primary Key
Alternate/Secondary Key
All the candidate key which are not a primary key are called an alternate
key.
Alternate/Secondary Key
Foreign Key is a column/attribute that
creates a relationship between two
tables. The purpose of Foreign keys is to
maintain data integrity and allow
navigation between two different
instances of an entity. It acts as a cross-
reference between two tables as it
references the primary
key of another table.
Foreign Key
Composite Key
A key that has more than one attributes is known as composite key. It is
also known as compound key.
Any key such as super key, primary key, candidate key etc. can be called
composite key if it has more than one attributes.
Composite Key
None of these columns alone can play a role of key in this table.
Key in above table: {cust_id, product_code}
This is a composite key as it is made up of more than one attributes.
Composite Key(cont.)
Composite Key (cont.)
A relation schema represents name of the relation with its attributes.
So, A set of table attributes is called a relation schema. For that reason, a relation
schema is also known as table schema. A relation schema can be thought of as the
basic information describing a table or relation. Hence, it is the logical definition of a
table.
e.g.; STUDENT (ROLL_NO, NAME, ADDRESS, PHONE and AGE) is a relation schema
for STUDENT.
If a schema has more than 1 relation, it is called Relational Schema aka Database
Schema. You could say that a database schema is made up of lots of relation
schema and shows how they work together.
Relation Schema
Integrity
Rules
Integrity rules refer to reliability, validity and
authority towards the data. They needed to
inform the DBMS about certain constraints in the
real world.
There are two principal rules:
1. Entity integrity &
2. Referential integrity
For Entity Integrity Rule, each table has a Primary Key and the Primary Key can not have a
Null value.
<Student>
Above, you can see our primary key is Student_ID. We cannot consider Student_Awards
as the primary key since not every student would have received the award.
<Employee>
In the above table, Employee_ID is the primary key.
Entity Integrity Rule
Student_ID Student_Name Student_Awards
Employee_ID Employee_Name Employee_Age Employee_Location
So let us now summarize the Entity Integrity Rule −
i. Make sure that each tuple in a table is unique.
ii. Every table mush has a primary key, for example, Student_ID for a Student
table.
iii. Every entity is unique.
iv. The relations Primary Key must have unique values for each row.
v. Primary Key cannot have NULL value and must be unique.
vi. Example can be an Employee_ID cannot be null in an Employee table
Entity Integrity (cont.)
Referential Integrity Rule in DBMS is based on Primary and Foreign Key. The Rule
defines that a foreign key have a matching primary key. Reference from a table to
another table should be valid.
Referential Integrity Rule
The rule states that
the DEPT_ID in the Employee
table has a matching
valid DEPT_ID in
the Department table.
To allow join, the referential
integrity rule states that the
Primary Key and Foreign Key
have same data types.
These are additional rules specified by users or database administrators that
define or constraint some aspect of the enterprise.
They are alsoknown as business rules.
For example :
The Cust_No in Customer table is given a range from 0001-5000.
General Constraints
Thank you.

More Related Content

What's hot

2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
Anurag
 
Codd's rules
Codd's rulesCodd's rules
Codd's rules
Mohd Arif
 

What's hot (20)

Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
Dbms keys
Dbms keysDbms keys
Dbms keys
 
Codd's rules
Codd's rulesCodd's rules
Codd's rules
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
DBMS: Types of keys
DBMS:  Types of keysDBMS:  Types of keys
DBMS: Types of keys
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
basic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxbasic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptx
 
Schema
SchemaSchema
Schema
 
joins in database
 joins in database joins in database
joins in database
 
Types of keys dbms
Types of keys dbmsTypes of keys dbms
Types of keys dbms
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 

Similar to The Relational Database Model

Module 2 dbms.pptx
Module 2 dbms.pptxModule 2 dbms.pptx
Module 2 dbms.pptx
VijishK
 
Whats the Schema Table Column Row Attribute Entity Pri.pdf
Whats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdfWhats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdf
Whats the Schema Table Column Row Attribute Entity Pri.pdf
exxonzone
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
ELIMENG
 
Understanding Entity Relationship Models
Understanding Entity Relationship ModelsUnderstanding Entity Relationship Models
Understanding Entity Relationship Models
HamzaNadeem527928
 

Similar to The Relational Database Model (20)

B & c
B & cB & c
B & c
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
 
Relational Model
Relational ModelRelational Model
Relational Model
 
Types of keys in dbms
Types of keys in dbmsTypes of keys in dbms
Types of keys in dbms
 
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLESDATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
 
Module 2 dbms.pptx
Module 2 dbms.pptxModule 2 dbms.pptx
Module 2 dbms.pptx
 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
 
Whats the Schema Table Column Row Attribute Entity Pri.pdf
Whats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdfWhats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdf
Whats the Schema Table Column Row Attribute Entity Pri.pdf
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
 
Understanding Entity Relationship Models
Understanding Entity Relationship ModelsUnderstanding Entity Relationship Models
Understanding Entity Relationship Models
 
computer-210809080138.pdf
computer-210809080138.pdfcomputer-210809080138.pdf
computer-210809080138.pdf
 
Dbms keysppt
Dbms keyspptDbms keysppt
Dbms keysppt
 
key.pptx
key.pptxkey.pptx
key.pptx
 
Keys in Database
Keys in DatabaseKeys in Database
Keys in Database
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdf
 
Keys.pptx
Keys.pptxKeys.pptx
Keys.pptx
 
DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
SQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptxSQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptx
 
Database Concepts.pptx
Database Concepts.pptxDatabase Concepts.pptx
Database Concepts.pptx
 

More from Shishir Aryal

More from Shishir Aryal (8)

Nikola tesla (The master of Lightening)
Nikola tesla (The master of Lightening)Nikola tesla (The master of Lightening)
Nikola tesla (The master of Lightening)
 
Stuxnet
StuxnetStuxnet
Stuxnet
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
 
Total quality management
Total quality management Total quality management
Total quality management
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and  IAS architectureVon-Neumann machine and  IAS architecture
Von-Neumann machine and IAS architecture
 
Non verbal communication
Non verbal communicationNon verbal communication
Non verbal communication
 
Intercultural communication shishir
Intercultural communication shishirIntercultural communication shishir
Intercultural communication shishir
 
Public key encryption presentation
Public key encryption presentationPublic key encryption presentation
Public key encryption presentation
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

The Relational Database Model

  • 1. The Relational Model Logical View of Data Keys Integrity Rules
  • 2. Relational Model: Relational Model represents how data is stored in Relational Databases. A relational database stores data in the form of relations (tables). Objectives - To promote high degree of data independence - Eliminate redundancy and consistency problems. - Ease of use of DBA as well as normal users. - To provide a community view of the data of spartan simplicity, so that a wide variety of users can interact with a common model. The main use of Relational model is data storage and processing. Relational Model
  • 3. Relational Database: A Relational database is a database that organizes data into tables which can be linked— or related—based on data common to each. Relational Database Components 1. Relation: A relation is nothing but a table with rows and columns. 2. Attributes: Attributes are the properties that define a relation. 3. Tuple: Each row in the relation is known as tuple. 4. Domain: A domain is a unique set of values permitted for an attribute in a table. 5. Degree: The number of attributes in a relation. 6. Cardinality: The number of tuples in a relation. Relational Database
  • 4.
  • 5.
  • 6. Properties of Relations • Relation name is distinct from all other relation names in relational schema. • Each cell of relation contains exactly one atomic (single) value. • Each attribute has a distinct name. • Values of an attribute are all from the same domain. • Each tuple is distinct; there are no duplicate tuples. • Order of attributes has no significance. • Order of tuples has no significance, theoretically. • Key – every table must have a unique key to identify each row
  • 7. Relational Keys • Key A key is an attribute or set of attributes which helps us in uniquely identifying the rows of a table. It also helps in establishing relationship among tables. Types i. Super Key ii. Candidate Key iii. Primary Key iv. Foreign Key v. Composite Key Relational Keys
  • 8. Super Key A Super key or simply key is a combination of all possible attribute which can uniquely identify the rows(tuples) in a table. This means that a super key may Have some extra attribute which isn’t Necessary for uniquely identifying the rows in the table. Super Key
  • 9. Candidate Key Candidate Key is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes. The Primary key should be selected from the candidate keys. Every table must have at least a single candidate key. Candidate Key
  • 10. Primary Key Primary Key is a column/ that uniquely identify every row in that table. The Primary Key can't be a duplicate meaning the same value can't appear more than once in the table. A table cannot have more than one primary key. Primary Key
  • 11. Alternate/Secondary Key All the candidate key which are not a primary key are called an alternate key. Alternate/Secondary Key
  • 12. Foreign Key is a column/attribute that creates a relationship between two tables. The purpose of Foreign keys is to maintain data integrity and allow navigation between two different instances of an entity. It acts as a cross- reference between two tables as it references the primary key of another table. Foreign Key
  • 13. Composite Key A key that has more than one attributes is known as composite key. It is also known as compound key. Any key such as super key, primary key, candidate key etc. can be called composite key if it has more than one attributes. Composite Key
  • 14. None of these columns alone can play a role of key in this table. Key in above table: {cust_id, product_code} This is a composite key as it is made up of more than one attributes. Composite Key(cont.) Composite Key (cont.)
  • 15. A relation schema represents name of the relation with its attributes. So, A set of table attributes is called a relation schema. For that reason, a relation schema is also known as table schema. A relation schema can be thought of as the basic information describing a table or relation. Hence, it is the logical definition of a table. e.g.; STUDENT (ROLL_NO, NAME, ADDRESS, PHONE and AGE) is a relation schema for STUDENT. If a schema has more than 1 relation, it is called Relational Schema aka Database Schema. You could say that a database schema is made up of lots of relation schema and shows how they work together. Relation Schema
  • 16. Integrity Rules Integrity rules refer to reliability, validity and authority towards the data. They needed to inform the DBMS about certain constraints in the real world. There are two principal rules: 1. Entity integrity & 2. Referential integrity
  • 17. For Entity Integrity Rule, each table has a Primary Key and the Primary Key can not have a Null value. <Student> Above, you can see our primary key is Student_ID. We cannot consider Student_Awards as the primary key since not every student would have received the award. <Employee> In the above table, Employee_ID is the primary key. Entity Integrity Rule Student_ID Student_Name Student_Awards Employee_ID Employee_Name Employee_Age Employee_Location
  • 18. So let us now summarize the Entity Integrity Rule − i. Make sure that each tuple in a table is unique. ii. Every table mush has a primary key, for example, Student_ID for a Student table. iii. Every entity is unique. iv. The relations Primary Key must have unique values for each row. v. Primary Key cannot have NULL value and must be unique. vi. Example can be an Employee_ID cannot be null in an Employee table Entity Integrity (cont.)
  • 19. Referential Integrity Rule in DBMS is based on Primary and Foreign Key. The Rule defines that a foreign key have a matching primary key. Reference from a table to another table should be valid. Referential Integrity Rule The rule states that the DEPT_ID in the Employee table has a matching valid DEPT_ID in the Department table. To allow join, the referential integrity rule states that the Primary Key and Foreign Key have same data types.
  • 20. These are additional rules specified by users or database administrators that define or constraint some aspect of the enterprise. They are alsoknown as business rules. For example : The Cust_No in Customer table is given a range from 0001-5000. General Constraints