Question
Write a full script to create a new SQL Server database called BusDriver4703 and three tables as shown in the figure above, including BusModel, Bus,
Write a full script to create a new SQL Server database called BusDriver4703 and three tables as shown in the figure above, including BusModel, Bus, and Driver. Columns and primary key of each table and two relationships are also defined in the above figure. The script file must be saved and submitted as Ass10_BusDriver4703.sql. In order to receive full credit, your script must be able to be executed as a whole to create the above database and tables with no errors. *It's important you include a GO and USE command right after the database is created and before your first CREATE TABLE statement. See p.361 for an example of script that creates the AP database and its tables. For the purpose of this assignment, all relationships must be implemented such that (1) when a primary key value is updated, the foreign key that references that value is updated automatically, and (2) if a primary key value is referenced by a foreign key table, the row with this primary key value cannot be deleted, i.e., no action. Column specifications are given below. All columns default to NULL unless a primary key or NOT NULL constraint is specified.
Driver table
DriverID: int
Name: varchar(60), not null
Age: int and must between 25 and 60, not null
BusNo: char(3)
Bus table
BusNo: char(3), must begin with a letter 'U'
Mileage: int, must be positive and below 350,000
Model: char(2)
BusModel table
ModelCode: char(2), values are limited to 'LG', 'MD', 'MN', 'SP', 'ST' only
ModelName: varchar(15)
TotalSeats: int, must be at least 20 but no more than 50
Driver B river BusModel ROM 8 ModelCode Name Age ModelName BusNo TotalSeats Bus B BusNo Mileage ModelStep 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