human
Schema:
chip_model (Model_name, Launch_year, RAM_MiB, ROM_MiB, Slots, WiFi, Bluetooth)
screen_mode (Graphics_mode, Char_cells, Pixels, Hardware_colours, used_kb, map, Type)
phone (Company_name, Hardware_Model_name, Accreditation_type, Accreditation_level, Date, chip_model, screen_mode)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the name of the company that has the least number of phone models. List the company name and the number of phone model produced by that company.
assistant
SELECT Company_name , count(*) FROM phone GROUP BY Company_name ORDER BY count(*) ASC LIMIT 1;
human
List the name of the company that produced more than one phone model.
assistant
SELECT Company_name FROM phone GROUP BY Company_name HAVING count(*) > 1;
human
List the name of the phone model launched in year 2002 and with the highest RAM size.
assistant
SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 ORDER BY T1.RAM_MiB DESC LIMIT 1;
human
List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32.
assistant
SELECT T2.Hardware_Model_name , T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32;
human
the names of models that launched between 2002 and 2004.
assistant
SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004;
human
List all the model names sorted by their launch year.
assistant
SELECT model_name FROM chip_model ORDER BY launch_year ;