Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Return the channel code and contact number of the customer contact channel whose active duration was the longest. [/INST]

Output: SELECT channel_code ,  contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date  =  (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1);


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name and active date of the customer that use email as the contact channel. [/INST]

Output: SELECT t1.customer_name ,  t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.channel_code  =  'Email';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the name and active date of the customers whose contact channel code is email? [/INST]

Output: SELECT t1.customer_name ,  t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.channel_code  =  'Email';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the customer that made the order with the largest quantity? [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t3.order_quantity  =  ( SELECT max(order_quantity) FROM order_items);


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of the customer who made the order of the largest amount of goods. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t3.order_quantity  =  ( SELECT max(order_quantity) FROM order_items);


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the customer that has purchased the most items? [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Give me the name of the customer who ordered the most items in total. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the payment method of the customer that has purchased the least quantity of items? [/INST]

Output: SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Tell me the payment method used by the customer who ordered the least amount of goods in total. [/INST]

Output: SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: How many types of products have Rodrick Heaney bought in total? [/INST]

Output: SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the number of distinct products Rodrick Heaney has bought so far. [/INST]

Output: SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total quantity of products purchased by "Rodrick Heaney"? [/INST]

Output: SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Tell me the total quantity of products bought by the customer called "Rodrick Heaney". [/INST]

Output: SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: How many customers have at least one order with status "Cancelled"? [/INST]

Output: SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status  =  "Cancelled";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Return the number of customers who have at least one order with "Cancelled" status. [/INST]

Output: SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status  =  "Cancelled";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: How many orders have detail "Second time"? [/INST]

Output: SELECT count(*) FROM customer_orders WHERE order_details  =  "Second time";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Tell me the number of orders with "Second time" as order detail. [/INST]

Output: SELECT count(*) FROM customer_orders WHERE order_details  =  "Second time";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the customer name and date of the orders that have the status "Delivered". [/INST]

Output: SELECT t1.customer_name ,  t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id WHERE order_status  =  "Delivered";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the customer name and date of the orders whose status is "Delivered". [/INST]

Output: SELECT t1.customer_name ,  t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id WHERE order_status  =  "Delivered";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total number of products that are in orders with status "Cancelled"? [/INST]

Output: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_status  =  "Cancelled";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the total quantity of products associated with the orders in the "Cancelled" status. [/INST]

Output: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_status  =  "Cancelled";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the total amount of products ordered before 2018-03-17 07:13:53. [/INST]

Output: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_date  <  "2018-03-17 07:13:53";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total amount of products purchased before 2018-03-17 07:13:53? [/INST]

Output: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_date  <  "2018-03-17 07:13:53";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Who made the latest order? [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id ORDER BY t2.order_date DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of the customer who made an order most recently. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id ORDER BY t2.order_date DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Which product has been ordered most number of times? [/INST]

Output: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the most frequently ordered product? Tell me the detail of the product [/INST]

Output: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name and ID of the product whose total order quantity is the largest. [/INST]

Output: SELECT t2.product_details ,  t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the name and ID of the product bought the most. [/INST]

Output: SELECT t2.product_details ,  t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. [/INST]

Output: SELECT address_content FROM addresses WHERE city  =  "East Julianaside" AND state_province_county  =  "Texas" UNION SELECT address_content FROM addresses WHERE city  =  "Gleasonmouth" AND state_province_county  =  "Arizona";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. [/INST]

Output: SELECT address_content FROM addresses WHERE city  =  "East Julianaside" AND state_province_county  =  "Texas" UNION SELECT address_content FROM addresses WHERE city  =  "Gleasonmouth" AND state_province_county  =  "Arizona";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of customers who did not pay with Cash. [/INST]

Output: SELECT customer_name FROM customers WHERE payment_method != 'Cash';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of customers who do not use Cash as payment method. [/INST]

Output: SELECT customer_name FROM customers WHERE payment_method != 'Cash';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of customers who never ordered product Latte. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are names of customers who never ordered product Latte. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of customers who never placed an order. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of customers who never made an order. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of customers who ordered both products Latte and Americano. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Americano';


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
address_content [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]
other_address_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
date_became_customer [ TEXT ]
other_customer_details [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_address_from [ TEXT ]
address_type [ TEXT ]
date_address_to [ TEXT ]

Customer_Contact_Channels :
customer_id [ INT ] Customer_Contact_Channels.customer_id = Customers.customer_id
channel_code [ TEXT ]
active_from_date [ TEXT ]
active_to_date [ TEXT ]
contact_number [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status [ TEXT ]
order_date [ TEXT ]
order_details [ TEXT ]

Order_Items :
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of customers who have purchased both products Latte and Americano? [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Americano';


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: How many artists are there? [/INST]

Output: SELECT count(*) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of artists. [/INST]

Output: SELECT count(*) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the age of all music artists. [/INST]

Output: SELECT Age FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ages of all music artists? [/INST]

Output: SELECT Age FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average age of all artists? [/INST]

Output: SELECT avg(Age) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the average age across all artists. [/INST]

Output: SELECT avg(Age) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the famous titles of the artist "Triumfall"? [/INST]

Output: SELECT Famous_Title FROM artist WHERE Artist  =  "Triumfall";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the famous titles of the artist called "Triumfall". [/INST]

Output: SELECT Famous_Title FROM artist WHERE Artist  =  "Triumfall";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct Famous release dates? [/INST]

Output: SELECT distinct(Famous_Release_date) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Give the distinct famous release dates for all artists. [/INST]

Output: SELECT distinct(Famous_Release_date) FROM artist;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the dates of ceremony and the results of all music festivals [/INST]

Output: SELECT Date_of_ceremony ,  RESULT FROM music_festival;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the dates of ceremony and results for each music festival? [/INST]

Output: SELECT Date_of_ceremony ,  RESULT FROM music_festival;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the category of music festivals with result "Awarded"? [/INST]

Output: SELECT Category FROM music_festival WHERE RESULT  =  "Awarded";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the categories of music festivals that have the result "Awarded". [/INST]

Output: SELECT Category FROM music_festival WHERE RESULT  =  "Awarded";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum and minimum week on top of all volumes? [/INST]

Output: SELECT max(Weeks_on_Top) ,  min(Weeks_on_Top) FROM volume;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Give the maximum and minimum weeks on top across all volumes. [/INST]

Output: SELECT max(Weeks_on_Top) ,  min(Weeks_on_Top) FROM volume;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the songs in volumes with more than 1 week on top? [/INST]

Output: SELECT Song FROM volume WHERE Weeks_on_Top  >  1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Give the songs included in volumes that have more than 1 week on top. [/INST]

Output: SELECT Song FROM volume WHERE Weeks_on_Top  >  1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please list all songs in volumes in ascending alphabetical order. [/INST]

Output: SELECT Song FROM volume ORDER BY Song;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the the songs in volumes, listed in ascending order? [/INST]

Output: SELECT Song FROM volume ORDER BY Song;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: How many distinct artists do the volumes associate to? [/INST]

Output: SELECT COUNT(DISTINCT Artist_ID) FROM volume;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of distinct artists who have volumes. [/INST]

Output: SELECT COUNT(DISTINCT Artist_ID) FROM volume;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please show the date of ceremony of the volumes that last more than 2 weeks on top. [/INST]

Output: SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume  =  T2.Volume_ID WHERE T2.Weeks_on_Top  >  2;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the dates of ceremony at music festivals corresponding to volumes that lasted more than 2 weeks on top? [/INST]

Output: SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume  =  T2.Volume_ID WHERE T2.Weeks_on_Top  >  2;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please show the songs that have result "nominated" at music festivals. [/INST]

Output: SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume  =  T2.Volume_ID WHERE T1.Result  =  "Nominated";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the songs in volumes that have resulted in a nomination at music festivals? [/INST]

Output: SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume  =  T2.Volume_ID WHERE T1.Result  =  "Nominated";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the issue dates of volumes associated with the artist "Gorgoroth"? [/INST]

Output: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.Artist  =  "Gorgoroth";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the issue dates of volumes that are by the artist named Gorgoroth. [/INST]

Output: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.Artist  =  "Gorgoroth";


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the songs in volumes associated with the artist aged 32 or older? [/INST]

Output: SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.age  >=  32;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return names of songs in volumes that are by artists that are at least 32 years old. [/INST]

Output: SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.age  >=  32;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average weeks on top of volumes associated with the artist aged 25 or younger? [/INST]

Output: SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.age  <=  25;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the average number of weeks on top for volumes by artists that are at most 25 years old. [/INST]

Output: SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T1.age  <=  25;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the famous title of the artists associated with volumes with more than 2 weeks on top? [/INST]

Output: SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T2.Weeks_on_Top  >  2;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the famous titles for artists that have volumes that lasted more than 2 weeks on top. [/INST]

Output: SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T2.Weeks_on_Top  >  2;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please list the age and famous title of artists in descending order of age. [/INST]

Output: SELECT Famous_Title ,  Age FROM artist ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the famous titles and ages of each artist, listed in descending order by age? [/INST]

Output: SELECT Famous_Title ,  Age FROM artist ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the famous release date of the artist with the oldest age? [/INST]

Output: SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the famous release date for the oldest artist. [/INST]

Output: SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please show the categories of the music festivals and the count. [/INST]

Output: SELECT Category ,  COUNT(*) FROM music_festival GROUP BY Category;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the number of music festivals of each category. [/INST]

Output: SELECT Category ,  COUNT(*) FROM music_festival GROUP BY Category;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the most common result of the music festival? [/INST]

Output: SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the result that is most frequent at music festivals. [/INST]

Output: SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please show the categories of the music festivals with count more than 1. [/INST]

Output: SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*)  >  1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the categories of music festivals for which there have been more than 1 music festival? [/INST]

Output: SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*)  >  1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the song in the volume with the maximum weeks on top? [/INST]

Output: SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Return the song in the volume that has spent the most weeks on top? [/INST]

Output: SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Find the famous titles of artists that do not have any volume. [/INST]

Output: SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume);


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the famous titles of artists who do not have any volumes? [/INST]

Output: SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume);


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Artist [ TEXT ]
Age [ INT ]
Famous_Title [ TEXT ]
Famous_Release_date [ TEXT ]

volume :
Volume_ID [ INT ] primary_key
Volume_Issue [ TEXT ]
Issue_Date [ TEXT ]
Weeks_on_Top [ INT ]
Song [ TEXT ]
Artist_ID [ INT ] volume.Artist_ID = artist.Artist_ID

music_festival :
ID [ INT ] primary_key
Music_Festival [ TEXT ]
Date_of_ceremony [ TEXT ]
Category [ TEXT ]
Volume [ INT ] music_festival.Volume = volume.Volume_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top. [/INST]

Output: SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T2.Weeks_on_Top  >  2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID  =  T2.Artist_ID WHERE T2.Weeks_on_Top  <  2;