Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8 . 7 LAB - Create Vehicle and EventVehicle tables The California DMV ' s completed table diagram is presented in the zyBook. The following
LAB Create Vehicle and EventVehicle tables
The California DMVs completed table diagram is presented in the zyBook. The following is a portion of the table diagram:
The diagram has four tables and four arrows depicting foreign keys. Table Vehicle has columns VehicleID, TypeCode R YearNumber R MakeCode R ModelName R PlateID R StateCode R and RegistrationDate. VehicleID is the primary key. PlateID StateCode is unique. Table Event has columns EventNumber, EventDateTime R LocationDesc R ReportDesc, EventCode R CauseEventNumber, and ReportOfficerNumer R EventNumber is the primary key. Table Officer has columns OfficerNumber, BadgeNumber R DepartmentCode R FullName R and RankCode. OfficerNumber is the primary key. BadgeNumber DepartmentCode is unique. Table VehicleEvent has columns VehicleID and EventNumber. VehicleID EventNumber is the primary key. VehicleID in the VehicleEvent table is a foreign key that references Vehicle, with caption restrict. EventNumber in the VehicleEvent table is a foreign key that references Event, with caption restrict. CauseEventNumber in the Event table is a foreign key that references Event, with caption set null. ReportOfficerNumber in the Event table is a foreign key that references Officer, with caption restrict.
The SQL below creates the Officer and Event tables.
Create the Vehicle and VehicleEvent tables with columns matching the table diagram above and with the appropriate keys and constraints. Some additional notes:
All ID "Number", and "Code" columns should use unsigned INT data types.
All primary keys should autoincrement.
The vehicle's model name should be limited to characters.
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