Microsoft Store
 

Relational model


 

The relational model for management of a database is a data model based on predicate logic and set theory.

Example database

An idealized, very simple example of a description of some relvars and their attributes:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Customer(Customer ID, Tax ID, Name, Address, City, State, Zip, Phone)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Order(Order No, Customer ID, Invoice No, Date Placed, Date Promised, Terms, Status)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Order Line(Order No, Order Line No, Product Code, Qty)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Invoice(Invoice No, Customer ID, Order No, Date, Status)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Invoice Line(Invoice No, Line No, Product Code, Qty Shipped)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Product(Product Code, Product Description)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

In this design we have six relvars: Customer, Product, Order, Order Line, Invoice, and Invoice Line. The bold, underlined attributes are candidate keys. The non-bold, underlined attributes are foreign keys.

Related Topics:
Design - Relvars - Candidate key - Foreign key

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Usually one candidate key is arbitrarily chosen to be called the primary key and used in preference over the other candidate keys, which are then called alternate keys.

Related Topics:
Candidate key - Primary key - Preference - Alternate key

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

A candidate key is a unique identifier enforcing that no tuple will be duplicated; this would make the relation into something else, namely a bag, by violating the basic definition of a set. A key can be composite, that is, can be composed of several attributes. Below is a tabular depiction of a relation of our example Customer relvar; a relation can be thought of as a value that can be attributed to a relvar.

Related Topics:
Identifier - Tuple - Relation - Bag - Set - Key

~ ~ ~ ~ ~ ~ ~ ~ ~ ~