onsider the following three relations: TRAVEL_AGENT (name, age, salary) CUSTOMER
ID: 3675742 • Letter: O
Question
onsider the following three relations:
TRAVEL_AGENT (name, age, salary)
CUSTOMER (name, departure_city, destination, journey_class)
TRANSACTION (number, cust_name, travel_agent_name, amount_paid)
Write SQL statements to answer the following questions.
d. Display the names and ages of the travel agents who have arranged journeys for customer “John Smith”, in descending order of age (use a subquery).
e. Display the names and ages of travel agents who have arranged journeys for customer “John Smith”, in descending order of age (do not use a subquery).
f. Display the age of travel agents who have arranged journeys for customer “John Smith” to “Ottawa” (use a subquery).
Explanation / Answer
d.Select name,age From Travel_Agent where name In (select travel_agent_name From Transaction where cust_name= "John Smith") order by desc age
e.SELECT name,age From Travel_Agent ta,Transaction t WHERE ta.name = t.cust_name
f.Select age From Travel_Agent where name In (select travel_agent_name From Transaction t,Customer C where t.cust_name= "John Smith" and C.destination="Ottawa")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.