Relational databases
A relational database maintains a collection of database objects, including relations (tables) and the specified constraints upon them. The relation in the following table could be combined with the one in Table 5-1 to form a relational database:
Dept ID |
Name |
Director |
---|---|---|
HR |
Human Resources |
34953 |
IT |
Information Technology |
23098 |
DA |
Data Analysis |
15584 |
Table 5-2. A database table of departments
This would also include the designated primary keys ID
for the Employees
table and Dept ID
for the Departments
table.
The schema for the relational database itself is the collection of table headings, their corresponding datatypes, and their key designations. We could specify the schema for this two-table database as:
Employees(ID, Last Name, First Name, Date of Birth, Job Title, Email)
Departments(Dept ID, Name, Director)
The primary keys are indicated by underlining their names. In this example, ID
is the primary key for the Employees
table, and Dept ID
is the primary key...