Lecture 03
Lecture 03
Management
System
Lecture - 03
Database Model
• Database model defines the logical design of data.
• Database model describes the relation between different
parts of data.
• There are three database models:
1. Hierarchical Model
2. Network Model
3. Relational Model
Hierarchical Model
• Simplicity
Customer
Relation
RM Concept in DBMS
Attribute: Each column in a Table. Attributes are the
properties which define a relation. e.g.,
Student_Rollno, NAME,etc
Tables – In the Relational model the, relations are
saved in the table format. It is stored along with its
entities. A table has two properties rows and columns.
Rows represent records and columns represent
attributes.
Tuple – It is nothing but a single row of a table, which
contains a single record.
RM Concept in DBMS
Relation Schema: A relation schema represents the
name of the relation with its attributes.
Degree: The total number of attributes which in the
relation is called the degree of the relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a
specific attribute.
Relation instance – Relation instance is a finite set of
tuples in the RDBMS system. Relation instances never
have duplicate tuples.
RM Concept in DBMS
Relation key – Every row has one, two or multiple
attributes, which is called relation key.
Attribute domain – Every attribute has some pre-
defined value and scope which is known as attribute
domain
Relational database schema – A set of relation
schemas ,each with a distinct name.
Example: If R1,R2,R3…..Rn are set of relations, then we
can write RDBMS as
R={ R1,R2,R3…..Rn}
Relational Integrity
Constraints
• Relational Integrity constraints in DBMS are referred to
conditions which must be present for a valid relation.
These Relational constraints in DBMS are derived from
the rules in the mini-world that the database represents.
• There are many types of Integrity Constraints in DBMS.
Constraints on the Relational database management
system is mostly divided into three main categories are:
1.Domain Constraints
2.Key Constraints
3.Referential Integrity Constraints
Create DOMAIN CustomerName CHECK (value not NULL)
Domain Constraints
• Domain constraints can be violated if an attribute
value is not appearing in the corresponding domain or
it is not of the appropriate data type.
• Domain constraints specify that within each tuple,
and the value of each attribute must be unique. This
is specified as data types which include standard data
types integers, real numbers, characters, Booleans,
variable length strings, etc.
Example:
create DOMAIN CustomerName
check( value not null)
Create DOMAIN CustomerName CHECK (value not NULL)
Key Constraints
• An attribute that can uniquely identify a tuple in a
relation is called the key of the table. The value of the
attribute for different tuples in the relation has to be
unique.
Example: In the given table, CustomerID is a key attribute of Customer Table.
It is most likely to have a single key for one customer, CustomerID =1 is only for the
CustomerName =” Google”.
Create DOMAIN CustomerName CHECK (value not NULL)
Referential Integrity
Constraints
• Referential Integrity constraints in DBMS are based on the concept of Foreign Keys.
A foreign key is an important attribute of a relation which should be referred to in
other relationships. Referential integrity constraint state happens where relation
refers to a key attribute of a different or same relation. However, that key element
must exist in the table.
• Example :