Week 6- Lab
Now lets consider designing a database for the a car lot.Consider the following statements ->
- Our car lot sells many cars every month (we have a big inventory)
- Our car lot has many customers (everyone loves us!)
- Our car lot has many sales persons (we are ready to help our customers)
- Each car sale persons sells many cars a week (our prices are great)
- Our car lot provides many mechanical services (all our mechanics are experts)
- Our Service department has many mechanics (any mechanic would love to work here)
- Our mechanics provide service to our customers (our repeat business is awesome)
- Examine the above information and determine the Entities.
- With each entity – determine some attributes for each entity. As a note – is there any information in the above statements that is not helpful for our database design?
- Now lets consider our Car Lot database design and determine the relationship of our Entities
Using LucidChart or similar tool (Visio) to construct an ERD based on the above scenario.The approach to take to solve this problem would likely be accomplished using the following steps in your preferred ER diagraming tool
- Read the statements and list out the Entities
- Determine some attributes that each entity would have
- Determine the Data Types for each of the Attributes
- Determine and resolve the Relationship cardinality for the Entities. (Hint – there are multiple Many-to-Many relationships above. Please remember that creating an additional table to resolve is needed) You do not need to include the Data Types.
Hint for resolving a many-to-many relationship n our example, we have a Student Entity and a Course Entity. Each Student can take many Courses, and each Course can have many Student. This is a Many-To-Many Relationship.We resolve this by adding an additional table: “StudentCourse”. The table allows us to create the cardinality (relationship) between a Many-To-Many relationship. In the StudentCourse table, CourseID is a foreign key that references the primary key in the Course table. In the StudentCourse table, StudentID is a foreign key that references the primary key in the Student table.
Implementing many-one relationships
- The foreign key goes in the table on the ‘many’ side of the relationship.
- The foreign key refers to the primary key on the ‘one’ side.
- The foreign key name is the primary key name with an optional prefix.
Submit using the PowerPoint template. Place the screenshot in your PowerPoint slide and submit the file.