subject

The Long Haul Database belongs to a company name Long Haul, which operates a number of

passenger vans. Vans are distinguished by registration code, and characterized by the number of

passenger seats. The company keep track of the cabin type of its vans. Cabin type differ in their

air conditioning capabilities. At present, there are only two types: those with air-conditioning and

those without it (yes/no). Each van is assigned a quality rank (which is equal to the number of

break-down within the last year.)

Long Haul operates various lines among the neighboring towns. All lines are express and

passenger vans never stop on a line. Each line is assign a unique number, and characterized by its

origin and destination towns. Additionally, the management keeps track of the length of distance

covered by each line (in miles).

Information is stored about drivers. For each drivers, the management needs to know ssn, first

and last names, and date of birth. If available, driver contact phone numbers are stored.

The management keeps a departure plan of lines, which schedules the departure and arrival times

of each line on each date. Carefully predicting the passenger interest, the scheduling clerk dispatches

one or more vans to each individual scheduled line. For each dispatched van, the dispatcher records

which driver has been assigned to it. Once this assignment is made, the ticket booth is free to book

tickets for each dispatched van. Each sold seat is recorded, so that no van should be booked above

its capacity.

The database is created by the following SQL statements:

create table van(

registr char(6),

seats number,

cabin char(1),

rank number,

primary key(registr)

);

1

create table driver(

ssn char(10),

firstname varchar(16),

lastname varchar(36),

birthdate date,

primary key(ssn)

);

create table phonebook(

person char(10),

phonenum varchar(16),

primary key(person, phonenum),

foreign key (person) references driver

);

create table line(

linenum number,

origin varchar(20),

destination varchar(20),

distance number,

primary key (linenum)

);

create table plan(

depcode char(12),

nline number,

depart date,

arrive date,

primary key (depcode),

foreign key (nline) references line

);

create table dispatch(

vehicle char(6),

depcode char(12),

soldseats number,

driverid char(10),

primary key (vehicle, depcode),

foreign key (driverid) references driver,

foreign key (depcode) references plan,

foreign key (vehicle) references van

);

Write SQL statements for the queries specified below:

1. Find registration codes for all vans that do not have air conditioning.(3 points)

2. Find names (first and last) of all drivers who have been assigned to drive a van without air

conditioning.(5 points)

3. Find names (first and last) of all drivers who have not been assigned to drive a van without

air conditioning on a line that covers a distance longer than 15 miles. (6 points)

4. Find registration codes of those vans that are scheduled to depart today, but the number of

sold seats has reached their seat capacity ( we do not know what date is today).(6 points)

5. Find the origin and destination of those vans on which at least one dispatched van has had

all its seats sold.(6 points)

6. find the largest distance and the average distance covered by the lines that depart today ( we

do not know what date is today).(5 points)

7. Find the total number of passenger seats sold (altogether) in all the vans that have been

dispatched to lines that cover a distance longer than 50 miles. (5 points)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 23.06.2019 00:00
Suppose you have 9 coins and one of them is heavier than others. other 8 coins weight equally. you are also given a balance. develop and algorithm to determine the heavy coin using only two measurements with the of the balance. clearly write your algorithm in the form of a pseudocode using the similar notation that we have used in the class to represent sorting algorithms
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
You know the right answer?
The Long Haul Database belongs to a company name Long Haul, which operates a number of

p...
Questions
question
Chemistry, 01.10.2019 20:50
Questions on the website: 13722363