Table of Contents
Relational database Management System
Relational database management system is a widely used database model. In this relational database management system rdbms tutorial we will learn about relational database management system introduction, different attributes of relational model, relational model constraints and relational database management system examples.
Questions and Answers
By the end of this rdbms tutorial computer science graduate will able to get the answer of the following questions. We hope that you will have learned the following
- What is rdbms ?
- What are different attributes of relational data model ?
- What are different constraints in rdbms?
- What is key constraint?
- What is domain?
- What is tuple?
- What do you understand by referential integrity constraint in rdbms?
- What is cardinality?
- Relational database management system examples.
Relational Database Management System Notes
Relational database management system is proposed by E.F.Codd in 1969 to model data in DBMS in the form of relation or tables and this model is known as relational database model.
Relational database model introduction
The relational database model in relational database management system or rdbms based data model. Relational database model represents the database as a collection of inter-related tables of data and relations.
A relation is the values of table. Each table is a group of rows and columns, where rows represents records and column represents attribute of an entity.
Relational Database Model Basic Concepts
Some basic terms related to relational data model are as follow:
- Attribute: Attributes are the properties that define a relation.
- Domain: All attributes have some pre-defined scope and value which is called attribute domain.
- Relation Instance: Finite set of tuples in the Relational DBMS is called relation instance. Relation instances have no duplicate tuples.
- Tuple: Each row of a table, which contains a single record for that table or relation is called a tuple.
- Cardinality: The number of rows or tuples in a table is known as cardinality.
- Degree of relation:The number of attributes in the table or relation is called degree of the relation.
Relational Database Model Examples
In this section of this rdbms tutorial we explained an relational database model example.
Consider a student table as shown below. This student table is an example of relational database model.
Roll_No | Name | City | Mobile_No | Age |
1 | ABC | Mumbai | 1234567890 | 19 |
2 | DEF | Delhi | 1122345678 | 18 |
3 | PQR | Kolkata | 9087654321 | 20 |
4 | XYZ | Pune | 6543217890 | 21 |
In this student relation
Roll_No, Name, City, Mobile_No, Age are the Attributes
Single Tuple in STUDENT Table is
1 | ABC | Mumbai | 1234567890 | 19 |
Cardinality is 4 for Relation STUDENT
Degree of relation is 5.
RDBMS Constraints
In relational database management system in relational database model each table or relation has some conditions which must hold for data present in database. These conditions and rules are called Constraints.
Before performing any operation (insertion, deletion and updation) in database, these constraints are checked. Operation become fail if there is a violation in any of constrains. There are three main constraints which are as follows:
- Domain Constraints
- Key Constraints
- Referential integrity constraints
Domain Constraints
Domain Constraints in relational model are attribute level constraints. An attribute can only take values whose value is inside the domain range. e.g, If AGE>10 constraint is applied on STUDENT relation, then inserting value less than 10 of AGE will result in failure.
Key Constraints
In the database, each relation should have at least one minimal subset of attributes which can identify a tuple uniquely. This subset of attributes is called key for the relation. e.g. if attribute Roll_No in STUDENT relation is a key, then no two students can have same roll number. The key has two properties:
It must be unique for all tuples i. e. no two tuples have same value.
The key attribute cannot have NULL value.
Referential Integrity Constraints
Referential integrity constraints is a constraint which is based on the concept of Foreign Keys. A foreign key is an attribute of a relation that should be referred in another table.
According to Referential integrity constraint,if a relation refers to a key attribute of a distinct or same relation, then that key element must exist.
Consider following example:
Table Person:
PersonID | LastName | FirstName | Age |
1 | AAA | XXX | 25 |
2 | BBB | YYY | 20 |
3 | CCC | ZZZ | 29 |
Table Order:
OrderID | OrderNumber | PersonID |
1 | 12345 | 1 |
2 | 56789 | 1 |
3 | 34567 | 3 |
4 | 67890 | 2 |
In this example, the “PersonID” attribute in the “Order” table points to the “PersonID” attribute in the “Person” table.
The “PersonID” attribute in the “Person” relation is the PRIMARY KEY in the “Person” table.
The “PersonID” attribute in the “Order” table is a FOREIGN KEY in the “Order” table.
The FOREIGN KEY constraint is used to prevent action of destroying links between relations.
The FOREIGN KEY constraint additionally prevents invalid data from being inserted into the foreign key column, as a result , it has to be one amongst the values contained in the table it points to.
Conclusion
Relational database model in Relational database management system is an important model and mostly used now a days in industry and academics. Introduction to relational database model ad relational model concepts are explained in this tutorial. Relational database model example and relational model constraints are also discusses with example.
I also studied the article what is RDBMS to write this tutorial
Please provide your feedback or leave comment so that we can improve and provide you a good quality tutorials
If you find this rdbms tutorial useful then please Like and Share the post on Facebook, Twitter, Linkedin through their icons as given below.
Previous Tutorial – Relational Algebra in DBMS
Next Tutorial – Normalization in DBMS