0% found this document useful (0 votes)
272 views

Relational Model Concepts

The document discusses key concepts in the relational database model including attributes, tables, tuples, relations, domains, keys, and integrity constraints. It defines these terms and provides examples of how they are implemented and used for common relational operations like insert, update, delete, and select. Relational integrity constraints include domain constraints to define valid attribute values, key constraints to enforce attribute uniqueness, and referential integrity constraints to define relationships between tables.

Uploaded by

Abhinandan Bhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
272 views

Relational Model Concepts

The document discusses key concepts in the relational database model including attributes, tables, tuples, relations, domains, keys, and integrity constraints. It defines these terms and provides examples of how they are implemented and used for common relational operations like insert, update, delete, and select. Relational integrity constraints include domain constraints to define valid attribute values, key constraints to enforce attribute uniqueness, and referential integrity constraints to define relationships between tables.

Uploaded by

Abhinandan Bhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Module - 2

Relational Model Concepts


1. Attribute: Each column in a Table. Attributes are the properties which
define a relation. e.g., Student_Rollno, NAME,etc.
2. 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.
3. Tuple – It is nothing but a single row of a table, which contains a single
record.
4. Relation Schema: A relation schema represents the name of the
relation with its attributes.
5. Degree: The total number of attributes which in the relation is called the
degree of the relation.
6. Cardinality: Total number of rows present in the Table.
7. Column: The column represents the set of values for a specific
attribute.
8. Relation instance – Relation instance is a finite set of tuples in the
RDBMS system. Relation instances never have duplicate tuples.
9. Relation key - Every row has one, two or multiple attributes, which is
called relation key.
10. Attribute domain – Every attribute has some pre-defined value
and scope which is known as attribute domain
Relational Integrity constraints
Relational Integrity constraints is referred to conditions which must be present
for a valid relation. These integrity constraints are derived from the rules in the
mini-world that the database represents.

There are many types of integrity constraints. 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

Domain Constraints:
1) These are attribute level constraints. An attribute can only take values
which lie inside the domain range. e.g,; If a constrains AGE>0 is applied
on STUDENT relation, inserting negative value of AGE will result in
failure.

2) 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)

The example shown demonstrates creating a domain constraint such that


CustomerName is 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".

CustomerID CustomerName Status

1 Google Active

2 Amazon Active

3 Apple Inactive

Referential integrity constraints


Referential integrity constraints is base 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:

In the above example, we have 2 relations, Customer and Billing.

Tuple for CustomerID =1 is referenced twice in the relation Billing. So we


know CustomerName=Google has billing amount $300
Operations in Relational Model
Four basic update operations performed on relational database model are

Insert, update, delete and select.

 Insert is used to insert data into the relation


 Delete is used to delete tuples from the table.
 Modify allows you to change the values of some attributes in existing
tuples.
 Select allows you to choose a specific range of data.

Whenever one of these operations are applied, integrity constraints specified


on the relational database schema must never be violated.

Inset Operation
The insert operation gives values of the attribute for a new tuple which should
be inserted into a relation.

Update Operation
You can see that in the below-given relation table CustomerName= 'Apple' is
updated from Inactive to Active.

Delete Operation
To specify deletion, a condition on the attributes of the relation selects the
tuple to be deleted.
In the above-given example, CustomerName= "Apple" is deleted from the
table.

The Delete operation could violate referential integrity if the tuple which is
deleted is referenced by foreign keys from other tuples in the same database.

Select Operation

In the above-given example, CustomerName="Amazon" is selected

You might also like