What is Relational Databae Management System(RDBMS) ?

 A relational database is a collections of relations among two-dimensional tables. In this model, you create several tables to store pieces of information. There are operators/a set of operators that to produce the relations.
In RDBMS,  Each row of data in a table is uniquely identified by a primary key and logically relate data from multiple tables using foreign key.

Table: Employee
Employee_ID First_Name Last_Name Department_ID
101 Kobe Bryant 55
102 Rhojan Rondo 50
103 Ray Allan 45

Table Name: Departments
Department_ID_ID Dept Name Manager_ID
10 LAL 4
11 CEL 34
11 CEL 4

 Data about different entities is stored in different tables.You may need to combined information from two tables to get a particular information. In RDBMS,  information is related by foreign keys that refers to the primary key in the same table or another table.
Above, table 'Employees' contains information about employees and table 'Departments' contains information about departments. Department_ID which is Foreign Key in Employees  table is Primary Key in Departments.

There are some rules/guidelines for assigning Primary Key and Foreign Key.
You cannot use duplicate value in primary key
Primary key generally cannot be changed
Foreign key is based on data value and is a logical pointer.
A foreign key must reference either a primary key or a unique value column.
A foreign key value must match an existing primary key value or unique key value, otherwise it must be null.
RDBMS are composed of objects or relations and are governed by constraints.

No comments: