Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3 . Consider the table created by the following SQL statement: CREATE TABLE timetable ( orig , char ( 3 ) , - -
Question Consider the table created by the following SQL statement:
CREATE TABLE timetable
orig char code of the origin station
dest char code of the destination station
departure time expressed as minutes elapsed since :
dep smallint CHECK dep AND dep
arrival time expressed as minutes elapsed since :
arr smallint CHECK arr AND arr
fare numeric ticket price
CHECK arr dep AND orig dest
PRIMARY KEY orig dest, dep, arr
;
a Using only standard constructs we have seen in class, write an SQL query
to find all connections with exactly stop and such that:
the origin and final destination are distinct stations;
there is no cheaper direct route or no direct route at all;
the connection time is at least and no more than minutes.
Return the codes of the origin, stopover, and destination stations for the
overall trip the total travel time including connection time and the total
fare. If there is more than one connection that satisfies the requirements,
they must all be included in the answer.
A correct query is worth marks; additional marks are awarded if the
query has at most one level of nesting and does not use aggregation, outer
joins, setbag operations, CASE and WITH.
b Can the query in Question a output rows with multiplicity greater than
one? If yes, provide an instance witnessing that this is the case; otherwise,
explain why such a situation cannot occur.
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