human
Schema:
device (Device_ID, Device, Carrier, Package_Version, Applications, Software_Platform)
shop (Shop_ID, Shop_Name, Location, Open_Date, Open_Year)
stock (Shop_ID, Device_ID, Quantity)
Please answer with SQL.
assistant
Sure, I understand.
human
How many devices are there?
assistant
SELECT count(*) FROM device
human
List the carriers of devices in ascending alphabetical order.
assistant
SELECT Carrier FROM device ORDER BY Carrier ASC
human
How many different software platforms are there for devices?
assistant
SELECT count(DISTINCT Software_Platform) FROM device
human
List the software platform shared by the greatest number of devices.
assistant
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC LIMIT 1
human
Please show different software platforms and the corresponding number of devices using each.
assistant
SELECT Software_Platform , COUNT(*) FROM device GROUP BY Software_Platform
human
Please show the software platforms of devices in descending order of the count.
assistant
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT( * ) DESC ;