The Relational Database Model: Database Systems: Design, Implementation, and Management
The Relational Database Model: Database Systems: Design, Implementation, and Management
STUDENT table,
continued
Table Characteristics
• Perceived as a two-dimensional structure with rows and columns
• Each row (tuple) represents single entity occurrence
• Each column represents an attribute, each column has a distinct
name
• Each row/column intersection represents single value
• All values in a column have same data format
• Each column has range of values called attribute domain
Table Characteristics (con’t.)
• Order of the rows and columns is immaterial to the DBMS
• Each table must have an attribute (or combination of attributes) that
uniquely identify each row – known as the primary key
Example Table Single value
Rows
(Tuples)
Entity integrity
Ensures all entities are unique
Each entity has unique key
Referential integrity
Foreign key must have null value or match primary key values
Makes it impossible to delete row whose primary key has
mandatory matching foreign key values in another table
Relational Database Operators
The degree of relational completeness can be
defined by the extent to which relational algebra is
supported.
UNION
yields
Relational Database Operators
INTERSECT produces a listing that contains only
the rows that appear in both tables. The two
tables must be union compatible.
yields
INTERSECT
Relational Database Operators
DIFFERENCE yields all rows in one table that are
not found in the other table; i.e., it subtracts one
table from the other. The tables must be union
compatible.
yields
DIFFERENCE
Relational Database Operators
PRODUCT produces a list of all possible pairs of
rows from two tables.
PRODUCT
yields
Relational Database Operators
SELECT yields values for all attributes found in a
table. It yields a horizontal subset of a table.
yields
DIVIDE
The Data Dictionary and the
System Catalog
The relational model stores metadata (data about data)
within special tables in the database.
Data dictionary contains metadata to provide detailed
accounting of all end-user tables within the database.
System catalog is a very detailed system data dictionary
that describes all objects within the database.
System catalog is a system-created database whose tables
store the database characteristics and contents.
System catalog tables can be queried just like any other tables.
System catalog automatically produces database
documentation.
Relationships within the
Relational Database
E-R Diagram (ERD)
Rectangles are used to represent entities.
Entity names are nouns and capitalized.
Diamonds are used to represent the relationship(s)
between the entities.
The number 1 is used to represent the “1” side of the
relationship.
The letter M is used to represent the “many” sides of the
relationship.
Table name: PROFESSOR
Primary key: EMP_NUM Database name: Ch03_TinyCollege
Foreign key: DEPT_CODE