Upload
erica-whitaker
View
33
Download
2
Tags:
Embed Size (px)
DESCRIPTION
IT354 Database Design. Seminar 5: May 19, 2011 Physical Database Design Entity-Relationship Diagrams. Activities for this Seminar. Preliminary Questions Examine Unit Topics—Seminar Questions Look at details for Unit 5 Assignment. Preliminary Questions. Weather check - PowerPoint PPT Presentation
Citation preview
IT354 Database Design
Seminar 5: May 19, 2011
Physical Database Design
Entity-Relationship Diagrams
Activities for this Seminar
• Preliminary Questions• Examine Unit Topics—Seminar Questions• Look at details for Unit 5 Assignment
Preliminary Questions
• Weather check
• Do you have any questions about the web reading articles?
Seminar Questions
• What data types can you assign to a column in Microsoft Access?
• How would you go about designing a survey form that you would use to obtain the information from users to design the required database?
• What information can you display in a Crow's Foot E-R diagram?
Example data types
Microsoft Access data types
• Found at the following website
• http://msdn.microsoft.com/en-us/library/bb208866%28v=office.12%29.aspx
Unit 5 Assignment
• This is the next step of your final assignment for IT354
• One part (5 points) is incorporating feedback from your instructor. Please do not wait for me to return Unit 4 assignment to start the other parts.
Unit 5 Assignment—three parts
• 1. Update the three parts of your Unit 4 project, incorporating the feedback from your instructor (5 points)
• 2. Merge all user views. Determine all attributes for each table. Represent all tables using Database Design Language (DBDL)
• Part 2 is worth (25 points)
Unit 5 Assignment
3. From your DBDL representation, create an Entity-Relationship (E-R) Diagram for your database. Use the IDEF1X notation used in the textbook. (See Fig. 6.2 and Fig. 6.8.) Create your E- R Diagram in PowerPoint; change the Page Setup to portrait before you start. When you are satisfied with your diagram, copy and paste it into your project Word document. (30 points)
(Shapes to use in ERD)
Entity Weak Associative
Questions
Have a great week!
• [email protected] (816-213-2917) or [email protected]
IT354 Database Design
Enrichment Seminar
ERD
Dr. Laura House
Relationships
How do you determine the type of relationship between two entity types?
To determine the connectivity of a relationship, you make two statements about the relationship, each starting with a singular entity, and examine the (one-word) multiplicity of each. The two statements look at the relationship from each "side."
For example, to examine the relationship between employee and order, the two statements would be:
1. _An_ order is taken by only _one_ employee. (Multiplicity = one.)
2. _An_ employee may take _many_ orders. (Multiplicity = many.)
Relationships, cont
Determining the type of relationship between two entity types, cont.
1. _An_ order is taken by only _one_ employee. (Multiplicity = one.)
2. _An_ employee may take _many_ orders. (Multiplicity = many.)
You combine the two one-word multiplicities to get the connectivity of the relationship. That makes employee to order a one-to-many relationship.
The statement with the multiplicity of "many" is used to determine which is the "one" side and which is the "many" side of the relationship. In this case, Employee is the "one" table and Orders is the "many" table. The primary key (PK) of the "one" table, Employee (e.g. EmployeeID), will be a foreign key (FK) in the "many" table, Orders.
If you carefully make one statement about the relationship from each side starting with a singular, you will get the correct connectivity with no guesswork.
Relationships, cont
Another example:
To determine the relationship between order and product, the two statements would be:
1. _An_ order may contain _many_ products. (Multiplicity = many.)
2. _A_ product may be may be contained in by _many_ orders. (Multiplicity = many.)
Product to Orders would be a many-to-many relationship.
These statements are part of the “business rules.”
Relationships, contAnother example, cont.:
In a relational database, a many-to-many relationship must have an intermediate table called an “associative entity” to link the two entity types.
Product …. 1 : M …. OrderProduct …. M : 1 …. Orders
The OrderProduct associative entity will have the PK of Orders (OrderID) and the PK of Product (ProductID) columns. Each will be a foreign key pointing to their respective “outer” table.
In addition, the two columns will be a composite PK in the OrderProduct table. This table is usually called LineItem or OrderDetail.
Associative entities are usually not depicted in an Enterprise Data Model.
18
Linking the Tables
• Customer Number is a Primary Key in CUSTOMERS– And a Foreign Key in ORDERS
Question-how do you link these three tables? (before)
• Customer• Name Address Zip• Eric 8299 Elk 78250
• Order• Make Model Year• Chevy S10 2001
• Payment• Form Card Number Balance• Credit 002220022992 2500
Question-how do you link these three tables? (after)
• Customer• CustomerID(PK) Name Address Zip• 123456 Eric 8299 Elk 78250
• Order• OrderNumber(PK Make Model Year CustomerID• 876654 Chevy S10 2001 123456
• Payment• PaymentID Form Card Number Balance OrderNum• 000009 Credit 002220022992 2500 876654
What are the entity types? What is the identifier (PK) of each?
Situation and Business Rules
Vintage Music Rocks sells music to customers. The music is on albums. The albums contain several tracks of music.
An album has a catalog number. The catalog number is unique and is determined by the album name and release date.
An album is in one item. An album may be ordered by many customers.
A customer may place multiple orders. A customer may order many albums.
Music
Are these relations in 3NF ?
Customer
ZipCode
Orders
Album
Music
Are these relations in 3NF ?
CustomerCustomerIDName<more>
ZipCodeZipCodeCity
State
OrdersOrderNoCustomerName
Album Name Album Price Order Date Total Price Qty
AlbumCatalogNoAlbumNameAlbum Description
Artist Name Release Date In Stock Value Tracks
Music
Are these relations in 3NF ?
CustomerCustomerIDName<more>
ZipCodeZipCodeCity
State
OrdersOrderNoCustomerName
Order Date
AlbumCatalogNoAlbumNameAlbum Description
Artist Name Release Date In Stock Album Price
AlbumOrdersOrderNoPK CatalogNoPK
Discount
Total Price
Qty
TrackAlbumCatalogNosongnametrack length
Track