Wednesday, February 5, 2014

2.Relational Database Management System (RDBMS)


Relational Database Management System (RDBMS)

-       DBMS based on relational model is called RDBMS.
-       Data is represented in the form of table.
-       A table contains rows and columns.
-       Each row represents an entity and each column represents attributes.
-       Relational Model is very simple
-       Relationships between database tables are created when one table has a column with the same meaning as a column in another table.
Let's take the example of a very simple database with just 2 tables (relations):
  • employees
  • departments
the employees table has just four columns  :
  • emp_id
  • emp_ name
  • dept_id
  • salary
the department table has just three columns :
  • dept_id
  • dept_name
  • dept_head
There is a relationship between these two tables via the dept_id column in each table. The dept_id column in the employees table  relates to the dept_id  column in the departments table. This enables to assign employees to a department and determine which employees work for which department.
Relational databases obtain their flexibility from being based on relational calculus (similar to set theory) which enables sets or relations to be combined in various ways, including:
  • join/intersection
  • union (i.e. the sum of 2 sets);
  • exclusive "OR" (i.e. the difference between 2 sets)
  • and outer-join which is a combination of intersecting and exclusive or ing.

The intersection (or join) between 2 sets (in this case, tables) produces only those elements that exist in both sets.Therefore, if we join Employees and Departments on department id, we will be left with only those employees who work for a department that is in the dept table and only those departments which have employees who are in the employees table.
The union produces the sum of the tables - meaning all records in employees and all records in Departments. including any duplicates.(although duplicates can be discarded if required).

No comments:

Post a Comment