Objectives

This lab will put into practice the entity relationship diagraming you have seen in the lectures.

Entities, Instances, Attributes and Identifiers

  • Consider the entity STUDENT. You may have many students in a class but each individual student is a unique instance of the STUDENT entity.

  • Think about the last time you got a haircut, colour, shave, blow dry or other service provided in a hairdressers/barbers. Name the entities that are the "main things" about the business. Give examples for each entity.

  • For each of the following business contexts decide if the concept is an entity, instance, or attribute. If it is an entity, also provide an instance of that entity. If it is an attribute or an instance then provide the entity for it.

  • Vehicle (a car rental agency)

  • Diet Coke (a restaurant)
  • Price (a department store)
  • Customer number (an online catalog)
  • Green (a botanical garden)
  • Cookie (a restaurant)

  • For each entity, select the attribute that could be the unique identifier of each entity.

Entity: STUDENT
Attributes: student ID, first name, last name, address

Entity: MOVIE
Attributes: title, date released, producer, director

Entity: LOCKER
Attributes: size, location, number
  • Identify the business rules contained in the following scenario.

We are frequently asked for movies starring specific actors. John Wayne and Julia Roberts are always popular. So we'd like to keep track of the star actors appearing in each movie. Not all of our movies have star actors. Customers like to know each actor's real birth name and date of birth. We track only actors who appear in the movies in our inventory.

ER Modelling Practice

Read the given business scenario. Draw the entities HAIRSTYLIST and CLIENT.

List the attributes associated with each entity and specify whether they are mandatory or optional. Identify the UIDs. Follow the diagramming conventions discussed.

“In our salon, we have a number of hairstylists. They are all salaried employees, so we keep a record of their first name, last name, address, phone number, social-security number, and salary. During the course of a day, a hairstylist may see several clients. On a slow day, a hairstylist may not work on anyone at all. We have several walk-in clients, and they each get assigned to one hairstylist. We just ask for their first name. We also have customers who call to make an appointment. When they do this, we ask for their first name, last name, and phone number. We also ask if they would like a specific hairstylist. If they have no preference, we assign one for them. Of course, they are allowed to switch to another hairstylist for their next visit to the salon. We are interested in tracking the daily appointments -- which stylist works on which client during a given day.”

ER practice

Read the given business scenario. Draw the entities BAND and MUSICIAN.

List the attributes underneath each entity. Specify whether they are mandatory or optional. Identify the UIDs. Write out the relationship in English, including optionality and cardinality.

I am an agent for several musicians and bands. A musician may be a solo performer or may belong to a band. A band will always have one or more musicians in it. Some musicians are a one-man band. However, a musician can belong to only one band. Since I schedule them for concerts and events, I need to keep track of certain information: the musician’s first name, last name, address, phone number, and hourly rate. If it’s a band, I need to know the band name in addition to the information I already keep for the member musicians. I’ve handled bands with the same name, so just to make sure I book the right band, I assign an ID to each one. The hourly rate for a band is the total of the hourly rates of its members.