DBMS Sample Questions
DBMS Sample Questions
12)
13) Most of the following queries can be written in
many different ways.
14)
15) a) Get the complete details of all flights to New
Delhi.
16) σ destination = “New Delhi” (flight)
17) --------------------------------------------------------------------------
---------------------------
18)
19) b) Get the details about all flights from Chennai
to New Delhi.
20) σ src = “Chennai” ^ dest = “New Delhi” (flight)
21) ---------------------------------------------------------------------------
--------------------------
22)
23) c) Find only the flight numbers for passenger
with pid 123 for flights to Chennai before
35)
36) [Hint: here applied a set difference
operation. The set difference operation returns
only pids that have no booking. The result is
joined with passenger table to get the
passenger names.]
37) ---------------------------------------------------------------------------
--------------------------
38)
39) f) Find the agency names for agencies that
located in the same city as passenger with
123 (passenger)))
41)
42)[Hint: we performed a theta join on equality
conditions (equi join) here. This is done
between details of passenger 123 and the
agency table to get the valid records where the
city values are same. From the results, aname
is projected.]
43) --------------------------------------------------------------------------
---------------------------
44)
45) g) Get the details of flights that are scheduled
on both dates 01/12/2020 and 02/12/2020 at
16:00 hours.
(σ fdate = 01/12/2020 ^ time =
46)
16:00 (flight))
47) [Hint: the requirement is for flight details for
both dates in common. Hence, set intersection
is used between the temporary relations
generated from application of various
conditions.]
48) ---------------------------------------------------------------------------
--------------------------
49)
50) h) Get the details of flights that are scheduled
on either of the dates 01/12/2020 or
02/12/2020 or both at 16:00 hours.
16:00 (flight))
52) --------------------------------------------------------------------------
---------------------------
53)
54) i) Find the agency names for agencies who do
not have any bookings for passenger with id