Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

30. Complete and print your statements and results by spooling your file (with e

ID: 3708222 • Letter: 3

Question

30.          Complete and print your statements and results by spooling your file (with echo on from Oracle if available).

List the AgentID, AgentFName, AgentLName, and count of reservations for each agent. Combine the first and last names into one column, and sort by count in descending order. Use the following column headings: AgentID, Agent, ResCount. Hint: use a GROUP BY clause.

ResDetail Customer CustlD CustFName CustLName CustPhone CustType LoyaltylD Reservation ResID CheckinDate CheckOutDate CustID AgentID ReslD Room CustType CustType CustTypeDesc RoomNum RateType RateAmt RoomType Agent AgentlD AgentFName AgentLName AgentType RateType RateType RateTypeDesc RoomType RoomType RoomTypeDesc AgentType AgentType AgentTypeDesc

Explanation / Answer

Answer)

select AgentID, (AgentFName || ' ' || AgentLName) AS NAME, (SELECT count(ResID) from Reservation where Reservation.AgentID=Agent.AgentID) as ResCount from Agent order by ResCount desc;

Here we are displaying AgentFName and AgentLName by concanating them to one single Name.

Also we are calculating the count of ResID from the Reservation for each Agent as ResCount.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote