Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP! The SQL below creates the Officer and Event tables. Create the Vehicle and VehicleEvent tables with columns matching the table diagram above and

PLEASE HELP!

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 auto-increment.

The vehicle's model name should be limited to 20 characters.

image text in transcribedimage text in transcribedimage text in transcribed

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 auto-increment. - The vehicle's model name should be limited to 20 characters. \( \begin{aligned} 1 & \text { CREATE TABLE Officer ( } \\ 2 & \text { OfficerNumber INT UNSIGNED AUTO_INCREMENT, } \\ 3 & \text { Badgenumber INT NOT NULL, } \\ 4 & \text { DepartmentName VARCHAR(30) NOT NULL, } \\ 5 & \text { FUIIName VARCHAR(30) NOT NULL, } \\ 6 & \text { RankCode CHAR(3), } \\ 7 & \text { PRIMARY KEY (OfficerNumber), } \\ 8 & \text { UNIQUE (Badgenumber, DepartmentName) } \\ 9 & \text {; }\end{aligned} \) Explore the database and run your program as often as you'd like, before submitting for grading. Click Run program and observe the program's output in the second box. \begin{tabular}{l|l} & \\ 11 & CREATE TABLE Event ( \\ 12 & EventNUmber INT UNSIGNED AUTO_INCREMENT, \\ 13 & EventDateTime DATETIME NOT NULL, \\ 14 & LocationDesC TEXT(1900) NOT NULL, \\ 15 & ReportDesC TEXT(5000), \\ 16 & EventCode CHAR(2) NOT NULL, \\ 17 & CauseEventNumber INT UNSIGNED, \\ 18 & ReportofficerNumber INT UNSIGNED NOT NULL, \\ 19 & PRIMARY KEY (EventNUmber), \\ 20 & FOREIGN KEY (CauseEventNumber) \\ 21 & REFERENCES Event (EventNumber) \\ 22 & ON UPDATE SET NULL \\ 23 & ON DELETE SET NULL, \\ 24 & FOREIGN KEY (ReportofficerNumber) \\ 25 & REFERENCES Officer (OfficerNumber) \\ 26 & ON UPDATE RESTRICT \\ 27 & ON DELETE RESTRICT \end{tabular} Main.sql Load default template... Explore the database and run your program as often as you'd like, before submitting for grading. Click Run program and observe the program's output in the second box

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions