Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Find the prices of products which has never received a single complaint. [/INST]

Output: SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints);


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What are the prices of products that have never gotten a complaint? [/INST]

Output: SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints);


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What is the average price of the products for each category? [/INST]

Output: SELECT avg(product_price) ,  product_category_code FROM products GROUP BY product_category_code;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Return the average price of products that have each category code. [/INST]

Output: SELECT avg(product_price) ,  product_category_code FROM products GROUP BY product_category_code;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Find the last name of the staff member who processed the complaint of the cheapest product. [/INST]

Output: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id JOIN products AS t3 ON t2.product_id  =  t3.product_id ORDER BY t3.product_price LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What is the last name of the staff member in charge of the complaint on the product with the lowest price? [/INST]

Output: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id JOIN products AS t3 ON t2.product_id  =  t3.product_id ORDER BY t3.product_price LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Which complaint status has more than 3 records on file? [/INST]

Output: SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*)  >  3;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Return complaint status codes have more than 3 corresponding complaints? [/INST]

Output: SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*)  >  3;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Find the last name of the staff whose email address contains "wrau". [/INST]

Output: SELECT last_name FROM staff WHERE email_address LIKE "%wrau%";


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What are the last names of staff with email addressed containing the substring "wrau"? [/INST]

Output: SELECT last_name FROM staff WHERE email_address LIKE "%wrau%";


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: How many customers are there in the customer type with the most customers? [/INST]

Output: SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Count the number of customers that have the customer type that is most common. [/INST]

Output: SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What is the last name of the staff who has handled the first ever complaint? [/INST]

Output: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Return the last name of the staff member who handled the complaint with the earliest date raised. [/INST]

Output: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: How many distinct complaint type codes are there in the database? [/INST]

Output: SELECT count(DISTINCT complaint_type_code) FROM complaints;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

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

Output: SELECT count(DISTINCT complaint_type_code) FROM complaints;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Find the address line 1 and 2 of the customer with email "vbogisich@example.org". [/INST]

Output: SELECT address_line_1 ,  address_line_2 FROM customers WHERE email_address  =  "vbogisich@example.org";


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What are lines 1 and 2 of the addressed of the customer with the email "vbogisich@example.org"? [/INST]

Output: SELECT address_line_1 ,  address_line_2 FROM customers WHERE email_address  =  "vbogisich@example.org";


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Find the number of complaints with Product Failure type for each complaint status. [/INST]

Output: SELECT complaint_status_code ,  count(*) FROM complaints WHERE complaint_type_code  =  "Product Failure" GROUP BY complaint_status_code;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Of complaints with the type code "Product Failure", how many had each different status code? [/INST]

Output: SELECT complaint_status_code ,  count(*) FROM complaints WHERE complaint_type_code  =  "Product Failure" GROUP BY complaint_status_code;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: What is first names of the top 5 staff who have handled the greatest number of complaints? [/INST]

Output: SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Return the first names of the 5 staff members who have handled the most complaints. [/INST]

Output: SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Which state has the most customers? [/INST]

Output: SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1;


Input:
[INST] Here is a database schema:
Staff :
staff_id [ INT ] primary_key
gender [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_type_code [ TEXT ]
address_line_1 [ TEXT ]
address_line_2 [ TEXT ]
town_city [ TEXT ]
state [ TEXT ]
email_address [ TEXT ]
phone_number [ TEXT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
product_category_code [ TEXT ]
date_product_first_available [ TEXT ]
date_product_discontinued [ TEXT ]
product_name [ TEXT ]
product_description [ TEXT ]
product_price [ INT ]

Complaints :
complaint_id [ INT ]
product_id [ INT ] Complaints.product_id = Products.product_id
customer_id [ INT ] Complaints.customer_id = Customers.customer_id
complaint_outcome_code [ TEXT ]
complaint_status_code [ TEXT ]
complaint_type_code [ TEXT ]
date_complaint_raised [ TEXT ]
date_complaint_closed [ TEXT ]
staff_id [ INT ] Complaints.staff_id = Staff.staff_id

Please write me a SQL statement that answers the following question: Give the state that has the most customers. [/INST]

Output: SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

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

Output: SELECT count(*) FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

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

Output: SELECT count(*) FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the authors of submissions in ascending order of scores. [/INST]

Output: SELECT Author FROM submission ORDER BY Scores ASC;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Find the author for each submission and list them in ascending order of submission score. [/INST]

Output: SELECT Author FROM submission ORDER BY Scores ASC;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the authors of submissions and their colleges? [/INST]

Output: SELECT Author ,  College FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: For each submission, show the author and their affiliated college. [/INST]

Output: SELECT Author ,  College FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of authors from college "Florida" or "Temple" [/INST]

Output: SELECT Author FROM submission WHERE College  =  "Florida" OR College  =  "Temple";


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which authors with submissions are from college "Florida" or "Temple"? [/INST]

Output: SELECT Author FROM submission WHERE College  =  "Florida" OR College  =  "Temple";


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

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

Output: SELECT avg(Scores) FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Compute the average score of submissions. [/INST]

Output: SELECT avg(Scores) FROM submission;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What is the author of the submission with the highest score? [/INST]

Output: SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Find the author who achieved the highest score in a submission. [/INST]

Output: SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show different colleges along with the number of authors of submission from each college. [/INST]

Output: SELECT College ,  COUNT(*) FROM submission GROUP BY College;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: For each college, return the college name and the count of authors with submissions from that college. [/INST]

Output: SELECT College ,  COUNT(*) FROM submission GROUP BY College;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the most common college of authors of submissions. [/INST]

Output: SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which college has the most authors with submissions? [/INST]

Output: SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80. [/INST]

Output: SELECT College FROM submission WHERE Scores  >  90 INTERSECT SELECT College FROM submission WHERE Scores  <  80;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which colleges have both authors with submission score above 90 and authors with submission score below 80? [/INST]

Output: SELECT College FROM submission WHERE Scores  >  90 INTERSECT SELECT College FROM submission WHERE Scores  <  80;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the authors of submissions and the acceptance results of their submissions. [/INST]

Output: SELECT T2.Author ,  T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: For each submission, find its author and acceptance result. [/INST]

Output: SELECT T2.Author ,  T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the result of the submission with the highest score. [/INST]

Output: SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which submission received the highest score in acceptance result. Show me the result. [/INST]

Output: SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show each author and the number of workshops they submitted to. [/INST]

Output: SELECT T2.Author ,  COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID GROUP BY T2.Author;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: How many workshops did each author submit to? Return the author name and the number of workshops. [/INST]

Output: SELECT T2.Author ,  COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID GROUP BY T2.Author;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the authors who have submissions to more than one workshop. [/INST]

Output: SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id)  >  1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which authors have submitted to more than one workshop? [/INST]

Output: SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID  =  T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id)  >  1;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the date and venue of each workshop in ascending alphabetical order of the venue. [/INST]

Output: SELECT Date ,  Venue FROM workshop ORDER BY Venue;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop. [/INST]

Output: SELECT Date ,  Venue FROM workshop ORDER BY Venue;


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the authors who do not have submission to any workshop. [/INST]

Output: SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance);


Input:
[INST] Here is a database schema:
workshop :
Workshop_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]

submission :
Submission_ID [ INT ] primary_key
Scores [ INT ]
Author [ TEXT ]
College [ TEXT ]

Acceptance :
Submission_ID [ INT ] primary_key Acceptance.Submission_ID = submission.Submission_ID
Workshop_ID [ INT ] Acceptance.Workshop_ID = workshop.Workshop_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Which authors did not submit to any workshop? [/INST]

Output: SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance);


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Find the number of investors in total. [/INST]

Output: SELECT count(*) FROM INVESTORS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show all investor details. [/INST]

Output: SELECT Investor_details FROM INVESTORS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show all distinct lot details. [/INST]

Output: SELECT DISTINCT lot_details FROM LOTS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the maximum amount of transaction. [/INST]

Output: SELECT max(amount_of_transaction) FROM TRANSACTIONS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show all date and share count of transactions. [/INST]

Output: SELECT date_of_transaction ,  share_count FROM TRANSACTIONS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: What is the total share of transactions? [/INST]

Output: SELECT sum(share_count) FROM TRANSACTIONS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show all transaction ids with transaction code 'PUR'. [/INST]

Output: SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code  =  'PUR';


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show all dates of transactions whose type code is "SALE". [/INST]

Output: SELECT date_of_transaction FROM TRANSACTIONS WHERE transaction_type_code  =  "SALE";


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average amount of transactions with type code "SALE". [/INST]

Output: SELECT avg(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code  =  "SALE";


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the description of transaction type with code "PUR". [/INST]

Output: SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code	  =  "PUR";


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the minimum amount of transactions whose type code is "PUR" and whose share count is bigger than 50. [/INST]

Output: SELECT min(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code  =  "PUR" AND share_count  >  50;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the maximum share count of transactions where the amount is smaller than 10000 [/INST]

Output: SELECT max(share_count) FROM TRANSACTIONS WHERE amount_of_transaction  <  10000;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000. [/INST]

Output: SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count  >  100 OR amount_of_transaction  >  1000;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the transaction type descriptions and dates if the share count is smaller than 10. [/INST]

Output: SELECT T1.transaction_type_description ,  T2.date_of_transaction FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code  =  T2.transaction_type_code WHERE T2.share_count  <  10;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show details of all investors if they make any transaction with share count greater than 100. [/INST]

Output: SELECT T1.Investor_details FROM  INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id  =  T2.investor_id WHERE T2.share_count  >  100;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: How many distinct transaction types are used in the transactions? [/INST]

Output: SELECT COUNT(DISTINCT transaction_type_code) FROM TRANSACTIONS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Return the lot details and investor ids. [/INST]

Output: SELECT lot_details ,  investor_id FROM LOTS;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Return the lot details of lots that belong to investors with details "l"? [/INST]

Output: SELECT T2.lot_details FROM INVESTORS AS T1 JOIN LOTS AS T2 ON  T1.investor_id  =  T2.investor_id WHERE T1.Investor_details  =  "l";


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: What are the purchase details of transactions with amount bigger than 10000? [/INST]

Output: SELECT T1.purchase_details FROM PURCHASES AS T1 JOIN TRANSACTIONS AS T2 ON T1.purchase_transaction_id  =  T2.transaction_id WHERE T2.amount_of_transaction  >  10000;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: What are the sale details and dates of transactions with amount smaller than 3000? [/INST]

Output: SELECT T1.sales_details ,  T2.date_of_transaction FROM SALES AS T1 JOIN TRANSACTIONS AS T2 ON T1.sales_transaction_id  =  T2.transaction_id WHERE T2.amount_of_transaction  <  3000;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: What are the lot details of lots associated with transactions with share count smaller than 50? [/INST]

Output: SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id  =  T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id  =  T3.transaction_id WHERE T3.share_count  <  50;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: What are the lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is "PUR"? [/INST]

Output: SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON  T1.lot_id  =  T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id  =  T3.transaction_id WHERE T3.share_count  >  100 AND T3.transaction_type_code  =  "PUR";


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average transaction amount for different transaction types. [/INST]

Output: SELECT transaction_type_code ,  avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY transaction_type_code;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the maximum and minimum share count of different transaction types. [/INST]

Output: SELECT transaction_type_code ,  max(share_count) ,  min(share_count) FROM TRANSACTIONS GROUP BY transaction_type_code;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average share count of transactions for different investors. [/INST]

Output: SELECT investor_id ,  avg(share_count) FROM TRANSACTIONS GROUP BY investor_id;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average share count of transactions each each investor, ordered by average share count. [/INST]

Output: SELECT investor_id ,  avg(share_count) FROM TRANSACTIONS GROUP BY investor_id ORDER BY avg(share_count);


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average amount of transactions for different investors. [/INST]

Output: SELECT investor_id ,  avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY investor_id;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average amount of transactions for different lots. [/INST]

Output: SELECT T2.lot_id ,  avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id  =  T2.transaction_id GROUP BY T2.lot_id;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the average amount of transactions for different lots, ordered by average amount of transactions. [/INST]

Output: SELECT T2.lot_id ,  avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id  =  T2.transaction_id GROUP BY T2.lot_id ORDER BY avg(amount_of_transaction);


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the number of transactions with transaction type code "SALE" for different investors if it is larger than 0. [/INST]

Output: SELECT investor_id ,  COUNT(*) FROM TRANSACTIONS WHERE transaction_type_code  =  "SALE" GROUP BY investor_id;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the number of transactions for different investors. [/INST]

Output: SELECT investor_id ,  COUNT(*) FROM TRANSACTIONS GROUP BY investor_id;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the transaction type code that occurs the fewest times. [/INST]

Output: SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the transaction type code that occurs the most frequently. [/INST]

Output: SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the description of the transaction type that occurs most frequently. [/INST]

Output: SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code  =  T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the id and details of the investor that has the largest number of transactions. [/INST]

Output: SELECT T2.investor_id ,  T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id  =  T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Investors :
investor_id [ INT ] primary_key
Investor_details [ TEXT ]

Lots :
lot_id [ INT ] primary_key
investor_id [ INT ] Lots.investor_id = Investors.investor_id
lot_details [ TEXT ]

Ref_Transaction_Types :
transaction_type_code [ TEXT ] primary_key
transaction_type_description [ TEXT ]

Transactions :
transaction_id [ INT ] primary_key
investor_id [ INT ] Transactions.investor_id = Investors.investor_id
transaction_type_code [ TEXT ] Transactions.transaction_type_code = Ref_Transaction_Types.transaction_type_code
date_of_transaction [ TEXT ]
amount_of_transaction [ INT ]
share_count [ TEXT ]
other_details [ TEXT ]

Sales :
sales_transaction_id [ INT ] primary_key Sales.sales_transaction_id = Transactions.transaction_id
sales_details [ TEXT ]

Purchases :
purchase_transaction_id [ INT ] Purchases.purchase_transaction_id = Transactions.transaction_id
purchase_details [ TEXT ]

Transactions_Lots :
transaction_id [ INT ] Transactions_Lots.transaction_id = Transactions.transaction_id
lot_id [ INT ] Transactions_Lots.lot_id = Lots.lot_id

Please write me a SQL statement that answers the following question: Show the id and details for the investors who have the top 3 number of transactions. [/INST]

Output: SELECT T2.investor_id ,  T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id  =  T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3;