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
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
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
What are the carriers of devices whose software platforms are not 'Android'?
assistant
SELECT Carrier FROM device WHERE Software_Platform != 'Android'
human
How many different software platforms are there for devices?
assistant
SELECT count(DISTINCT Software_Platform) FROM device
human
What is the software platform that is most common amongst all devices?
assistant
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT( * ) DESC LIMIT 1 ;