Relational Model and ER Model: in a Nutshell P. Pete Chong 11/14/2018
Relational Model A Model based on “relations” A “relation” is a two-dimensional table Each row is called a “tuple” Each column is call an “attribute” 11/14/2018
Entity-Relationship Model Entity is a “thing” – a collection (table) of attributes that are organized by relevance and usage. Relationship is how data are used together Three cardinalities: 1:1, 1:m, m:n 11/14/2018
Create “Well-Structured” Tables Using ER Model Identify Entities and their Relationships and draw 1ERD Convert 1ERD to 2ERD 1:1 – merge the tables 1:m – the primary key of 1 side becomes the foreign key on the m side m:n – create a third table that uses primary keys on both sides as composite key 11/14/2018
Create “Well-Structured” Tables Using Normalization 1NF: no repeating groups 2NF: non-key attributes are functionally dependent on the primary key 3NF: no transitive dependency DK/NF: every constraint on the relation is a logical consequence of the definition of keys and domain 11/14/2018
Result All tables are in 3NF – which eliminates most of the anomalies already Each table contains one theme 11/14/2018