Number of Buses in SQL

Question:

Number of Buses

Write a query to display number of available Ac and Non Ac buses . Give alias name to type as bus_type and count of buses as bus_count. Sort the records based count of buses in descending order

Quiz for Exam - Number of Buses

Code:

Main.sql

select type as bus_type, count(avail_seats) as bus_count 
from buses 
group by type 
order by bus_count desc ;

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *