Schema Conversion Create a table for each entity –1:1 choose one side and put a foreign key –1:* put a foreign key in many side –*:* create a table for.

Slides:



Advertisements
Similar presentations
ER Modeling Case Studies
Advertisements

Assignment Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the.
CSC271 Database Systems Lecture # 11.
Chapter 3 CIS 458 Sungchul Hong
CSC271 Database Systems Lecture # 13. Summary: Previous Lecture  Grouping through GROUP BY clause  Restricted groupings  Subqueries  Multi-Table queries.
Logical Database Design
Overview Begin 6:00 Quiz15 mins6:15 Review Table Terms25 mins6:40 Short Break10 mins6:50 SQL: Creating Tables60 mins7:50 Break10 mins8:00 Lab – Creating.
CSC271 Database Systems Lecture # 22. Summary: Previous Lecture  Applying Database SDLC on DreamHome  Database planning  System definition  Requirements.
Exploring Microsoft Access 2003 Chapter 4 Proficiency: Relational Databases, External Data, Charts, Pivot, and the Switchboard.
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
Database Systems Chapter 5 ITM 354. Chapter Outline Relational Model Concepts Relational Model Constraints and Relational Database Schemas Update Operations.
Chapter 5 The Relational Data Model and Relational Database Constraints.
Data modeling using the entity-relationship model Winter 2006Ron McFadyen Entity-relationship model (ER model) P. 49: “This model and its variations.
Relational Database Management System A type of database in which records are stored in relational form is called relational database management system.
LOGICAL DATABASE DESIGN
Database Systems Relational Model Concepts Toqir Ahmad Rana Database Management Systems 1 Lecture 17.
CS 380 Introduction to Database Systems (Chapter 5: The Relational Data Model and Relational Database Constraints)
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Ref. Chapter3 Lecture4 1.
Entity-Relationship Model
CSC271 Database Systems Lecture # 10.
Practice of ER modeling
Review: Application of Database Systems
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 5 The Relational Data Model.
The Relational Data Model and Relational Database Constraints
CSC271 Database Systems Lecture # 12. Summary: Previous Lecture  Row selection using WHERE clause  WHERE clause and search conditions  Sorting results.
METU Department of Computer Eng Ceng 302 Introduction to DBMS The Relational Data Model and Relational Database Constraints by Pinar Senkul resources:
Chapter 1 Object-oriented DBMSs Chapters in Textbook.
Chapter 9 Methodology - Logical Database Design Chapter 16 in Textbook.
Team Dosen UMN Database Design Connolly Book Chapter
B. Information Technology (Hons.) CMPB245: Database Design Logical Database Design.
Lecture 7 of Advanced Databases
SQL Data Manipulation II Chapter 5 CIS 458 Sungchul Hong.
Chapter 8 Methodology - Conceptual Database Design Chapter 15 in Textbook.
1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief
CS 3630 Database Design and Implementation. 2 DreamHome Branch (branchNo, street, city, state, zipcode, phone1, phone2, phone3) Staff (staffNo, firstName,
CS 3630 Database Design and Implementation. 2 E-R Model (II) Keys To identify records in a table Candidate Key Primary Key Alternate Key Composite Key.
1 E-R Model (II) Keys To identify records in a table Candidate Key Primary Key Alternate Key Composite Key.
CS 3630 Database Design and Implementation. Assignment 1 2 What is 3630?
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
1 Chapter 17 Methodology - Local Logical Database Design.
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware.
Relational Data Model DeSiaMore Powered by DeSiaMore.
Chapter 5 The Relational Data Model and Relational Database Constraints Copyright © 2004 Pearson Education, Inc.
Lecture4: Informal guidelines for good relational design Mapping ERD to Relation Prepared by L. Nouf Almujally Ref. Chapter3 Lecture4 1.
Chapter 4 Practice Problem Solutions. A list (Bno, Street, Area,Tel_No, Fax_No) of branches located in Bay Area Branch (Bno, Street, Area, City, Pcode,
Branch (Bno, Area, City, Pcode) Staff (Sno, FName, LName, Position, Sex, DOB, Salary, Bno) Property_for Rent (Pno, Area, City, Type, Rooms, Rent, Ono,
Quiz Where to Store Attributes of Relationship Staff (1) Interviews (0..*) Client Attributes: date, time, comment Staff (StaffNo, …) PK: StaffNo.
Introduction to Database Systems
Chapter 3 The Relational Data Model and Relational Database Constraints Copyright © 2004 Pearson Education, Inc.
Lecture # 11 & 12 (First Exam) Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Teacher Workshop Database Design Pearson Education © 2014.
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
The Relational Model May Aldoayan.
E-R Diagram (Cont.) Draw ER Diagram for the following scenario:
Chapter -3- Data Modeling Using the Entity-Relationship Model
CS 3630 Database Design and Implementation
The Relational Database Model
Relational Integrity Constraints
Company Requirements.
Conceptual Database Design
CS 3630 Database Design and Implementation
Logical Database Design
ER Modeling Case Studies
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
1.(5) Describe the working process with a database system.
Mapping an ERD to a Relational Database
CS 405G: Introduction to Database Systems
Presentation transcript:

Schema Conversion Create a table for each entity –1:1 choose one side and put a foreign key –1:* put a foreign key in many side –*:* create a table for the relation Relation –*:* create a table

(1..1) (0..1) Staff(staffNo, name, position, salary, branchNo, Manager) Branch(branchNo, street, city, postcode) Telephone (branchNo, telNo) OR Staff(staffNo, name, position, salary,branchNo) Branch(branchNo, street, city, postcode, staffNo) Telephone (branchNo, telNo)

(1..*)(1..1) Staff(staffNo, name, position, salary, manages, belongs) Branch(branchNo, street, city, postcode) Telephone (branchNo, telNo) Domain [manages]= Domain[Branch.branchNo] Domain [belongs] = Domain[Branch.branchNo]

staffNo fNamelNamemanagessexDOBsalarybranchNo SL21JohnWhiteB005MOct/1/ B005 SG37AnnBeechFNov/10/ B003 SG14DavidFordMMar/24/ B003 SA9MaryHoweF19/Feb/709000B007 SG5SusanBrandB003FJun/3/ B003 SL41JulieLeeFJun/13/659000B005 Staff BranchNostreetcitypostcode B00522 Deer RdLondonSW14EH B00716 Argyll St.AberdeenAB2 3SU B Main StGlasgowG11 9QX B00432 Manse RdBristolBS99 1NZ B00256 Clover Dr.LondonNW10 6EU Branch (1..*) (1..1) Find all the staff members who work in London. How a relationship works in tables.

PropertyForRent (propertyNo, street, city, postcode, type, rooms, rent, privateOwnerNo, businessOwnerNo, staffNo, branchNo ) Newspaper(newspaperName) Advertisement (newspaperName, PropertyNo, dateAdvert, cost) PropertyForRent NewsPaper newsPaperName {PK} ◄Advertises (1..*)(0..*) dateAdvert Cost propertyNo{PK} Street City Postcode Rooms Rent privateOwnerNo … Many-to-Many Case

Employee SSN{pk} FName MINIT LName BDate Address Sex Salary Department Dnumber{pk} Dname Mgrstartdate Location[1..n] Manages ► ◄Has *1..1 Project Pnumber{pk} Pname Plocation Dependent ESSN{pk} Dependent_Name{pk} Sex Bdate Relationship Exercise * ◄Supervises Supervisor Supervisee * Works_on ► 0..* 1..* 0..* 1..1

R1R1 R2R2 R3R3 R4R4 R5R5 R6R6 R={R 1, R 2, R 3, R 4, R 5, R 6 }

Exercise

Representing Relational Database Schemas DreamHome case study –Branch (branchNo, street, city, postcode, manager) –Staff (staffNo, fName, lName, position, sex, DOB salary, branchNo, supervisor) –PropertyForRent (propertyNo, street, city, postcode, type, rooms, rent, privateOwnerNo, businessOwnerNo, staffNo, branchNo) –Client (clientNo, fName, lName, telNo, prefType, maxRent) –Registration (clientNo, branchNo, staffNo, dateJoined) –Manager(staffNo, branchNo, MgrStartDate, bonus)

Schema –Lease (leaseNo, PropertyNo, clientNo) –Preference (clientNo, preference) –Newspaper(newspaperName) –Advertisement (newspaperName, PropertyNo, dateAdvert, cost) –PrivateOwner (privateOwnerNo, fName, lName, address, telNo) –BusinessOwner (businessOwnerNo, businessName)

IS ASSIGNED TO► Chairs► PROFESSOR DEPARTMENT N Class Exercise Please complete the relational schema. PROFESSOR(PID, FName, MINIT, LName, DOB, Rank) DEPARTMENT (DID, DName)

ENROLL► STUDENTS SECTION Exercise STUDENTS (SID, FName, LName, DOB, Major[1..3], Minor) COURSE (COURSE#, C_Name, Description) SECTION (Section_Num, Max_size) COURSE Has▼ o..* 1..1

PainterPainting Gallery Displayed (1,1)(0..*) (1..1) Paint ► ► Exercise Painter (Painter_ID, FName, LName) Paining (Painting_ID, Title, Date) Gallery (Gallery_Name, Location)

EmployeeSkills Learn ► 0..* Expert Level Exercise Employee (EID, FName, LName) Skill (Skill_Name)

StudentClasses Take ► 1..*0..* Grade Exercise STUDENTS (SID, FName, LName, DOB) CLASS (CLASS#, C_Name, Description)

Course Section * Student Take ▼ 1..* 0..* Has ► ◄Prerequisite 0..* Grade Exercise (Recursive and many-to-many) STUDENTS (SID, FName, LName, DOB) COURSE (COURSE#, C_Name, Description) SECTION (Section_Num, Max_size)

Consider the following relations for a database that keeps track of student enrollment in courses and the books adopted for each course: STUDENT(SSN, Name, Major, Bdate) COURSE(Course#, Cname, Dept) ENROLL(SSN, Course#, Quarter, Grade) BOOK_ADOPTION(Course#, Quarter, Book_ISBN) TEXT(Book_ISBN, Book_Title, Publisher, Author) Quarter(Quarter) Draw a relational schema diagram specifying the foreign keys for this schema. Exercise

Student SSN{pk} Name Major Bdate Course Enroll Course#Cname Dept Text ISBN{pk} Publisher Author Adopt Grade Quarter Quarter{pk}