Consider the following three relations TRAVELAGENT name age

Consider 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. Compute the number of different customers who have a transaction. Display the name of the oldest travel agent. List the total number of transactions for each travel agent. Consider only those transactions where the amount paid exceeds 1 000.

Solution

1.

select COUNT(*) as number_of_Different_Customers from CUSTOMER

where name in (Select distinct cust_name from Transaction)

2.

Select top 1 name from TRAVEL_AGENT

order by age desc

3.

select T.travel_agent_name,count(*) as totalTransactions from TRANSACTION T

where T.amount_paid > 1000

group by T.travel_agent_name

 Consider the following three relations: TRAVEL_AGENT (name, age, salary) CUSTOMER (name, departure_city, destination, journey_class) TRANSACTION (number, cust_

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site