1 Database Course. 2 General Information TAs: –Gideon Rothschild, office hours: Sun 16:00- 17:00 at Ross 109 –Aron Matskin, office hours: TBA Course Homepage:

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

Chapter 6: Entity-Relationship Model (part I)
Chapter 6: ER – Entity Relationship Diagram
DB Review Session. ER Diagrams 1 Where does the salary attribute belong? Actor id name address birthday Acted In Movie title type year salary.
The Entity-Relationship (ER) Model
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Text-Book Chapters (7 and 8) Entity-Relationship Model
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
1 Translation of ER-diagram into Relational Schema Prof. Sin-Min Lee Department of Computer Science.
Lecture 2: Entity/Relationship modelling
1 Database Course. 2 General Information TAs: –Jonathan Mamou –Gideon Rothschild Course Moderated Newsgroup: local.course.db.ta.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
1 Data Modelling Which data to include in the database.
Chapter 2: Entity-Relationship Model (Continued)
Entity-Relationship Model
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
Data Modeling Using the Entity-Relationship Model
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
the Entity-Relationship Model
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Entity-Relationship Model
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Chapter 6: ER – Entity Relationship Diagram
Chapter 2: Database Design and Entity-Relationship Model  Database Design  Entity Sets  Relationship Sets  Design Issues  Mapping Constraints  Keys.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Computing & Information Sciences Kansas State University Wednesday, 24 Sep 2008CIS 560: Database System Concepts Lecture 12 of 42 Wednesday, 24 September.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
 Entity-relationship models (ERM) Entity-relationship models (ERM)  Simple E-R Diagram Simple E-R Diagram  Weak Entity Weak Entity  Strong Entity.
Entity-Relationship Model
Entity Relationship Diagram (2)
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
Weak Entity Sets A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database. Weak entity meets.
1 Database Course. 2 General Information TAs: –Sara Cohen –Jonathan Mamou Course Moderated Newsgroup: local.course.db.ta Students.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
advanced data modeling
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
1 Entity Relationship Diagram. ER proposed by Peter Chen ER diagram is widely used in database design Represent conceptual level of a database.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module 8: Entity-Relationship.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Topic 3: ER – Entity Relationship Model (ERM) 6/12/
Modeling: Entity-Relationship Diagrams
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
1 What is a Database Management System? Lecture slides by Dr. Sara Cohen Spring 2008.
Databases Winter 2011.
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Converting ER-Diagrams to Table Definitions
Module 8 – Database Design Using the E-R Model
Database Modeling using Entity Relationship Model (E-R Model)
Chapter 7: Entity-Relationship Model
Presentation transcript:

1 Database Course

2 General Information TAs: –Gideon Rothschild, office hours: Sun 16:00- 17:00 at Ross 109 –Aron Matskin, office hours: TBA Course Homepage: Course Moderated Newsgroup: local.course.db.ta Students Newsgroup: local.course.db.stud

3 TA Lectures Tue – Wed – Sun cycle Same TA during the cycle If a TA lecture falls out on a holiday, students should plan to attend another lecture during the same cycle Students are responsible for all the material for the final exam. That includes lectures, TA lectures, slides, and homework

4 Assignments (1) About assignments Assignments are 25% of the final grade All assignments must be handed in! Assignments are to be done alone (not in pairs)! Must include name, login, student number. Points will be taken off if login is omitted

5 Assignments (2) Assignment submission: –Theoretical assignments - box in Ross -2 –Programming assignments - electronically Assignments are returned in Ross –2, grades available on the internet Make sure that you have a grade when the exercise is returned!

6 Appeals and Extensions Appeals are submitted to box in Ross -2 Appeal form available on the course site Appeals should be submitted no later than 1 week after assignments are returned Extensions are possible in special cases (i.e., miluim, childbirth, etc.). Ask for the extension before the due date

7 Course Books Database Management Systems, by Raghu Ramakrishnan Principles of Database and Knowledge-Base Systems, Volumes I and II, by Jeffery Ullman (essentially chapter 7 concerning Design Theory) Oracle 8i: The Complete Reference, by Kevin Loney and George Koch

8 Entity-Relationship Diagrams Database Course, Fall 2005

9 Scenario wants to maintain a movie database The design approach we now consider: –Conceptual Database Design: high level description of data to be stored (ER model) –Logical Database Design: translation of ER diagrams into a relational database schema (description of tables)

10 Movie Database Requirements (1) For actors and directors, we want to store their name, a unique identification number, address, and birthday For actors, we also want to store a picture For movies, we want to store the title, year of production, and type We want to know who directed and who acted in each movie. Every movie has one director We store the pay of each actor for each movie

11 Movie Database Requirements (2) An actor can receive an award for his part in a movie. We store information about who got which award for which movie, along with the name of the award and year. We also store the name and telephone number of the organization that gave the award. Two different organizations can give an award with the same name. A single organization does not give more than one award with a particular name in the same year.

12 Entities, Entity Sets Entity ( ישות ): An object in the world that can be distinguished from other objects Entity set ( קבוצת ישויות ): A set of similar entities  Entity sets are drawn as rectangles Compare to objects and classes in OOD Q: What are some of the entity sets in our movie database?

13 Attributes Attributes ( תכונות ): Used to describe entities –All entities in the set have the same attributes  Attributes are drawn using ovals –A minimal set of attributes that uniquely identify an entity is called a key  The names of the attributes which make up the key are underlined

14 Example Actor id name address birthday

15 Another Option for a Key? Actor id name address birthday

16 Relationships, Relationship Sets Relationship ( קשר ): Association among two or more entities –Relationships may have attributes Relationship Set ( קבוצת קשרים ): Set of similar relationships  Relationship sets are drawn using diamonds Q: Could you name some of the relationship sets in the movie database?

17 Example Actor id name address birthday Acted In Movie title type year Where does the salary attribute belong? salary

18 Recursive Relationships Employee id name address phone number Manages An entity set can participate more than once in a relationship In this case, we add a description of the role to the ER- diagram manager worker

19 n-ary Relationship An n-ary relationship set R involves exactly n entity sets: E 1, …, E n Each relationship in R involves exactly n entities: e 1   E 1, …, e n   E n Formally, R  E 1 x …x E n Actor id name Produced Movie title Director idname

20 Another Option: Remember Recursive Relationships Person id name title produce d Movie director actor

21 Binary vs. Ternary Relationship מרצהקורס לימד שם קורס שם מרצה מס זהות מספר קטלוגי מוסד שם מוסד מרצהקורס לימד ב שם קורס שם מרצה מס זהות מספר קטלוגי מוסד שם מוסד לימד את ניתן ב

22 Important Note id name Actor Acted In Movie The entities in a relationship set identify the relationship Suppose we wanted to store the role of an actor in a movie How would we store information about a person who acted in one movie in several roles? role title Role title

23 Important Note id name Actor Acted In Movie The entities in a relationship set identify the relationship Suppose we wanted to store the role of an actor in a movie role title

24 Important Note id name Actor Acted In Movie How would we store information about a person who acted in one movie in several roles? title Role title

25 Key Constraints ( אילוצי מפתח ) Key constraints specify whether an entity can participate in one, or more than one, relationships in a relationship set When there is no key constraint, an entity can participate any number of times When there is a key constraint, the entity can participate at most one time  Key constraints are drawn using an arrow from the entity set to the relationship set

26 Many-to-Many A movie is directed by any number of directors A director can direct any number of movies Director id name Directed Movie title DirectorDirectedMovie

27 One-to-Many A movie is directed by at most one director A director can direct any number of movies Director id name Directed Movie title DirectorDirectedMovie

28 One-to-One A movie is directed by at most one director A director can direct at most one movie Director id name Directed Movie title DirectorDirectedMovie

29 Another Example Person id name age FatherOf Where would you put the arrow? father child

30 Another Example Person id name age FatherOf father child

31 Key Constraints in Ternary Relationships Director id name produced Movie title Actor idname What does this mean? A movie has at most one actor and one director

32 Participation Constraints אילוצי השתתפות )) When there is no participation constraint, it is possible that an entity will not participate in a relationship set When there is a participation constraint, the entity must participate at least once  Participation constraints are drawn using a thick line from the entity set to the relationship set

33 Example (1) A movie has at least one director A director can direct any number of movies Director id name Directed Movie title DirectorDirectedMovie Do you think that there should be a participation constraint from Director to Directed?

34 Example (2) We can combine key and participation constraints. What does this diagram mean? Director id name Directed Movie title A movie has exactly one director. A director directs at least one movie.

35 Weak Entity Sets (1) Award year name organization What is the problem here?

36 Weak Entity Sets (2) Award Organization Gives year name phone number Does this solve the problem?

37 Weak Entity Sets (3) Weak entity sets are entity sets that are not uniquely identified by their attributes A weak entity set has an "identifying relationship“ ( תלות זיהוי ) with an entity set that is the "identifying owner“ ( הבעלים המזהה ) of the weak entity set

38 Weak Entity Sets (4) A weak entity set must: –participate fully in the identifying relationship (  a thick line) –participate in a one to many relationship with the identifying owner (  an arrow)  Weak entity sets have a thick rectangle, their keys are underlined with a broken line, and the identifying relationship has a thick diamond

39 Weak Entity Sets (5) Award Organization Gives year name phone number

40 Example Book title author isbn Copy copy numbercondition Copy Of Borrowed Person id

41 What if We Store Information About Many Libraries? Book title author isbn Copy copy numbercondition Copy Of Borrowed Person id Owned By Library name

42 ISA Hierarchies ISA Relationships: Define a hierarchy between entity sets –ISA is similar to inheritance  ISA relationships are drawn as a triangle with the word ISA inside it. The "super entity-set" is above the triangle and the "sub entity-sets" are below

43 Example What are the keys of: 1.Movie Person 2.Actor 3.Director Movie Person ISA Actor id name address birthday picture Director

44 Overlap Constraints Overlap constraints: Determine whether two sub-entity sets can contain the same entity –Example: Can an Actor be a Director?  Write "Actor OVERLAPS Director". If not written, assume no overlap

45 Covering Constraints Covering constraints: Determine whether every entity in the super-entity set is also in at least one of the sub-entity sets –Example: Is every movie person either an Actor or a Director?  Write "Actor AND Director COVER Movie Person". If not written, assume no covering

46 child Person Married nameid ParentO f parentwoman man Example Is this good? A man can be married to a man and a woman to a woman!

47 Example Person ISA Man Woman ParentOf Married child parent name id Man AND Woman COVER Person

48 Aggregation Aggregation: Allows us to indicate that a relationship set participates in a relationship set

49 Is this good? (1) Actor picture Movie year type title Acted In salary Award Each movie has received at least one award Each actor has received at least one award

50 Is this good? (2) Actor picture Movie year type title Acted In salary Award Won The same award can be granted to an actor A and to a movie F although the actor A has not acted in the movie F.

51 Solution: Use Aggregation Actor picture Movie year type title Acted In salary Award Won

52 Movie Person ISA Actor id name address birthday picture Director Movie year type title Acted InDirected salary Award Organization Gives year name phone number Won