Presentation is loading. Please wait.

Presentation is loading. Please wait.

U:/msu/course/cse/103 Day 17, Slide 1 CSE 103 Housekeeping: –Take a makeup BT this week if not passed the 2.0 yet –Next.

Similar presentations


Presentation on theme: "U:/msu/course/cse/103 Day 17, Slide 1 CSE 103 Housekeeping: –Take a makeup BT this week if not passed the 2.0 yet –Next."— Presentation transcript:

1 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 1 CSE 103 Housekeeping: –Take a makeup BT this week if not passed the 2.0 yet –Next in-class one week from today –Today: Advanced Design. Review Days 2 and 10 in the book. –Remember: Office Hours MW 3-5, TR 2-4* in 1107 EB; Help Room MT 9-11pm in 120 CC * or by appointment (email cse103@cse.msu.edu)

2 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 2 Multiple Table Database Review What are entities? What are records ? What are attributes? How can you represent a 1:N (one-to- many) relationship? How can you represent an M:N (many-to- many) relationship?

3 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 3 MegaCorp Database Design a new database for inventory usage MegaCorp manufactures office furniture: –Bookcases, File Cabinets, Desks, Chairs Desks and Chairs come in three styles: –Contemporary, Traditional, Classic All furniture items have: –Color: beige, oak, walnut, mahogany, black –Size: depth, width, height (in inches, to hundredths) –Description, Item Number It is necessary also to keep a record of the number of each item in stock

4 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 4 Database Design Level 1 What questions do I want the database to answer? What data do I need to answer these questions? How are these data related to one another?

5 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 5 Database Design Level 2 What entities are involved? What attributes belong to each entity? How many of each attribute does each entity have? –Exactly one? –Exactly zero or one? –Anywhere from zero to two or more? Do any two or more entities have the same value for any attribute? What datatype should be used for each of the different attributes? What relationships exist between these entities? What type is each of these relationships?

6 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 6 Database Design Sequence Use a “Relational Database Diagram” with boxes and connecting lines to initially identify entities, attributes and relationships. Next convert boxes to tables and attributes to columns. Define primary keys. Implement each one-to-many relationship via the use of a foreign key in the “many” entity. Implement each many-to-many relationship via an extra “relationship table” which uses the pair of foreign keys as its primary key.

7 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 7 General Design Guidelines Database designing should be an iterative process. As difficulties appear at one stage, you may need to go back and refine or modify earlier stages. Try to reduce redundancies and dependencies (normalization). Finish the design before entering data!

8 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 8 Begin design Work with your groups. See slide 2 for specs. –Create a Relational Database Diagram (slide 5) and write out your tables on paper –Think about questions on slides 3-4 as you work –Elect group spokesperson to share design with rest of class; we’ll compare notes and come to agreement 10 minutes to work without our help 15 more minutes after that No need to put anything in Access yet (but you can if you finish the rest, just be prepared to change if needed)

9 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 9 MegaCorp Packages MegaCorp wants to sell suites/groupings of furniture items. Each suite consists of a variety of items in different quantities and has a suite name and a total price. An item may belong to any number of suites at the same time. Modify your design to handle “suites”. –Again use questions on slides 3-4 to guide you –Work on paper first, only go to Access if your group has reached agreement (again, be prepared to change) –10 minutes without help, then 10 more

10 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 10 Create your MegaCorp DB If you haven’t already, create a database called MegaCorp in your personal AFS space –If you already started one, you can rename it if you close Access Create tables as per discussion, with fields as shown –Use tbl_ prefix for table names –Select appropriate data types for every field –Set primary keys for every table –Field descriptions are optional

11 http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103 Day 17, Slide 11 Homework Check the link on today’s classwork page for the homework for next class day. Highlights (check web page for full details) –Finish/check Megacorp DB design –Import data into Megacorp –Queries in Megacorp to test your import and understanding –HAVE THE IMPORT DONE BEFORE NEXT CLASS! E-MAIL with questions/problems.


Download ppt "U:/msu/course/cse/103 Day 17, Slide 1 CSE 103 Housekeeping: –Take a makeup BT this week if not passed the 2.0 yet –Next."

Similar presentations


Ads by Google