In: Computer Science
Q1.Generate an ERD diagram for the following scenario using Lucidchart. I need to know what the diagram should look like.
(I am not sure there should be any kind of relationship between entities.)
Scenario: Southlands Electric
Southlands Electric wishes to create a database with the following information:
Customer with attributes Customer ID, Name, Address (Street,
City, State, Zip Code), and Telephone
Location with attributes Location ID, Address (Street, City, State,
Zip Code), and Type (values of Business or Residential)
Rate with attributes Rate Class and RatePerKWH
After interviews with the owners, you have come up with the
following business rules:
Customers can have one or more locations
Each location can have one or more rates, depending on the time of
day
Before drawing the diagram, let's see the various entities and
the relationships between them.
The three entities are: Customer, Location and Rate. Customer's
primary key is CustomerID and Location's primary key is
LocationID.
Customer and Location have the relationship "Owns". Location and
Rate have the relationship "Charges".
Now as per the question, a customer can have one or more locations,
therefore Customer-Location relationship is one-to-many. And also
that a customer should have at least one location.
(Explanation: For a customer to be in the company's database,
he/she should own at least one place with a connection from
Southlands Electric. He/She can also have multiple places or houses
with an electricity connection from the company. It is perfectly
possible that the billing address of the customer or the address at
which he resides and the address of the place with electricity
connection are different )
Also given, each location can have one or more rates. It is also
possible that many locations have the same rate, for example-
locations of the same type and in the same area would have the same
rate. Hence the relationship Location-Rate is many-to-many. Also,
each location should have at least one rate.
(Explanation: Each location should have at least one rate slab
associated with it for the bill to be calculated).
So the ER diagram would look like this: (I have not used Lucidchart
to draw these)
In another notation:
Although it’s not given specifically but there should also be a
Time attribute associated with the relationship “Charges”.
Please let us know if you have any further doubts.