Question

In: Computer Science

Consider the automobile insurance company database we use for examples in class. For each problem, write...

Consider the automobile insurance company database we use for examples in class. For each problem, write an SQL statement to retrieve the specified data.

  1. For each accident that occurred in 2005, the names of drivers involved and the make and year of the auto they were driving.
  2. The name and ssn of automobile owners who have never been the driver in any accident.
  3. The name and ssn of people involved in accidents while driving a car they do not own. (Remember that cars may have multiple owners.)

Database Schema:
• People (ssn, fname, lname, city, state)

• Agents (ssn, salary, photo)

• Autos (vin, make, year, agent_ssn)

• Owns (ssn, vin)

• Accidents (aid, accident_date, city, state)

• Involvements(aid, vin, damages, driver_ssn)

Solutions

Expert Solution

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU

-- For each accident that occurred in 2005, the names of drivers involved and the make and year of the auto they were driving.

SELECT fname, lname, make, year

FROM People AS P, Involvements AS I, Accidents AC, Autos AS A

WHERE P.ssn = I.driver_ssn AND I.aid = AC.aid AND I.vin = A.vin AND YEAR(accident_date)=2005;



-- The name and ssn of automobile owners who have never been the driver in any accident.

SELECT fname, lname, P.ssn

FROM People AS P, Autos AS A, Owns AS O

WHERE P.ssn = A.ssn AND A.vin = O.vin AND ssn NOT IN(

SELECT driver_ssn

FROM Involvements

);



-- The name and ssn of people involved in accidents while driving a car they do not own. (Remember that cars may have multiple owners.)

SELECT fname, lname, P.ssn

FROM People AS P, Involvements AS I, Owns AS O

WHERE P.ssn = I.driver_ssn AND I.vin = O.vin AND O.ssn <> I.driver_ssn;

Related Solutions

An insurance company’s database includes a variable, DAMAGE, that records, for each customer claim of automobile...
An insurance company’s database includes a variable, DAMAGE, that records, for each customer claim of automobile damage due to hail, the severity of the damage to the car. DAMAGE is recorded as 1 = minor damage, …, 5 = totaled. One of the following graphs is an appropriate way to display the DAMAGE variable. Which one? a. Time-series plot b. Boxplot c. Pie chart
An insurance company’s database includes a variable, DAMAGE, that records, for each customer claim of automobile...
An insurance company’s database includes a variable, DAMAGE, that records, for each customer claim of automobile damage due to hail, the severity of the damage to the car. DAMAGE is recorded as 1 = minor damage, …, 5 = totaled. Also in the data table is DAY, the day of the week of the hail damage (Monday, Tuesday, …). One of the following graphs is an appropriate way to display the association between DAMAGE and DAY. Which one? a. Cross-tabulation...
In each chapter of this book, we use a database for a fictitious company, Performance Lawn...
In each chapter of this book, we use a database for a fictitious company, Performance Lawn Equipment (PLE), within a case exercise for applying the tools and techniques introduced in the chapter.33 To put the database in perspective, we first provide some background about the company, so that the applications of business analytic tools will be more meaningful. 33 The case scenario was based on Gateway Estate Lawn Equipment Co. Case Study, used for the 1997 Malcolm Baldrige National Quality...
Write in Java! (Not Javascript) Consider the LinkedList class we discussed in class (see the slides...
Write in Java! (Not Javascript) Consider the LinkedList class we discussed in class (see the slides for lecture 8). Add the following methods to the class and submit the completed LinkedList class. int size() which returns the size of the linked list Link getElementByIndex(int index) which returns the Link/node specified by the index. For example, getElementByIndex(0) should return the first Link, getElementByIndex(2) should return the third Link. If index is not in range, your method should return null. boolean hasDuplicate()...
DROP DATABASE class;CREATE DATABASE class;Use class;drop table if exists Class;drop table if exists Student;CREATE TABLE Class...
DROP DATABASE class;CREATE DATABASE class;Use class;drop table if exists Class;drop table if exists Student;CREATE TABLE Class (CIN int PRIMARY KEY, FirstName varchar(255), LastName varchar(255), Gender varchar(1), EyeColor varchar(50), HairColor varchar(50), HeightInches int,CurrentGrade varchar(1));CREATE TABLE Student (SSN int PRIMARY KEY,FirstName varchar(255),LastName varchar(255), Age int,BirthMonth varchar(255),HeightInches int,Address varchar(255),City varchar(255),PhoneNumber varchar(12),Email varchar(255),FavColor varchar(255),FavNumber int);INSERT INTO Class VALUES(1, "David", "San", "M", "BRN", "BLK", 72, "-");INSERT INTO Class VALUES(2, "Jeff", "Gonzales", "M", "BRN", "BLK", 68, "B");INSERT INTO Class VALUES(3, "Anna", "Grayson", "F", "BRN", "BRN", 62,...
We use the WMCRM database and here is the summary of the database schema (where schema...
We use the WMCRM database and here is the summary of the database schema (where schema is used in its meaning of a summary of the database structure): VEHICLE (InventoryID, Model, VIN) SALESPERSON (NickName, LastName, FirstName, HireDate, WageRate, CommissionRate, OfficePhone, EmailAddress, InventoryID) CUSTOMER (CustomerID, LastName, FirstName, Address, City, State, ZIP, EmailAddress, NickName) PHONE_NUMBER (CustomerID, PhoneNumber, PhoneType) CONTACT(ContactID, CustomerID,ContactDate,ContactType,Remarks) Where InventoryID in SALESPERSON must exist in InventoryID in VEHICLE NickName in CUSTOMER must exist in NickName in SALESPERSON CustomerID in PHONE_NUMBER...
(Use the string class to solve the problem) Write a program (in c++) that can be...
(Use the string class to solve the problem) Write a program (in c++) that can be used to train the user to use less sexist language by suggesting alternative versions of sentences given by the user. The program will ask for a sentence, read the sentence into a string variable, and replace all occurrences of masculine pronouns with gender-neutral pronouns. For example, it will replace “he” with “she or he”, and “him” with “her or him”. Be sure to preserve...
Design a database for an automobile company to provide to its dealers to assist them in...
Design a database for an automobile company to provide to its dealers to assist them in maintaining customer records and dealer inventory and to assist sales staff in ordering cars. Each vehicle is identified by a vehicle identification number (VIN). Each individual vehicle is a particular model of a particular brand offered by the company (e.g., the XF is a model of the car brand Jaguar of Tata Motors). Each model can be offered with a variety of options, but...
An insurance company states in its automobile insurance policy that in case of an accident, it...
An insurance company states in its automobile insurance policy that in case of an accident, it uses the formula P = (x - x^4/5) (y-18 / 50)  to determine how much to reimburse a policyholder, where x is the value of the car at the time of the accident and y is the age of the person driving. The policyholder must sign a document indicating agreement with this procedure for determining reimbursement amounts. Joe, a 70 year old policyholder, was driving...
let's consider a common ethical problem in dealing with insurance claims. Should an insurance company have...
let's consider a common ethical problem in dealing with insurance claims. Should an insurance company have a duty to defend its insured when the defense will cost the insurance company more than it would cost to simply pay the plaintiff's claim? For example, should an auto insurance company have a duty to spend $10,000 to defend its insured when the plaintiff's claim is under $10,000. What ethical problems arise when the outcome would affect the insured's driving record and, therefore,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT