1 / 2

E-R Exercise A Company database needs to store information about: employees (identified by ssn , with salary and ph

E-R Exercise A Company database needs to store information about: employees (identified by ssn , with salary and phone as attributes), departments (identified by dno with dname and budget as attributes ), children of employees (with name and age as attributes).

LeeJohn
Télécharger la présentation

E-R Exercise A Company database needs to store information about: employees (identified by ssn , with salary and ph

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. E-R Exercise • A Company database needs to store information about: • employees (identified by ssn, with salary and phone as attributes), • departments (identified by dno with dname and budget as attributes), • children of employees (with name and age as attributes). • Employees work in departments, every department is managed by a single employee, a child must be identified uniquely by its name when the parent (who is an employee, assume that only one parent works for the company) is known. We are not interested in information about a child if the parent leaves the company (and is removed from the database). • Draw an ER diagram that captures this information.

  2. Given the following ER diagram describing a record company’s database, how would you convert it to relational schemas? Describe what tables you would create, and what fields they would have. You can write in English, you don’t have to use SQL DDL. As discussed in class, the following entities become relations: Instrument, Musician, Song, Album, Place For relationships, Plays is many-to-many, it becomes a relation. The same is true for the Perform and Lives relationships. Every song must appear on only one Album, so the Songs relation will just have a non-null foreign key to Album. Similarly, every Album is produced by only one musician, so the Album relation will have a non-null foreign key to Musician. Phone is more complicated. I would probably just have a table with address and phone, to indicate all the phones for each address.

More Related