Review of Attributes of the Relational Data Model.
- The relational model is credited to E. F. Codd (1970) who was working at IBM
- Basic Definitions:
- Data Structure: Data are organized into tables (often called relations, not to be confused withrelationships) with rows and columns.
- Data Manipulation: The structured query language (SQL) is used to manipulate data in the tables.
- Data Integrity: The DBMS has facilities to enforce business rules to maintain data integrity, e.g., not to delete a CUSTOMER row when there is a corresponding outstanding row in the CUSTOMER_ORDERStable.
- Relational Data Structure:
- A table is a two-dimensional representation of data.
- Each column is named and represents a field..
- A table can have any number of rows (within physical storage limitations).
- Each row is a record.
- We could delete all of the rows and the table would still exist.
- The shorthand notation to express the structure of a table is:
TABLE_NAME( PrimaryKeyField1, Field2, Field3, ... )
example:
EMPLOYEE( EmpID, EmpName, Department, DateHired )
EMPLOYEE( EmpID, EmpName, Department, DateHired )
Note that the "..." simply means there could be additional fields.
- Relational Keys:
- Primary Key: column (or combination of columns) that uniquely identifies a row. We underline the primary key.
- Composite Key: a primary key that includes more than one column.
- Foreign Key: a field that links one table to another table. A table can have an unlimited number of foreign keys linking to other tables. We use a dashed underline for foreign keys.
- Properties of Tables (Relations):
- Each table in a database has a unique name.
- Each entry in a table at the intersection of a row/column can only store a single value (principle ofatomicity). No multivalued fields are allowed in a table.
- Each row is unique.
- Each column has a unique field name.
- The sequence of rows as well as columns is insignificant and can be interchanged without changing the data.