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
Answers
Answered by
0
Answer:
sorryhope it helps you
Answered by
0
Answer:
ORDER BY
Explanation:
My query for count is:
count(*)bus_count
sum(case when type='ac' then 1 else 0)
sum (case when type="non ac" then 1 else 0)
from buses
group by bus_number;
ORDER BY statement in sql is used to sort the fetched data in either ascending or descending according to one or more columns.
By default ORDER BY sorts the data in ascending order.
We can use the keyword DESC to sort the data in descending order and the keyword ASC to sort in ascending order.
Similar questions