Relational Theory and Design Unit 2
Key Concepts Relational model concepts Entity Relationship Diagram (ERD) symbols Primary keys Foreign keys Integrity rules ERD design process Cardinality Data types
Terms Database (catalog) Row (record, tuple) Column (field, attribute) Cell (field, data item) Primary key
Entity Concepts Entity – type of item modeled in the database Attribute – Values describing the entity Relationship – Link between two tables
One-to-One Relates one row in the parent to zero or one (or exactly one) in the child. Each student has one locker. Each locker is assigned to one student.
One-to-Many Relates one row in the parent to zero or more rows (or one or more rows) in the child. Each teacher teaches multiple classes. Each class has one teacher.
Many-to-Many Multiple relationships exist between parent and child. As associative table is used to track the relationships Each student has multiple teachers. Each teacher has multiple students.
Primary key Unique Minimal Not null Nonupdateable Include Database Design and Development, Exhibit 2-6, page 19
Relationships Database Design and Development, Exhibit 2-9, page 20
Data Integrity Entity integrity – identifies each row as unique Referential integrity – Requires matched foreign key values.
First Normal Form Database Design and Development, Exhibit 2-13, page 22
Database Systems Hierarchical Network Relational Object-oriented
Represent Entities as Tables Entities are the items stored in the database Most represent physical items such as persons and places Start by identifying all possible entities
Determine Relationships Database Systems, Figure 13.12, pg. 405
List Fields Fields, or attributes, describe entities. Most entities will have several attributes.
Identify Keys Each table must have a primary key. Primary key uniquely identfies row. Must be unique, minimal, not null, and nonupdateable. Related child table must have a foreign key
Determine Data Types Determine data type and size for each attribute Primary and foreign keys must match in data type and size
Table Database Design and Development, Exhibit 3-1.1, page 32
Relationship (none) Database Design and Development, Exhibit 3-1.2
Fields Database Design and Development, Exhibit 3-1.3
Keys Database Design and Development, Exhibit 3-1.4
Data Types Database Design and Development, Exhibit 3-1.5
Sample Data Database Design and Development, Exhibit 3-3, page 33
Tables Database Design and Development, Exhibit 3-4.1
Relationships Database Design and Development, Exhibit 3-4.2
Fields Database Design and Development, Exhibit 3-4.3
Keys Database Design and Development, Exhibit 3-4.4
Data Types Database Design and Development, Exhibit 3-4.5
Sample Data Database Design and Development, Exhibit 3-6, Page 35
Tables Database Design and Development, Exhibit 3-7.1, page 36
Relationships Database Design and Development, Exhibit 3-7.2
Fields Database Design and Development, Exhibit 3-7.3, page 37
Keys Database Design and Development, Exhibit 3-7.4
Data Types Database Design and Development, Exhibit 3-7.5
Acme Beer Database Design and Development, Exhibit 3-13, page 48
Acme Beer Tables Database Design and Development, Exhibit 3-14.1, page 49
Acme Beer Relationships Database Design and Development, Exhibit 3-14.2
Acme Beer Fields Database Design and Development, Exhibit 3-14.3
Acme Beer Keys Database Design and Development, Exhibit 3-14.4
Acme Beer Data Types Database Design and Development, Exhibit 3-14.5, page 50
Amazon Product Screens Database Design and Development, Exhibit 3-17, page 54
Amazon Order Screen Database Design and Development, Exhibit 3-18, page 54
Amazon ERD Database Design and Development, Exhibit 3-19.5 (only), page 56
Amazon Data Database Design and Development, Exhibit 3-22