Download presentation
Presentation is loading. Please wait.
1
Database – Part 2a Dr. V.T. Raja Oregon State University
2
Database – Part 2a: Relational Database Model From ERD to Relational Database Foreign Key Data Dictionary Normalization
3
From ERD to relational Database For each entity, create a 2-dimensional table. Each attribute of an entity is a column in the associated table. Instance of an entity is a row in the associated table. Only one value at intersection of a column and row. No duplicate column names. No duplicate rows. Primary key cannot be null.
4
From ERD to Relational Database Each table is referred to as a ‘relation’ in the relational model. A ‘relation’ in the relational model is not the same as ‘relationship’ between entities in ERD. A ‘CUSTOMER’ relation is expressed in the following notation. CUSTOMER (CID, FName, LName, E-mail) Table name is capitalized when expressing a relation. Primary key is underlined. Primary key attribute(s) first listed within the parenthetical statement containing column names.
5
Foreign key in a ‘relation’ A foreign key is a primary key of one table that appears as an attribute in another table and acts to provide a logical relationship between the two tables. Example: ORDER (Order Number, CID, Order Date) CID (Customer ID) is a foreign key in ‘ORDER’ table.
6
Data Dictionary Explains details about an attribute, such as the name of the field, whether or not it is a primary key or part of a primary key, the data type, and valid values for each field. The data dictionary could also explain (business rules) why the data item is needed, how often it should be updated, who has the authority to update it, and on which forms and reports the data appears.
7
Normalization Process of minimizing data redundancy Avoid problems associated with poor database design A good ERD is the basic foundation for a ‘normalized’ relational model Example:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.