Presentation is loading. Please wait.

Presentation is loading. Please wait.

CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this.

Similar presentations


Presentation on theme: "CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this."— Presentation transcript:

1 CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/. This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from http://everaldo.com/crystal/. Yuri Takhteyev University of Toronto September 29, 2010

2 Assignment 1 Updated on Sept. 24 - please get the newest version from the website

3 Schedule Inserting and modifying data Creating tables Week 6

4 Schedule Intro SQL Design Interfacin g Etc.

5 course session building course_instance student enrollment room Why so many? Why those seven?

6 Database Design requirements analysis implementation deployment design

7 clientyoudatabaseusers the problem functional specification clarification a design a schema use feedback a new problem

8 Functional Specifications What is the system going to do? (Not how, but what.)

9 Course Enrollment What do we want from a course enrollment system?

10 “Use Cases” A student wants to enroll in a course for the next semester. The student goes to the website for the enrollment system and logs in. The student is presented with a list of courses there he or she is enrolled in. There is a button next to each course to un-enroll from it. There is also a search box that the student can use use to look for courses that they are not enrolled in. The student can find the course by the course code or course title...

11 ER Model E is for “Entities” R is for “Relationships”

12 “Use Cases” A student wants to enroll in a course for the next semester. The student goes to the website for the enrollment system and logs in. The student is presented with a list of courses there he or she is enrolled in. There is a button next to each course to un-enroll from it. There is also a search box that the student can use use to look for courses that they are not enrolled in. The student can find the course by the course code or course title...

13 Entities The “things” we need to keep track of in our database: students courses instructors rooms time slots

14 student last name first name utorid date of birth attributes programcoursepayment other entities

15 student last name first name utorid date of birth programcoursepayment other entities a date up to 8 letters or numbers what alphabet? phone number Local? Domestic? “domains”

16 student last name first name utorid date of birth “Chen’s notation”

17 student ---------------------------------------------------------------------------------- last name first name utorid date of birth “UML notation” (simplified)

18 program ----------------------------------------------------------------------------------... course ----------------------------------------------------------------------------------... payment ----------------------------------------------------------------------------------... student ---------------------------------------------------------------------------------- last name first name utorid date of birth

19 program ---------------------------------------------------------------------------------- name code course ---------------------------------------------------------------------------------- code title payment ---------------------------------------------------------------------------------- amount date session ---------------------------------------------------------------------------------- code start date student is in a program student made a payment student enrolls in a course course is offered in a session student ---------------------------------------------------------------------------------- last name first name utorid date of birth course belongs to a program

20 Cardinality student ---------------------------------------------------------------------------------- last name first name utorid date of birth payment ---------------------------------------------------------------------------------- amount date payment ---------------------------------------------------------------------------------- amount date payment ---------------------------------------------------------------------------------- amount date payment ---------------------------------------------------------------------------------- amount date payment ---------------------------------------------------------------------------------- amount date one student, many payments “one-to-many” relationship

21 student ---------------------------------------------------------------------------------- last name first name utorid date of birth payment ---------------------------------------------------------------------------------- amount date “Crow’s Foot Notation”

22 not more than 1many “Crow’s Foot Notation”

23

24 at least 1 (mandatory) could be 0 (optional) “Crow’s Foot Notation” 1..10..N

25 just one zero or many “UML Notation” 1..1 or just “1” 0..N or “0..*” 1..10..N

26 at least 1 (mandatory) “Weak Entity” a weak entity studentpayment

27 More Examples motherchild buildingroom courseassignment ???

28 Variations motherchild manageremployee ???

29 Questions on 1:M?

30 WeWe ❤ 1:M Because they are really easy to represent in a relational database.

31 Many-to-Many student ---------------------------------------------------------------------------------- last name first name utorid date of birth course ---------------------------------------------------------------------------------- code title

32 Examples bookauthor personaddress courseinstructor ???

33 We ! ❤ M:M Because they cannot be represented in a relational database.

34 Breaking Up M:M student ---------------------------------------------------------------------------------- last name first name utorid date of birth course ---------------------------------------------------------------------------------- code title

35 “Associative Entity” student ---------------------------------------------------------------------------------- last name first name utorid date of birth course ---------------------------------------------------------------------------------- code title enroll ment

36 Examples book author author ship ??? person address reside nce

37 Questions on M:M?

38 One-to-One ???

39 One-to-One ???

40 One-to-One enginecar the engine is installed in the car engines in stock cars shipped

41 Examples citymayor captainship chef signature dish ???

42 Recursive Relationships person likes

43 Recursive Relationships person likes

44 Examples employee tax return coin image ??? is filed jointly with supervises is the flip side of ???

45 N-nary Relationships seller sold (what?) to the buyer sellerbuyer house seller sold house (to whom?) buyer bought house (from whom?)

46 N-nary Relationships seller buys a house from buyer sellerbuyer house

47 N-nary Relationships seller house buyer sale

48 Putting It Together ● OpenOffice Draw – Free / open source – Available in the lab – You can get “Crow’s Foot” templates at http://www.thinktek.ca/articles/article2.php – Alternatively, do UML notation (“n..m”) by hand ● Microsoft Visio ● Your favorite software Options for software:

49 Questions?


Download ppt "CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this."

Similar presentations


Ads by Google