DBMS 9
DBMS 9
Dr.Sharmistha Roy
Relational Database
CODD’s Rules
• Relational data model is the primary data model for Relational Model
Relational Database
commercial data- processing applications
Relational Data
• A relational database consists of a collection of tables, Integrity
Database Languages
each of which is assigned a unique name
CODD’s Rules
• A row in a table represents a relationship among a set of
values. Thus, a table is an entity set and a row is an entity
• The columns or properties are called attributes
• For each attribute, there is a set of permitted values, called
the domain of that attribute. Same domain can be shared
by more than one attribute
• Degree is the number of attributes in the relation/ table,
where as Cardinality is the number of tuples or rows in the
relation/table
• The attribute values are required to be atomic, i.e.
indivisible
9.2
Relational Model
Relational Model...
Dr.Sharmistha Roy
Relational Model
• Let D1 , D2 , and D3 are the domains. Any row of the table
Relational Database
consists of a 3-tuple (v1 , v2 , v3 ) where v1 ∈ D1 , v2 ∈ D2
Relational Data
and v3 ∈ D3 . Thus, the table will contain only a subset of Integrity
the set of all possible rows. Therefore, the table is a subset Database Languages
of D1 x D2 x D3 CODD’s Rules
9.3
Relational Model
Relational Database
Dr.Sharmistha Roy
Relational Model
Relational Database
Relational Data
Integrity
Database Languages
Relational Database
CODD’s Rules
Relational database is a database consisting of multiple
relations or tables. The information about an enterprise is
broken up into parts, with each relation storing one part of the
information
9.4
Relational Model
Relational Data Integrity
Dr.Sharmistha Roy
Relational Database
uniquely identify a row or tuple in a table. Let R be the relation
Relational Data
with attributes a1 , a2 ... an . The set of attributes of R is said to Integrity
be a candidate key of R iff the following two properties holds: Database Languages
CODD’s Rules
• Uniqueness: At any given time, no two distinct tuples or
rows of R have the same value for ai , the same value for aj
...an
• Minimality: No proper subset of the set (ai , aj ... an ) has
the uniqueness property
2. Entity Integrity
Relational Model
• The entity integrity rule is designed to assure that every Relational Database
Relational Data
relation has a primary key, and that the data values for that Integrity
CODD’s Rules
• Usually, the primary key of each relation is the first column
• Entity integrity guarantees that every primary key attribute
is NOT NULL
• Primary key performs the unique identification function in a
relational model
3. Referential Integrity
9.6
Relational Model
Relational Data Integrity...
Dr.Sharmistha Roy
Relational Model
3. Referential Integrity...
Relational Database
Relational Data
• The rule states that if there is a foreign key in one relation, Integrity
either each foreign key value must match a primary key Database Languages
value in the other table or else the foreign key value must CODD’s Rules
be NULL
• A foreign key that references its own relation is known as
recursive foreign key
• The linking between the foreign key and primary key
allows a set of relations to form an integrated database
4. Operational Constraints
9.7
Relational Model
Database Languages
Dr.Sharmistha Roy
DDL (Data Definition Language)
Relational Model
• DDL is used to define the conceptual schema. The
Relational Database
definition includes the information of all the entity sets and Relational Data
their associated attributes as well as the relationships Integrity
Database Languages
between the entity sets
CODD’s Rules
• The data values stored in the database must specify
certain consistency constraints. The database systems
check these constraints every time the database is
updated
• The output of the DDL is placed in the Data Dictionary
which contains the metadata (data about data)
• The data dictionary is considered to be a special type of
table, which can only be accessed and updated by the
database system itself
• The database system consults the data dictionary, before
querying or modifying the actual data, for the validation
purpose
• CREATE, ALTER, DROP, RENAME & TRUNCATE
9.8
Relational Model
Database Languages...
Dr.Sharmistha Roy
Database Languages
Rule0 CODD’s Rules
NULL values are supported in fully relational DBMS for Relational Database
Relational Data
representing missing information and inapplicable information Integrity
in a systematic way independent of data type Database Languages
CODD’s Rules
9.11
Relational Model
CODD’s Rules...
Dr.Sharmistha Roy
Rule6: Views updation
All views that are theoretically updatable are also updatable by Relational Model
the system. Similarly, the views which are theoretically Relational Database
Relational Data
non-updatable are also non-updatable by the database system Integrity
Database Languages
may spread across more than one system and across several Relational Database
Relational Data
networks. However to the end-user, the tables should appear Integrity
CODD’s Rules