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)

More Related Content

What's hot

Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)
Bilal Arshad
 
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
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
Megha Sharma
 
Database language
Database languageDatabase language
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
Temesgenthanks
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
Nikhil Deswal
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
Dashani Rajapaksha
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
Mary Brinda
 
ER modeling
ER modelingER modeling
ER modeling
Dabbal Singh Mahara
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
Free Open Source Software Technology Lab
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
Kabindra Koirala
 
Dbms4
Dbms4Dbms4
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship modelJafar Nesargi
 
Normal forms
Normal formsNormal forms
Normal forms
Samuel Igbanogu
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query Optimization
Niraj Gandha
 

What's hot (20)

Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
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)
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
 
Database language
Database languageDatabase language
Database language
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
ER modeling
ER modelingER modeling
ER modeling
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
Dbms4
Dbms4Dbms4
Dbms4
 
Relational model
Relational modelRelational model
Relational model
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Normal forms
Normal formsNormal forms
Normal forms
 
RDBMS
RDBMSRDBMS
RDBMS
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Query processing and Query Optimization
Query processing and Query OptimizationQuery processing and Query Optimization
Query processing and Query Optimization
 

Viewers also liked

File and data base management
File and data base managementFile and data base management
File and data base management
Asad Ahmed
 
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 constraintsKumar
 
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
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentationsameerraaj
 
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
 
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 Recoveryimranasayed
 

Viewers also liked (20)

File and data base management
File and data base managementFile and data base management
File and data base management
 
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
 
Normalization case
Normalization caseNormalization case
Normalization case
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 
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
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
 
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
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
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...
 
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
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
 
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
 
Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013Dbms ii mca-ch12-security-2013
Dbms ii mca-ch12-security-2013
 
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
 
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
 
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
 
DB2 LUW - Backup and Recovery
DB2 LUW - Backup and RecoveryDB2 LUW - Backup and Recovery
DB2 LUW - Backup and Recovery
 

Similar to Dbms ii mca-ch4-relational model-2013

COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
Rc Os
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
LPhct2
 
Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
Anjaan Gajendra
 
DBMS Unit-2.pdf
DBMS Unit-2.pdfDBMS Unit-2.pdf
DBMS Unit-2.pdf
vaishnavi339314
 
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.
 
RDBMS
RDBMSRDBMS
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
Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001d
Gihan Wikramanayake
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
Tetala Vishnu Vardhan Reddy
 
dbms first unit
dbms first unitdbms first unit
dbms first unit
Raghu Bright
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
Ankit Dubey
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
Ankit Dubey
 
DBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQLDBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQL
Azizul Mamun
 

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

COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
 
Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
 
DBMS Unit-2.pdf
DBMS Unit-2.pdfDBMS Unit-2.pdf
DBMS Unit-2.pdf
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 
RDBMS
RDBMSRDBMS
RDBMS
 
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
 
RDBMS
RDBMSRDBMS
RDBMS
 
Relational Database Management System part II
Relational Database Management System part IIRelational Database Management System part II
Relational Database Management System part II
 
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
 
Rdbms
RdbmsRdbms
Rdbms
 
Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001d
 
ch3
ch3ch3
ch3
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
 
dbms first unit
dbms first unitdbms first unit
dbms first unit
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
 
DBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQLDBMS_INTRODUCTION OF SQL
DBMS_INTRODUCTION OF SQL
 

Recently uploaded

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 

Recently uploaded (20)

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 

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)