SlideShare a Scribd company logo
Aruna Devi C (DSCASC)
1
Data Base Management System
[DBMS]
Chapter 4
Unit III
Relational Model
Aruna Devi C (DSCASC)
Relational Data Model
 The first commercial implementations of the relational model became
available in the early 1980s, such as the SQL/DS system on the MVS operating
system by IBM and the Oracle DBMS.
 Since then, the model has been implemented in a large number of commercial
systems.
 Current popular relational DBMSs (RDBMSs) include DB2 and Informix
Dynamic Server (from IBM), Oracle and Rdb (from Oracle), Sybase DBMS
(from Sybase) and SQLServer and Access (from Microsoft).
 In addition, several open source systems, such as MySQL and PostgreSQL, are
available.
Aruna Devi C (DSCASC)
3
The relational model represents the database as a collection of relations.
The relational data model represents data in the form of the table.
Relational data consist of three components as follows:
 Data structure: Data are organized in the form of tables with rows and
columns.
 Data Manipulation: Powerful operations (using SQL) are used to
manipulate data, store data in the relation.
 Data integrity: Facilities are included to specify business rules that maintain
the integrity of data when they are manipulated.
Relational Model Concepts
Aruna Devi C (DSCASC)
4
Relation/Table
Aruna Devi C (DSCASC)
5
 Attribute is a column represent the attributes of a real-time object.
 When a relation is thought of a table of values, Each row represent a collection of
related data values.
 Tuple is a row, which represents a collection of related data values.
 Domains: A domain D is a set of atomic values.
 The set of allowed values for each attribute is called the domain of the Attribute.
 The data type describing the types of values that can appear in each column is
called a domain.
i.e., Domain represent set of all permissible values for that column.
Example: Ph-no. – Mobile or landline
Name
Emp Age – Value between 15 to 80
Tuples, Attribute, Domain, Relations
Relational Model Concepts
Aruna Devi C (DSCASC)
Relation:
 A relation schema R, denoted by R(A1, A2, ...,An), is made up of a relation name
R and a list of attributes, A1, A2, ..., An.
 Each attribute Ai is the name of a role played by some domain D in the relation
schema R.
 D is called the domain of Ai and is denoted by dom(Ai).
 A relation schema is used to describe a relation; R is called the name of this
relation.
Example:
STUDENT(Name: string, Ssn: string, Home_phone: string, Address: string,
Office_phone: string, Age: integer, Gpa: real)
Tuples, Attribute, Domain, Relations (Cont.,)
Aruna Devi C (DSCASC)
7
 A1, A2, …, An are attributes
 R = (A1, A2, …, An ) is a relation schema
Example:
Customer_schema = (customer_name, customer_ street, customer_ city)
 r(R) is a relation on the relation schema R
Example: customer (Customer_schema)
An element t of r is a tuple, represented by a row in a table
Relation Schema
Jones
Smith
Curry
Lindsay
customer_name
Main
North
North
Park
customer_street
Harrison
Rye
Rye
Pittsfield
customer_city
customer
tuples
(or rows)
attributes
(or columns)
Aruna Devi C (DSCASC)
DEFINITION SUMMARY
Informal Terms Formal Terms
Table Relation
Column Attribute/Domain
Row Tuple
Values in a column Domain
Table Definition Schema of a Relation
Populated Table Extension
Aruna Devi C (DSCASC)
Relational Model Constraints
and Relational Database Schemas
Constraints on databases can generally be divided into three
main categories:
1. Constraints that are inherent in the data model. We call these inherent
model-based constraints or implicit constraints.
For example, the constraint that a relation cannot have duplicate tuples is an
inherent constraint.
2. Constraints that can be directly expressed in schemas of the data model,
typically by specifying them in the DDL (data definition language).
We call these schema-based constraints or explicit constraints.
3. Constraints that cannot be directly expressed in the schemas of the data model,
and hence must be expressed and enforced by the application programs.
We call these application-based or semantic constraints or business rules.
Aruna Devi C (DSCASC)
 Domain Constraint
 Key/Entity Constraint
 Referential Integrity Constraint
 Operational Constraint
11
Types of Constraints:
Relational Model Constraints
and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
Domain Constraint:
All the values that appear in a column of a relation must be taken from the
same domain. Domain means data type, size and the allowable range.
The data types include standard numeric data types for integers and real
numbers.
There are also characters, Booleans, fixed-length strings and variable length
strings, date, time, timestamp and so on.
12
Relational Model Constraints
and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
Key / Entity Constraint:
Key is a field that uniquely identifies the records, tables or data.
Different types of keys:
 Primary Key
 Foreign Key
 Unique key
 Super key
 Candidate key
 Primary Key:
A primary key is one or more columns in a table .
Every relation has a primary key, and the primary key values are
“unique and not null”.
Eg: Reg.No
Unique key :
Unique key is one or more columns in a table. It can contain Null value.
 Foreign Key:
Foreign key represent relationship between tables.
13
Relational Model Constraints and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
 Super key :
A super key is a set of one or more attributes that, taken collectively.
Eg: {Reg. no} or {Reg.No, Name}
 Candidate key :
A relation schema has more than one key, each of the keys is called a
candidate key.
All the key which satisfies the condition of primary key can be a candidate
key.
One of the candidate keys can be chosen to be the primary key.
Ex: {cname, SSN} is a super key,
but the attribute SSN is a candidate key.
{Reg.No} and {ph.No} are two candidate key in student table.
14
Relational Model Constraints and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
Operational Constraint:
It is designed to enforce the business rules namely operational constraints
to the database.
Example: Min balance of Bank account is Rs. 1000/- ….etc.
Referential Integrity Constraint:
It is specified between two relations and is used to maintain the consistency
among tuples in the two relations.
Ensures that a value that appears in one relation for a given set of attributes
also appears for a certain set of attributes in another relation.
15
Relational Model Constraints and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
Referential Integrity:
 Ensures that a value that appears in one relation for a given set of attributes also
appears for a certain set of attributes in another relation.
 Example: If “Perryridge” is a branch name appearing in one of the tuples in
the account relation, then there exists a tuple in the branch relation for
branch “Perryridge”.
 Primary and candidate keys and foreign keys can be specified as part of the SQL
create table statement:
 The primary key clause lists attributes that comprise the primary key.
 The foreign key clause lists the attributes that comprise the foreign key and
the name of the relation referenced by the foreign key. By default, a foreign
key references the primary key attributes of the referenced table.
16
Relational Model Constraints and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
Constraints on a Single Relation
 Not Null
 Primary key
 Unique
 Check (P ), where P is a predicate
18
Not Null Constraint
A constraint specifies whether null values are or are not permitted. The
constraint is specified as NOT NULL.
 Declaring branch_name for branch table as not null
branch_name char(15) not null
 Declaring the domain salary to be not null
salary numeric(12,2) not null
Relational Model Constraints and Relational Database Schemas (Cont.,)
Aruna Devi C (DSCASC)
One possible database state for the COMPANY relational
database schema.
Aruna Devi C (DSCASC)
Database Schema for Company
Aruna Devi C (DSCASC)
Other Types of Constraints:
The preceding integrity constraints are included in the data definition
language (DDL).
Semantic Integrity Constraints:
 semantic integrity constraints, which may have to be specified and enforced on a
relational database.
Examples:
1. The salary of an employee should not exceed the salary of the employee’s
supervisor.
2. “The max. no. of hours per employee for all projects he or she works on is 56
hrs per week”.
- A constraint specification language may have to be used to express these
SQL allows triggers and ASSERTIONS to allow for some of these.
Relational Model Constraints and Relational Database Schemas (Cont.,)
-----------------------------
Aruna Devi C (DSCASC)
Update Operations, Transactions,
and Dealing with Constraint Violations
 The operations of the relational model can be categorized into retrievals and
updates.
 A relational algebra expression forms a new relation after applying a number
of algebraic operators to an existing set of relations; its main use is for
querying a database to retrieve information.
 There are three basic operations that can change the states of relations in the
database:
Insert, Delete, and Update (or Modify)
Aruna Devi C (DSCASC)
The Insert Operation:
 The Insert operation provides a list of attribute values for a new tuple t that is to be inserted
into a relation R.
Insert can violate any of the four types of constraints:
 Domain constraints can be violated if an attribute value is given that does not appear in the
corresponding domain.
 Key constraints can be violated if a key value in the new tuple t already exists in another tuple
in the relation r(R).
 Entity integrity can be violated if any part of the primary key of the new tuple t is
NULL.
 Referential integrity can be violated if the value of any foreign key in t refers to a
tuple that does not exist in the referenced relation.
Update Operations, Transactions,
and Dealing with Constraint Violations (Cont.,)
Aruna Devi C (DSCASC)
The Insert Operation: Example
Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, NULL, ‘1960-04-05’, ‘6357 Windy Lane,
Katy, TX’, F, 28000, NULL, 4> into EMPLOYEE.
 Result: This insertion violates the entity integrity constraint (NULL for the
primary key Ssn), so it is rejected.
Insert <‘Alicia’, ‘J’, ‘Zelaya’, ‘999887777’, ‘1960-04-05’, ‘6357 Windy Lane,
Katy, TX’, F, 28000, ‘987654321’, 4> into EMPLOYEE.
 Result: This insertion violates the key constraint because another tuple with
the same Ssn value already exists in the EMPLOYEE relation, and so it is
rejected.
Example
Aruna Devi C (DSCASC)
Example
The Insert Operation: Example (cont.,)
Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, ‘677678989’, ‘1960-04-05’, ‘6357
Windswept, Katy, TX’, F, 28000, ‘987654321’, 7> into EMPLOYEE
 Result: This insertion violates the referential integrity constraint
specified on Dno in EMPLOYEE because no corresponding referenced
tuple exists in DEPARTMENT with Dnumber = 7.
Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, ‘677678989’, ‘1960-04-05’, ‘6357 Windy
Lane, Katy, TX’, F, 28000, NULL, 4> into EMPLOYEE.
 Result: This insertion satisfies all constraints, so it is acceptable.
Aruna Devi C (DSCASC)
The Delete Operation:
 The Delete operation can violate only referential integrity.
 This occurs if the tuple being deleted is referenced by foreign keys from other
tuples in the database.
Example:
Delete the WORKS_ON tuple with Essn = ‘999887777’ and Pno = 10
 Result: This deletion is acceptable and deletes exactly one tuple.
Delete the EMPLOYEE tuple with Ssn = ‘999887777’
 Result: This deletion is not acceptable, because there are tuples in WORKS_ON
that refer to this tuple. Hence, if the tuple in EMPLOYEE is deleted, referential
integrity violations will result.
Update Operations, Transactions,
and Dealing with Constraint Violations (Cont.,)
Company Database
Aruna Devi C (DSCASC)
The Update Operation:
The Update (or Modify) operation is used to change the values of one or
more attributes in a tuple (or tuples) of some relation R.
Example:
Update the salary of the EMPLOYEE tuple with Ssn = ‘999887777’ to 28000
 Result: Acceptable.
Update the Dno of the EMPLOYEE tuple with Ssn = ‘999887777’ to 1
 Result: Acceptable.
Update the Dno of the EMPLOYEE tuple with Ssn = ‘999887777’ to 7
 Result: Unacceptable, because it violates referential integrity.
Update Operations, Transactions,
and Dealing with Constraint Violations (Cont.,)
Company Database
Aruna Devi C (DSCASC)
The Transaction Concept
 A transaction is an executing program that includes some database operations,
such as reading from the database, or applying insertions, deletions, or updates to
the database.
 For example, a transaction to apply a bank withdrawal will typically read the user
account record, check if there is a sufficient balance, and then update the record
by the withdrawal amount.
Aruna Devi C (DSCASC)
EXAMPLES
Aruna Devi C (DSCASC)
Aruna Devi.C (DSCASC) 31
branch (branch_name, branch_city, assets)
customer (customer_name, customer_street, customer_city)
loan (loan_number, branch_name, amount)
borrower (customer_name, loan_number)
account (account_number, branch_name, balance)
depositor (customer_name, account_number)
Database Schema for Bank
Aruna Devi C (DSCASC)
Aruna Devi.C (DSCASC) 32
Schema Diagram for a Banking Enterprise
Aruna Devi C (DSCASC)
Banking Enterprise
Aruna Devi C (DSCASC)
Ad

More Related Content

What's hot (20)

Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
SQL Views
SQL ViewsSQL Views
SQL Views
baabtra.com - No. 1 supplier of quality freshers
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
sunanditaAnand
 
ER MODEL
ER MODELER MODEL
ER MODEL
Rupali Rana
 
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
Anusha sivakumar
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
Kabindra Koirala
 
4 the relational data model and relational database constraints
4 the relational data model and relational database constraints4 the relational data model and relational database constraints
4 the relational data model and relational database constraints
Kumar
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
Saranya Natarajan
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
Megha Patel
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Data Models
Data ModelsData Models
Data Models
RituBhargava7
 
Set operators
Set  operatorsSet  operators
Set operators
Manuel S. Enverga University Foundation
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & Relationship
Bellal Hossain
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
koolkampus
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
BIT Durg
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
Nishant Munjal
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
Anusha sivakumar
 
4 the relational data model and relational database constraints
4 the relational data model and relational database constraints4 the relational data model and relational database constraints
4 the relational data model and relational database constraints
Kumar
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
Megha Patel
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & Relationship
Bellal Hossain
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
koolkampus
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
BIT Durg
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
Nishant Munjal
 

Viewers also liked (20)

File and data base management
File and data base managementFile and data base management
File and data base management
Asad Ahmed
 
Normalization case
Normalization caseNormalization case
Normalization case
Prosanta Ghosh
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
Prosanta Ghosh
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
Prosanta Ghosh
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
Smriti Jain
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
Dr. C.V. Suresh Babu
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
rahulrathore725
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
sameerraaj
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2
eidah20
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
Mustafa Kamel Mohammadi
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013
Prosanta Ghosh
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
Prosanta Ghosh
 
Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013
Prosanta Ghosh
 
Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013
Prosanta Ghosh
 
Mca ii os u-1 introduction to os
Mca  ii  os u-1 introduction to osMca  ii  os u-1 introduction to os
Mca ii os u-1 introduction to os
Rai University
 
Computer project final for class 12 Students
Computer project final for class 12 StudentsComputer project final for class 12 Students
Computer project final for class 12 Students
Shahban Ali
 
Data tabulation related to field force and field
Data tabulation related to field force and fieldData tabulation related to field force and field
Data tabulation related to field force and field
A.k. Azad
 
DB2 LUW - Backup and Recovery
DB2 LUW - Backup and RecoveryDB2 LUW - Backup and Recovery
DB2 LUW - Backup and Recovery
imranasayed
 
File and data base management
File and data base managementFile and data base management
File and data base management
Asad Ahmed
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
Prosanta Ghosh
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
Prosanta Ghosh
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
Smriti Jain
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
sameerraaj
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2
eidah20
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
Mustafa Kamel Mohammadi
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013
Prosanta Ghosh
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
Prosanta Ghosh
 
Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013
Prosanta Ghosh
 
Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013
Prosanta Ghosh
 
Mca ii os u-1 introduction to os
Mca  ii  os u-1 introduction to osMca  ii  os u-1 introduction to os
Mca ii os u-1 introduction to os
Rai University
 
Computer project final for class 12 Students
Computer project final for class 12 StudentsComputer project final for class 12 Students
Computer project final for class 12 Students
Shahban Ali
 
Data tabulation related to field force and field
Data tabulation related to field force and fieldData tabulation related to field force and field
Data tabulation related to field force and field
A.k. Azad
 
DB2 LUW - Backup and Recovery
DB2 LUW - Backup and RecoveryDB2 LUW - Backup and Recovery
DB2 LUW - Backup and Recovery
imranasayed
 
Ad

Similar to Dbms ii mca-ch4-relational model-2013 (20)

COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
Rc Os
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
LPhct2
 
DBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtuDBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtu
shreya520613
 
Intonation to SQL using the query language postgresSQL.pptx
Intonation to SQL using the query language postgresSQL.pptxIntonation to SQL using the query language postgresSQL.pptx
Intonation to SQL using the query language postgresSQL.pptx
csity6996
 
Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
Anjaan Gajendra
 
Relational Model in DBMS detail explanation
Relational Model in DBMS detail explanationRelational Model in DBMS detail explanation
Relational Model in DBMS detail explanation
keerthanaparath1
 
DBMS Unit-2.pdf
DBMS Unit-2.pdfDBMS Unit-2.pdf
DBMS Unit-2.pdf
vaishnavi339314
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
arnold 7490
 
ER model and diagram in database system
ER model and diagram in  database systemER model and diagram in  database system
ER model and diagram in database system
ATS SBGI MIRAJ
 
The SQL data-definition language (DDL) allows the specification of informatio...
The SQL data-definition language (DDL) allows the specification of informatio...The SQL data-definition language (DDL) allows the specification of informatio...
The SQL data-definition language (DDL) allows the specification of informatio...
masiciv688
 
SQL manages and queries database data.ppt
SQL manages and queries database data.pptSQL manages and queries database data.ppt
SQL manages and queries database data.ppt
dharaneshgopal
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
TanishaKochak
 
RDBMS
RDBMSRDBMS
RDBMS
NilaNila16
 
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTSThe Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
Introduction to sql.pdf Database Systems
Introduction to sql.pdf Database SystemsIntroduction to sql.pdf Database Systems
Introduction to sql.pdf Database Systems
adansunahri
 
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
MunawarAhmad22
 
RDBMS
RDBMSRDBMS
RDBMS
NIVEETHITHAS
 
Relational Database Management System part II
Relational Database Management System part IIRelational Database Management System part II
Relational Database Management System part II
KavithaA19
 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013
Prosanta Ghosh
 
Rdbms
RdbmsRdbms
Rdbms
argusacademy
 
COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
Rc Os
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
LPhct2
 
DBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtuDBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtu
shreya520613
 
Intonation to SQL using the query language postgresSQL.pptx
Intonation to SQL using the query language postgresSQL.pptxIntonation to SQL using the query language postgresSQL.pptx
Intonation to SQL using the query language postgresSQL.pptx
csity6996
 
Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
Anjaan Gajendra
 
Relational Model in DBMS detail explanation
Relational Model in DBMS detail explanationRelational Model in DBMS detail explanation
Relational Model in DBMS detail explanation
keerthanaparath1
 
ER model and diagram in database system
ER model and diagram in  database systemER model and diagram in  database system
ER model and diagram in database system
ATS SBGI MIRAJ
 
The SQL data-definition language (DDL) allows the specification of informatio...
The SQL data-definition language (DDL) allows the specification of informatio...The SQL data-definition language (DDL) allows the specification of informatio...
The SQL data-definition language (DDL) allows the specification of informatio...
masiciv688
 
SQL manages and queries database data.ppt
SQL manages and queries database data.pptSQL manages and queries database data.ppt
SQL manages and queries database data.ppt
dharaneshgopal
 
Introduction to sql.pdf Database Systems
Introduction to sql.pdf Database SystemsIntroduction to sql.pdf Database Systems
Introduction to sql.pdf Database Systems
adansunahri
 
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
MunawarAhmad22
 
Relational Database Management System part II
Relational Database Management System part IIRelational Database Management System part II
Relational Database Management System part II
KavithaA19
 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013
Prosanta Ghosh
 
Ad

Recently uploaded (20)

FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 

Dbms ii mca-ch4-relational model-2013

  • 1. Aruna Devi C (DSCASC) 1 Data Base Management System [DBMS] Chapter 4 Unit III Relational Model
  • 2. Aruna Devi C (DSCASC) Relational Data Model  The first commercial implementations of the relational model became available in the early 1980s, such as the SQL/DS system on the MVS operating system by IBM and the Oracle DBMS.  Since then, the model has been implemented in a large number of commercial systems.  Current popular relational DBMSs (RDBMSs) include DB2 and Informix Dynamic Server (from IBM), Oracle and Rdb (from Oracle), Sybase DBMS (from Sybase) and SQLServer and Access (from Microsoft).  In addition, several open source systems, such as MySQL and PostgreSQL, are available.
  • 3. Aruna Devi C (DSCASC) 3 The relational model represents the database as a collection of relations. The relational data model represents data in the form of the table. Relational data consist of three components as follows:  Data structure: Data are organized in the form of tables with rows and columns.  Data Manipulation: Powerful operations (using SQL) are used to manipulate data, store data in the relation.  Data integrity: Facilities are included to specify business rules that maintain the integrity of data when they are manipulated. Relational Model Concepts
  • 4. Aruna Devi C (DSCASC) 4 Relation/Table
  • 5. Aruna Devi C (DSCASC) 5  Attribute is a column represent the attributes of a real-time object.  When a relation is thought of a table of values, Each row represent a collection of related data values.  Tuple is a row, which represents a collection of related data values.  Domains: A domain D is a set of atomic values.  The set of allowed values for each attribute is called the domain of the Attribute.  The data type describing the types of values that can appear in each column is called a domain. i.e., Domain represent set of all permissible values for that column. Example: Ph-no. – Mobile or landline Name Emp Age – Value between 15 to 80 Tuples, Attribute, Domain, Relations Relational Model Concepts
  • 6. Aruna Devi C (DSCASC) Relation:  A relation schema R, denoted by R(A1, A2, ...,An), is made up of a relation name R and a list of attributes, A1, A2, ..., An.  Each attribute Ai is the name of a role played by some domain D in the relation schema R.  D is called the domain of Ai and is denoted by dom(Ai).  A relation schema is used to describe a relation; R is called the name of this relation. Example: STUDENT(Name: string, Ssn: string, Home_phone: string, Address: string, Office_phone: string, Age: integer, Gpa: real) Tuples, Attribute, Domain, Relations (Cont.,)
  • 7. Aruna Devi C (DSCASC) 7  A1, A2, …, An are attributes  R = (A1, A2, …, An ) is a relation schema Example: Customer_schema = (customer_name, customer_ street, customer_ city)  r(R) is a relation on the relation schema R Example: customer (Customer_schema) An element t of r is a tuple, represented by a row in a table Relation Schema Jones Smith Curry Lindsay customer_name Main North North Park customer_street Harrison Rye Rye Pittsfield customer_city customer tuples (or rows) attributes (or columns)
  • 8. Aruna Devi C (DSCASC) DEFINITION SUMMARY Informal Terms Formal Terms Table Relation Column Attribute/Domain Row Tuple Values in a column Domain Table Definition Schema of a Relation Populated Table Extension
  • 9. Aruna Devi C (DSCASC) Relational Model Constraints and Relational Database Schemas Constraints on databases can generally be divided into three main categories: 1. Constraints that are inherent in the data model. We call these inherent model-based constraints or implicit constraints. For example, the constraint that a relation cannot have duplicate tuples is an inherent constraint. 2. Constraints that can be directly expressed in schemas of the data model, typically by specifying them in the DDL (data definition language). We call these schema-based constraints or explicit constraints. 3. Constraints that cannot be directly expressed in the schemas of the data model, and hence must be expressed and enforced by the application programs. We call these application-based or semantic constraints or business rules.
  • 10. Aruna Devi C (DSCASC)  Domain Constraint  Key/Entity Constraint  Referential Integrity Constraint  Operational Constraint 11 Types of Constraints: Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 11. Aruna Devi C (DSCASC) Domain Constraint: All the values that appear in a column of a relation must be taken from the same domain. Domain means data type, size and the allowable range. The data types include standard numeric data types for integers and real numbers. There are also characters, Booleans, fixed-length strings and variable length strings, date, time, timestamp and so on. 12 Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 12. Aruna Devi C (DSCASC) Key / Entity Constraint: Key is a field that uniquely identifies the records, tables or data. Different types of keys:  Primary Key  Foreign Key  Unique key  Super key  Candidate key  Primary Key: A primary key is one or more columns in a table . Every relation has a primary key, and the primary key values are “unique and not null”. Eg: Reg.No Unique key : Unique key is one or more columns in a table. It can contain Null value.  Foreign Key: Foreign key represent relationship between tables. 13 Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 13. Aruna Devi C (DSCASC)  Super key : A super key is a set of one or more attributes that, taken collectively. Eg: {Reg. no} or {Reg.No, Name}  Candidate key : A relation schema has more than one key, each of the keys is called a candidate key. All the key which satisfies the condition of primary key can be a candidate key. One of the candidate keys can be chosen to be the primary key. Ex: {cname, SSN} is a super key, but the attribute SSN is a candidate key. {Reg.No} and {ph.No} are two candidate key in student table. 14 Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 14. Aruna Devi C (DSCASC) Operational Constraint: It is designed to enforce the business rules namely operational constraints to the database. Example: Min balance of Bank account is Rs. 1000/- ….etc. Referential Integrity Constraint: It is specified between two relations and is used to maintain the consistency among tuples in the two relations. Ensures that a value that appears in one relation for a given set of attributes also appears for a certain set of attributes in another relation. 15 Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 15. Aruna Devi C (DSCASC) Referential Integrity:  Ensures that a value that appears in one relation for a given set of attributes also appears for a certain set of attributes in another relation.  Example: If “Perryridge” is a branch name appearing in one of the tuples in the account relation, then there exists a tuple in the branch relation for branch “Perryridge”.  Primary and candidate keys and foreign keys can be specified as part of the SQL create table statement:  The primary key clause lists attributes that comprise the primary key.  The foreign key clause lists the attributes that comprise the foreign key and the name of the relation referenced by the foreign key. By default, a foreign key references the primary key attributes of the referenced table. 16 Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 16. Aruna Devi C (DSCASC) Constraints on a Single Relation  Not Null  Primary key  Unique  Check (P ), where P is a predicate 18 Not Null Constraint A constraint specifies whether null values are or are not permitted. The constraint is specified as NOT NULL.  Declaring branch_name for branch table as not null branch_name char(15) not null  Declaring the domain salary to be not null salary numeric(12,2) not null Relational Model Constraints and Relational Database Schemas (Cont.,)
  • 17. Aruna Devi C (DSCASC) One possible database state for the COMPANY relational database schema.
  • 18. Aruna Devi C (DSCASC) Database Schema for Company
  • 19. Aruna Devi C (DSCASC) Other Types of Constraints: The preceding integrity constraints are included in the data definition language (DDL). Semantic Integrity Constraints:  semantic integrity constraints, which may have to be specified and enforced on a relational database. Examples: 1. The salary of an employee should not exceed the salary of the employee’s supervisor. 2. “The max. no. of hours per employee for all projects he or she works on is 56 hrs per week”. - A constraint specification language may have to be used to express these SQL allows triggers and ASSERTIONS to allow for some of these. Relational Model Constraints and Relational Database Schemas (Cont.,) -----------------------------
  • 20. Aruna Devi C (DSCASC) Update Operations, Transactions, and Dealing with Constraint Violations  The operations of the relational model can be categorized into retrievals and updates.  A relational algebra expression forms a new relation after applying a number of algebraic operators to an existing set of relations; its main use is for querying a database to retrieve information.  There are three basic operations that can change the states of relations in the database: Insert, Delete, and Update (or Modify)
  • 21. Aruna Devi C (DSCASC) The Insert Operation:  The Insert operation provides a list of attribute values for a new tuple t that is to be inserted into a relation R. Insert can violate any of the four types of constraints:  Domain constraints can be violated if an attribute value is given that does not appear in the corresponding domain.  Key constraints can be violated if a key value in the new tuple t already exists in another tuple in the relation r(R).  Entity integrity can be violated if any part of the primary key of the new tuple t is NULL.  Referential integrity can be violated if the value of any foreign key in t refers to a tuple that does not exist in the referenced relation. Update Operations, Transactions, and Dealing with Constraint Violations (Cont.,)
  • 22. Aruna Devi C (DSCASC) The Insert Operation: Example Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, NULL, ‘1960-04-05’, ‘6357 Windy Lane, Katy, TX’, F, 28000, NULL, 4> into EMPLOYEE.  Result: This insertion violates the entity integrity constraint (NULL for the primary key Ssn), so it is rejected. Insert <‘Alicia’, ‘J’, ‘Zelaya’, ‘999887777’, ‘1960-04-05’, ‘6357 Windy Lane, Katy, TX’, F, 28000, ‘987654321’, 4> into EMPLOYEE.  Result: This insertion violates the key constraint because another tuple with the same Ssn value already exists in the EMPLOYEE relation, and so it is rejected. Example
  • 23. Aruna Devi C (DSCASC) Example The Insert Operation: Example (cont.,) Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, ‘677678989’, ‘1960-04-05’, ‘6357 Windswept, Katy, TX’, F, 28000, ‘987654321’, 7> into EMPLOYEE  Result: This insertion violates the referential integrity constraint specified on Dno in EMPLOYEE because no corresponding referenced tuple exists in DEPARTMENT with Dnumber = 7. Insert <‘Cecilia’, ‘F’, ‘Kolonsky’, ‘677678989’, ‘1960-04-05’, ‘6357 Windy Lane, Katy, TX’, F, 28000, NULL, 4> into EMPLOYEE.  Result: This insertion satisfies all constraints, so it is acceptable.
  • 24. Aruna Devi C (DSCASC) The Delete Operation:  The Delete operation can violate only referential integrity.  This occurs if the tuple being deleted is referenced by foreign keys from other tuples in the database. Example: Delete the WORKS_ON tuple with Essn = ‘999887777’ and Pno = 10  Result: This deletion is acceptable and deletes exactly one tuple. Delete the EMPLOYEE tuple with Ssn = ‘999887777’  Result: This deletion is not acceptable, because there are tuples in WORKS_ON that refer to this tuple. Hence, if the tuple in EMPLOYEE is deleted, referential integrity violations will result. Update Operations, Transactions, and Dealing with Constraint Violations (Cont.,) Company Database
  • 25. Aruna Devi C (DSCASC) The Update Operation: The Update (or Modify) operation is used to change the values of one or more attributes in a tuple (or tuples) of some relation R. Example: Update the salary of the EMPLOYEE tuple with Ssn = ‘999887777’ to 28000  Result: Acceptable. Update the Dno of the EMPLOYEE tuple with Ssn = ‘999887777’ to 1  Result: Acceptable. Update the Dno of the EMPLOYEE tuple with Ssn = ‘999887777’ to 7  Result: Unacceptable, because it violates referential integrity. Update Operations, Transactions, and Dealing with Constraint Violations (Cont.,) Company Database
  • 26. Aruna Devi C (DSCASC) The Transaction Concept  A transaction is an executing program that includes some database operations, such as reading from the database, or applying insertions, deletions, or updates to the database.  For example, a transaction to apply a bank withdrawal will typically read the user account record, check if there is a sufficient balance, and then update the record by the withdrawal amount.
  • 27. Aruna Devi C (DSCASC) EXAMPLES
  • 28. Aruna Devi C (DSCASC) Aruna Devi.C (DSCASC) 31 branch (branch_name, branch_city, assets) customer (customer_name, customer_street, customer_city) loan (loan_number, branch_name, amount) borrower (customer_name, loan_number) account (account_number, branch_name, balance) depositor (customer_name, account_number) Database Schema for Bank
  • 29. Aruna Devi C (DSCASC) Aruna Devi.C (DSCASC) 32 Schema Diagram for a Banking Enterprise
  • 30. Aruna Devi C (DSCASC) Banking Enterprise
  • 31. Aruna Devi C (DSCASC)