ER Diagrams View as a PDF

Question 1

1.1 Schema Design

Given the following ER Diagram, please write out the corresponding relational schemas. Be sure to:


1.2 Queries

Next, use your schemas to answer the following queries in relational algebra.

  1. What are the names of the publishers who have published at least one book written by "JK Rowling"?
  2. What are the emails of customers who have strictly more than one (>1) of some book in a shopping basket?
  3. What are the pairs of different books that are in the same shopping basket?
  4. What are the books that are in more than one (>1) shopping basket?
  5. What are the names of customers with a book from every publisher in their shopping basket?

Question 2

2.1 Initial Design

Let's say you are designing a new website for Barry's Beehive Bonanza (BBB) on Thursday, and Barry needs to store customer data. You decide to design a relational database for Barry. Given the following business requirements, create an ER Diagram:

2.2 Amendments

Oh no! Barry realized that there are actually three kinds of beehives: the Langstroths, the Warres and the Top Bars. Each one needs different information about them; use generalization to accomodate the following new information in your ER Diagram:

Question 3

3.1 ER Diagrams

Given the following schema, please draw out the corresponding ER Diagram. Be sure to:

person(id, name, age, address, phone_num)
gardener(person_id, years_exp)
tree(tree_id, max_height, years_to_maturity)
trees_cultivated(gardener_id, tree_id)

Note that:

3.2 Amendment 1

Now, draw the same ER diagram with the following added details:

3.3 Amendment 2

Now, all of these people can be members of a union. A union should have a name, a location of operation, and a founding year. There is each a gardener union, a landscaper union, and a pilot union. Consider now that there is no overlap between these unions. Not all of each profession are in a union, but all unions have at least one member. People can only be in one union. People without jobs cannot be in a union.

3.4 Bringing it back

Lastly, using your new ER Diagram, write a new relational schema for this scenario. If you need to change existing schemas, that is perfectly fine.

Question 4

Consider the following three ER Diagrams:


Items have an item ID, a name, and a price. Customers have a customer ID and a name. Salepersons have an employee ID and a name. Only one item can be sold at a time. Items are fancy, individually-made works of art that are each unique. Per the artist's request, a customer may only ever purchase one item. The artist is very insistent on this!

  1. Which one(s) should we NOT use if our only query will be retrieving salespersons who helped customers? Why?
  2. Which one(s) should we NOT use if our only query will be retrieving the items sold by salespersons? Why?
  3. Suppose we are equally interested in gaining information between which customers are being helped by which salespersons and which salespersons are selling which items. Indicate which of the above we should choose and justify your choice.



Guide to ER Diagram Symbols


As this is a new course, we appreciate any feedback you have for us! If you enjoyed this assignment, hated this assignment, or have other thoughts to share, please do so here!