input
stringlengths 193
2.69k
| output
stringlengths 24
744
|
|---|---|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
Please write me a SQL statement that answers the following question: How many menus were created for lunch? [/INST]
|
SELECT COUNT(*) FROM Menu WHERE event = 'LUNCH';
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
Please write me a SQL statement that answers the following question: Among the menus with over 10 pages, how many of them have over 20 dishes? [/INST]
|
SELECT COUNT(*) FROM Menu WHERE page_count > 10 AND dish_count > 20;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
Please write me a SQL statement that answers the following question: What is the ID of the menu with the most number of dishes? [/INST]
|
SELECT id FROM Menu ORDER BY dish_count DESC LIMIT 1;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
Please write me a SQL statement that answers the following question: How many dishes are there on the menu "Zentral Theater Terrace"? [/INST]
|
SELECT COUNT(*) FROM Menu WHERE name = 'Zentral Theater Terrace';
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
Please write me a SQL statement that answers the following question: Among the menus that did not support taking out or booking in advance, how many of them were created before 1950? [/INST]
|
SELECT COUNT(*) FROM Menu WHERE call_number IS NULL AND strftime('%Y', date) < '1950';
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: What is the image ID of page 1 of the menu "Zentral Theater Terrace"? [/INST]
|
SELECT T2.image_id FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: To which menu does the menu page image ID5189412 belong? Please give its name. [/INST]
|
SELECT T1.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.image_id = 5189412;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: Which menu page has a bigger width, page 1 of "Zentral Theater Terrace" or page 1 of "Young's Hotel"? [/INST]
|
SELECT CASE WHEN SUM(CASE WHEN T1.name = 'Zentral Theater Terrace' THEN T2.full_width ELSE 0 END) - SUM(CASE WHEN T1.name = 'Young''s Hotel' THEN T2.full_width ELSE 0 END) > 0 THEN 'Zentral Theater Terrace' ELSE 'Young''s Hotel' END FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: Which menu page of "Ritz Carlton" has the biggest height? [/INST]
|
SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'Ritz Carlton' ORDER BY T1.full_height DESC LIMIT 1;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: Among the menu pages of "Ritz Carlton", how many of them have a width of over 1000? [/INST]
|
SELECT SUM(CASE WHEN T1.name = 'Ritz Carlton' THEN 1 ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.full_width > 1000;
|
[INST] Here is a database schema:
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: How many dishes are there on page 1 of menu ID12882? [/INST]
|
SELECT SUM(CASE WHEN T1.page_number = 1 THEN 1 ELSE 0 END) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882;
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: Please list the names of all the dishes on page 1 of menu ID12882. [/INST]
|
SELECT T3.name FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T1.menu_id = 12882 AND T1.page_number = 1;
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: Please list the page numbers of all the menu pages on which the dish "Chicken gumbo" had appeared. [/INST]
|
SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo';
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: Among the menu pages on which the dish "Chicken gumbo" had appeared, what is the menu ID of the one with the biggest width? [/INST]
|
SELECT T1.id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' ORDER BY T1.full_width DESC LIMIT 1;
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: For how many times had the dish "Chicken gumbo" appeared on a menu page? [/INST]
|
SELECT SUM(CASE WHEN T1.name = 'Chicken gumbo' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id;
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: Among the menu pages on which the dish "Paysanne Soup" had appeared, how many of them had a stable price for the dish? [/INST]
|
SELECT SUM(CASE WHEN T1.name = 'Paysanne Soup' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.highest_price IS NULL;
|
[INST] Here is a database schema:
Dish :
id [ INTEGER ] primary_key
name [ TEXT ]
description [ TEXT ]
menus_appeared [ INTEGER ]
times_appeared [ INTEGER ]
first_appeared [ INTEGER ]
last_appeared [ INTEGER ]
lowest_price [ REAL ]
highest_price [ REAL ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: What is the highest price of the dish "Chicken gumbo" on a menu page? [/INST]
|
SELECT T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Chicken gumbo' ORDER BY T2.price DESC LIMIT 1;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
Please write me a SQL statement that answers the following question: How much space does page 1 of the menu "Zentral Theater Terrace" cover? [/INST]
|
SELECT T2.full_height * T2.full_width FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1;
|
[INST] Here is a database schema:
Menu :
id [ INTEGER ] primary_key
name [ TEXT ]
sponsor [ TEXT ]
event [ TEXT ]
venue [ TEXT ]
place [ TEXT ]
physical_description [ TEXT ]
occasion [ TEXT ]
notes [ TEXT ]
call_number [ TEXT ]
keywords [ TEXT ]
language [ TEXT ]
date [ DATE ]
location [ TEXT ]
location_type [ TEXT ]
currency [ TEXT ]
currency_symbol [ TEXT ]
status [ TEXT ]
page_count [ INTEGER ]
dish_count [ INTEGER ]
MenuPage :
id [ INTEGER ] primary_key
menu_id [ INTEGER ] MenuPage.menu_id = Menu.id
page_number [ INTEGER ]
image_id [ REAL ]
full_height [ INTEGER ]
full_width [ INTEGER ]
uuid [ TEXT ]
MenuItem :
id [ INTEGER ] primary_key
menu_page_id [ INTEGER ] MenuItem.menu_page_id = MenuPage.id
price [ REAL ]
high_price [ REAL ]
dish_id [ INTEGER ] MenuItem.dish_id = Dish.id
created_at [ TEXT ]
updated_at [ TEXT ]
xpos [ REAL ]
ypos [ REAL ]
Please write me a SQL statement that answers the following question: What is the average number of dishes per menu page of menu ID12882? [/INST]
|
SELECT CAST(COUNT(dish_id) AS REAL) / COUNT(T3.page_count) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.menu_id = 12882;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were ordered by S K L Enterprises Inc in 2017? [/INST]
|
SELECT COUNT(T2.ship_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND STRFTIME('%Y', T2.ship_date) = '2017';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the total number of pounds being transported for S K L Enterprises Inc? [/INST]
|
SELECT SUM(T2.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among the shipments done by Sue Newell, how many of them are for S K L Enterprises Inc? [/INST]
|
SELECT COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND T3.first_name = 'Sue' AND T3.last_name = 'Newell';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were ordered by a customer in Florida? [/INST]
|
SELECT COUNT(T1.cust_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.state = 'FL';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Please list the IDs of all the shipments made by a retailer customer. [/INST]
|
SELECT T2.ship_id FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_type = 'retailer';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among the customers having at least one shipment in 2017, how many of them have an annual revenue of over 30000000? [/INST]
|
SELECT COUNT(COUNTCUSID) FROM ( SELECT COUNT(T1.cust_id) AS COUNTCUSID FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2017' AND T1.annual_revenue > 30000000 GROUP BY T1.cust_id HAVING COUNT(T2.ship_id) >= 1 ) T3;
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments in 2017 were done by Sue Newell? [/INST]
|
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' AND T2.first_name = 'Sue' AND T2.last_name = 'Newell';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full name of the driver that has done the most shipments in 2017? [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' GROUP BY T2.first_name, T2.last_name ORDER BY COUNT(*) DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among the shipments in 2017, how many of them have the destination in New Jersey? [/INST]
|
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' AND T2.state = 'New Jersey';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the maximum weight being transported to New York during a single shipment? [/INST]
|
SELECT MAX(T1.weight) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city_name = 'New York';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How much more pounds in total were transported to New York than to Chicago? [/INST]
|
SELECT SUM(CASE WHEN T2.city_name = 'New York' THEN T1.weight ELSE 0 END) - SUM(CASE WHEN T2.city_name = 'Chicago' THEN T1.weight ELSE 0 END) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Please list the destination cities of all the shipments ordered by S K L Enterprises Inc. [/INST]
|
SELECT DISTINCT T3.city_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T1.cust_name = 'S K L Enterprises Inc';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average weight of the goods being transported on a single shipment ordered by S K L Enterprises Inc? [/INST]
|
SELECT AVG(T2.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among all the shipments to Florida, what is the percentage of the shipment to Jacksonville? [/INST]
|
SELECT CAST(SUM(CASE WHEN T2.city_name = 'Jacksonville' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.state = 'Florida';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: State the headquarter of the truck which completed shipment no.1045. [/INST]
|
SELECT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = 1045;
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were delivered by the oldest truck model? [/INST]
|
SELECT COUNT(*) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id GROUP BY T1.model_year ORDER BY T1.model_year ASC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Who was the customer of shipment no.1275? Give the customer's name. [/INST]
|
SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_id = '1275';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Where was the destination city of shipment no.1701? [/INST]
|
SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1701';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Give the name of the driver of shipment no.1021. [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1021';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Tell the name of the driver who received the shipment on 2017/11/5. [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2017-11-05';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Show the population of the city which was the destination of shipment no.1398. [/INST]
|
SELECT T2.population FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1398';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the ship date of the first shipment to customers in South Carolina. [/INST]
|
SELECT MIN(T1.ship_date) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'SC';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: For the shipment received by Leszek Kieltyka on 2017/9/25, what was its weight? [/INST]
|
SELECT T1.weight FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Leszek' AND T2.last_name = 'Kieltyka' AND T1.ship_date = '2017-09-25';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the area of the destination city of shipment No.1346? [/INST]
|
SELECT T2.area FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1346';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the weight of the shipment to U-haul Center Of N Syracuse on 2016/9/21. [/INST]
|
SELECT T1.weight FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.cust_name = 'U-haul Center Of N Syracuse' AND T1.ship_date = '2016-09-21';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Who was the driver of truck no.3 on 2016/9/19? Tell the full name. [/INST]
|
SELECT T3.first_name, T3.last_name FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.truck_id = '3' AND T2.ship_date = '2016-09-19';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the population density of the city as the destination of shipment no.1369. [/INST]
|
SELECT T2.area / T2.population FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1369';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average number of shipments done by the Kenworth trucks? [/INST]
|
SELECT CAST(COUNT(T2.ship_id) AS REAL) / COUNT(DISTINCT T1.truck_id) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Kenworth';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many pounds did Sue Newell transport during her first shipment? [/INST]
|
SELECT T1.weight FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Sue' AND T2.last_name = 'Newell' ORDER BY T1.ship_date ASC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: To whom did the company transport its heaviest shipment? [/INST]
|
SELECT T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id ORDER BY T1.weight DESC LIMIT 1;
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full name of the driver who transported the first shipment of the company? [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.ship_date ASC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: In total, how many shipments were transported to Olympic Camper Sales Inc? [/INST]
|
SELECT COUNT(T2.ship_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'Olympic Camper Sales Inc';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many of the shipments bound for New York City were shipped to Harry's Hot Rod Auto and Truck Accessories? [/INST]
|
SELECT COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T3.city_name = 'New York' AND T1.cust_name = 'Harry''s Hot Rod Auto & Truck Accessories';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among the top 5 heaviest shipments, how many shipments were transported via Mack? [/INST]
|
SELECT COUNT(T2.ship_id) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack' ORDER BY T2.weight DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the full name of the driver who delivered the most shipments to the least populated city? [/INST]
|
SELECT T1.first_name, T1.last_name FROM driver AS T1 INNER JOIN shipment AS T2 ON T1.driver_id = T2.driver_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id GROUP BY T1.first_name, T1.last_name, T3.population HAVING T3.population = MAX(T3.population) ORDER BY COUNT(*) DESC LIMIT 1;
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments with weight of no more than 1,000 pounds were shipped by the oldest truck? [/INST]
|
SELECT COUNT(*) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.weight < 1000 ORDER BY T1.model_year ASC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How much is the annual revenue of the customer with the most number of shipments? [/INST]
|
SELECT T2.annual_revenue FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_id ORDER BY COUNT(T1.cust_id) DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among the shipments for Downey, how many shipments were shipped to California in 2016? [/INST]
|
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T3.cust_id = T1.cust_id WHERE T2.city_name = 'Downey' AND STRFTIME('%Y', T1.ship_date) = '2016' AND T3.state = 'CA';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments did Holger Nohr transport to North Las Vegas overall? [/INST]
|
SELECT COUNT(*) FROM driver AS T1 INNER JOIN shipment AS T2 ON T1.driver_id = T2.driver_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T1.first_name = 'Holger' AND T1.last_name = 'Nohr' AND T3.city_name = 'North Las Vegas';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were shipped to the most densely populated city? [/INST]
|
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T2.area / T2.population DESC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
Please write me a SQL statement that answers the following question: Determine the percentage of manufacturers who are from Texas among all of Lorenzo's customers. [/INST]
|
SELECT CAST(SUM(CASE WHEN cust_type = 'manufacturer' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer WHERE state = 'TX';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Identify the total weight of shipments transported to San Mateo, California, in 2016. [/INST]
|
SELECT SUM(T1.weight) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city_name = 'San Mateo' AND STRFTIME('%Y', T1.ship_date) = '2016';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Identify the total weight of shipments transported in 2016 by the newest Peterbilt. [/INST]
|
SELECT SUM(T2.weight) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Peterbilt' AND STRFTIME('%Y', T2.ship_date) = '2016' ORDER BY T1.model_year DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What was the maximum weight of the shipment carried to Boston? Name the customer of that shipment. [/INST]
|
SELECT T1.weight, T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T1.city_id WHERE T3.city_name = 'Boston' ORDER BY T1.weight DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Where was shipment no. 1002 headed? [/INST]
|
SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1002';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average shipment weight carried by the oldest Mack? [/INST]
|
SELECT AVG(T2.weight) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Identify the full name of the driver who delivered a shipment to the city of New York in February 2016. [/INST]
|
SELECT T3.first_name, T3.last_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id WHERE T2.city_name = 'New York' AND T1.ship_date LIKE '2016-02%';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Name the customer who sent the shipment to Oak Park. [/INST]
|
SELECT T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T1.city_id WHERE T3.city_name = 'Oak Park';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Determine the number of shipments delivered by Andrea Simons to Huntsville in 2016. [/INST]
|
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id WHERE T3.first_name = 'Andrea' AND T3.last_name = 'Simons' AND T2.city_name = 'Huntsville' AND STRFTIME('%Y', T1.ship_date) = '2016';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments does each driver deliver per month on average? [/INST]
|
SELECT CAST(COUNT(*) AS REAL) / (12 * COUNT(T2.driver_id)) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among all shipments placed by Sunguard Window Tinting & Truck Accessories in 2017, identify the percentage of shipments whose weight exceeded 10,000 pounds. [/INST]
|
SELECT CAST(SUM(CASE WHEN T1.weight >= 10000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.cust_name = 'Sunguard Window Tinting & Truck Accessories' AND STRFTIME('%Y', T1.ship_date) = '2017';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Among all shipments delivered by Sue Newel, identify the percentage of shipments that were placed by Autoware Inc. [/INST]
|
SELECT CAST(SUM(CASE WHEN T3.cust_name = 'Autoware Inc' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id INNER JOIN customer AS T3 ON T3.cust_id = T1.cust_id WHERE T2.first_name = 'Sue' AND T2.last_name = 'Newell';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many cities which belong to New Jersey have transported weight greater than 20000? [/INST]
|
SELECT COUNT(*) FROM ( SELECT T2.city_id AS CITYID FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.state = 'New Jersey' GROUP BY T2.city_id HAVING SUM(T1.weight) > 20000 );
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many cities whose polulation is larger than 50000 pounds have shipment in 2017? [/INST]
|
SELECT COUNT(*) FROM city AS T1 INNER JOIN shipment AS T2 ON T1.city_id = T2.city_id WHERE T1.population > 50000 AND STRFTIME('%Y', T2.ship_date) = '2017';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: State the weight of shipments transported by Peterbilt. [/INST]
|
SELECT T2.weight FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE make = 'Peterbilt';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the model year of the truck used in shipment id 1003? [/INST]
|
SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1003';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the brand of truck used in shipment id 1011? [/INST]
|
SELECT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1011';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the first name of the driver who transported shipment id 1028? [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = 1028;
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: List out the state of driver who transported the shipment id 1055. [/INST]
|
SELECT T2.state FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1055';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: State the address of drivers who transported the shipment with weight greater than 50000 pounds. [/INST]
|
SELECT T2.address FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 50000;
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Give the full name of driver who transported the items on 3/2/2016. [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2016-03-02';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average annual revenue of customers who have shipment weight of less than 65000 pounds? [/INST]
|
SELECT AVG(T1.annual_revenue) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.weight < 65000;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the percentage of wholesaler customers who have shipment weight of not greater than 70000 pounds? [/INST]
|
SELECT CAST(SUM(CASE WHEN T2.weight < 70000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_type = 'wholesaler';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the last name of driver who transported shipment id 1088? [/INST]
|
SELECT T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1088';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Give the phone of drivers who transported shipment weight of greater than 20000 pounds. [/INST]
|
SELECT T2.phone FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 20000;
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the brand and model of truck used in shipment id 1055? [/INST]
|
SELECT T1.make, T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1055';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
Please write me a SQL statement that answers the following question: How many trucks were manufactured in year 2009? [/INST]
|
SELECT COUNT(truck_id) FROM truck WHERE model_year = 2009;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
Please write me a SQL statement that answers the following question: How many customers are manufacturer? [/INST]
|
SELECT COUNT(*) FROM customer WHERE cust_type = 'manufacturer';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
Please write me a SQL statement that answers the following question: How many customers who live in California that are retailers? [/INST]
|
SELECT COUNT(*) FROM customer WHERE cust_type = 'retailer' AND state = 'CA';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
Please write me a SQL statement that answers the following question: How many cities are in Connecticut? [/INST]
|
SELECT COUNT(*) FROM city WHERE state = 'Connecticut';
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
Please write me a SQL statement that answers the following question: What is the most populated city in California? [/INST]
|
SELECT city_name FROM city WHERE state = 'California' AND population = ( SELECT MAX(population) FROM city WHERE state = 'California' );
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
Please write me a SQL statement that answers the following question: What is the annual revenue of Klett & Sons Repair? [/INST]
|
SELECT annual_revenue FROM customer WHERE cust_name = 'Klett & Sons Repair';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Who is the driver that transported the lightest weight of shipment? Provide the full name of the driver. [/INST]
|
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.weight ASC LIMIT 1;
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were shipped to customers living in California in year 2016? [/INST]
|
SELECT COUNT(*) AS per FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2016' AND T1.state = 'CA';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the brand of the truck that is used to ship by Zachery Hicks? [/INST]
|
SELECT DISTINCT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: List all the name of the customers that received a shipment in February 2017. [/INST]
|
SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_date LIKE '2017-02%';
|
[INST] Here is a database schema:
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the brand of the truck and the name of the driver that transported goods in Klett & Sons Repair. [/INST]
|
SELECT T3.make, T4.first_name, T4.last_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN truck AS T3 ON T3.truck_id = T2.truck_id INNER JOIN driver AS T4 ON T4.driver_id = T2.driver_id WHERE T1.cust_name = 'Klett & Sons Repair';
|
[INST] Here is a database schema:
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: What is the shipment ID of the heaviest shipment that Zachery Hicks transported? [/INST]
|
SELECT T1.ship_id FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Zachery' AND T2.last_name = 'Hicks' ORDER BY T1.weight DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
driver :
driver_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip_code [ INTEGER ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments did Zachery Hicks transport goods to New York in the year 2016? [/INST]
|
SELECT COUNT(*) FROM city AS T1 INNER JOIN shipment AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks' AND T1.city_name = 'New York' AND STRFTIME('%Y', T2.ship_date) = '2016';
|
[INST] Here is a database schema:
truck :
truck_id [ INTEGER ] primary_key
make [ TEXT ]
model_year [ INTEGER ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: Which headquarter's truck has the highest shipments in year 2016? [/INST]
|
SELECT CASE WHEN T2.make = 'Peterbilt' THEN 'Texas (TX)' WHEN T2.make = 'Mack' THEN 'North Carolina (NC)' WHEN T2.make = 'Kenworth' THEN 'Washington (WA)' END AS "result" FROM shipment AS T1 INNER JOIN truck AS T2 ON T1.truck_id = T2.truck_id WHERE CAST(T1.ship_date AS DATE) = 2016 GROUP BY T2.make ORDER BY COUNT(T1.ship_id) DESC LIMIT 1;
|
[INST] Here is a database schema:
city :
city_id [ INTEGER ] primary_key
city_name [ TEXT ]
state [ TEXT ]
population [ INTEGER ]
area [ REAL ]
customer :
cust_id [ INTEGER ] primary_key
cust_name [ TEXT ]
annual_revenue [ INTEGER ]
cust_type [ TEXT ]
address [ TEXT ]
city [ TEXT ]
state [ TEXT ]
zip [ REAL ]
phone [ TEXT ]
shipment :
ship_id [ INTEGER ] primary_key
cust_id [ INTEGER ] shipment.cust_id = customer.cust_id
weight [ REAL ]
truck_id [ INTEGER ] shipment.truck_id = truck.truck_id
driver_id [ INTEGER ] shipment.driver_id = driver.driver_id
city_id [ INTEGER ] shipment.city_id = city.city_id
ship_date [ TEXT ]
Please write me a SQL statement that answers the following question: How many shipments were shipped to the least populated city in California? [/INST]
|
SELECT COUNT(T3.city_name) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T3.state = 'California' ORDER BY T3.population ASC LIMIT 1;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.