Complete and print the following SQL transactions. Log your statements and resul
ID: 3708075 • Letter: C
Question
Complete and print the following SQL transactions. Log your statements and results by spooling your file (with echo on from Oracle if available).
List the customer type, customer type description, and count of customers for each customer type. Use the following column headings: CustType, Description, Count. Sort by count in descending order. 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 AgentTypeDescExplanation / Answer
Answer:
select ct.CustType as "CustType",ct.CustTypeDesc as "Description",count(cu.CustID) as "Count"
from CustType ct
join Customer cu on cu.CustType = ct.CustType
group by ct.CustType
order by count(cu.CustID) desc;
/*This query will list down the values of Customer type,Description and count of the customers in each type*/
Output:
CustType Description Count Full-Time Full time Customer 12 Part-Time Part Time Customer 23Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.