Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise you have to design an entity-relationship (ER) model for a database that tracks the contracts of a car insurance company. Below are
In this exercise you have to design an entity-relationship (ER) model for a database that tracks the contracts of a car insurance company. Below are the assumptions that your model must respect: A car insurance contract covers exactly one vehicle. If a customer needs to buy insurance for multiple vehicles, then she needs to sign multiple insurance contracts. Each contract refers to exactly one vehicle and exactly one customer. Additionally, a contract must specify a non- empty list of authorized drivers. The signing client may or may not be listed as a driver. Clients are identified by their social security numbers (SSN); if they are foreign visitors in the U.S. and don't have a social security number yet, then they are identified by their passport number. For each client the database needs to track a non-empty list of credit cards, with the usual information (Bank name, card number, expiration date). Drivers are identified by their driver license (specifying both the license state and license number). The database must also track the drivers' date of birth, age and professional occupation. Vehicles are identified by their vehicle identification number (VIN) and are divided into two distinct classes: regular cars and recreational vehicles (RVS). For each RV, the database must log both its weight-class and the number of wheels. For both regular cars and RVs, the database must specify make, model and the year of production. Each insurance contract has a starting-date and an expiration-date. The former must precede the latter. a) Draw an ER diagram to model the scenario described above. Make sure to include at least one diagram element (entity-set, relationship or attribute) for each of the underlined words; you are free to include additional elements, if needed. Make sure to enforce key-, domain- or cardinality constraints where appropriate. Make sure your answer is not ambiguous, redundant, over- or under constrained. Use type inheritance / specialization when appropriate. b) Translate your ER diagram into a relational schema. Provide a list of SQL DDL statements that implement your schema, and few DML statements to populate it with fake data. Make sure that your schema enforces all constraints when appropriate. Write a SQL select statement to identify all the cars that the driver with driver license (MI, 12345) can legally drive during the month of March 2021. Test your SQL code (DDLs, DMLs and queries) in PostgreSQL 9.6 and submit it as a separate TXT file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started