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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

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

Output: SELECT count(*) FROM Customers;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List all customer status codes and the number of customers having each status code. [/INST]

Output: SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: For each customer status code, how many customers are classified that way? [/INST]

Output: SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: Which customer status code has least number of customers? [/INST]

Output: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the status code with the least number of customers? [/INST]

Output: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons did the customer Ryan Goodwin complete? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is maximum, minimum and average amount of outstanding of customer? [/INST]

Output: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the maximum, minimum, and average amount of money outsanding for all customers? [/INST]

Output: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List the first name and last name of customers have the amount of outstanding between 1000 and 3000. [/INST]

Output: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What are the first and last names of all customers with between 1000 and 3000 dollars outstanding? [/INST]

Output: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List first name and last name of customers lived in city Lockmanfurt. [/INST]

Output: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What are the first and last names of all customers who lived in Lockmanfurt? [/INST]

Output: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: Which country does customer with first name as Carole and last name as Bernhard lived in? [/INST]

Output: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the country in which the customer Carole Bernhard lived? [/INST]

Output: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is zip code of customer with first name as Carole and last name as Bernhard? [/INST]

Output: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the zip code of the customer Carole Bernhard? [/INST]

Output: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

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

Output: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the city with the most customers? [/INST]

Output: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How much in total does customer with first name as Carole and last name as Bernhard paid? [/INST]

Output: SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the total amount of moeny paid by the customer Carole Bernhard? [/INST]

Output: SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List the number of customers that did not have any payment history. [/INST]

Output: SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many customers have no payment histories? [/INST]

Output: SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List first name and last name of customers that have more than 2 payments. [/INST]

Output: SELECT T2.first_name ,  T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >  2;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What are the first and last names of all customers with more than 2 payments? [/INST]

Output: SELECT T2.first_name ,  T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >  2;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List all payment methods and number of payments using each payment methods. [/INST]

Output: SELECT payment_method_code ,  count(*) FROM Customer_Payments GROUP BY payment_method_code;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: For each payment method, how many payments were made? [/INST]

Output: SELECT payment_method_code ,  count(*) FROM Customer_Payments GROUP BY payment_method_code;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons were in cancelled state? [/INST]

Output: SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons have been cancelled? [/INST]

Output: SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'. [/INST]

Output: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s? [/INST]

Output: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons taught by staff whose first name has letter 'a' in it? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons were taught by a staff member whose first name has the letter 'a' in it? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn? [/INST]

Output: SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the total time for all lessons taught by Janessa Sawayn? [/INST]

Output: SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is average lesson price taught by staff with first name as Janessa and last name as Sawayn? [/INST]

Output: SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the average price for a lesson taught by Janessa Sawayn? [/INST]

Output: SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lesson does customer with first name Ray took? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Ray";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: How many lessons did the customer with the first name Ray take? [/INST]

Output: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Ray";


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: Which last names are both used by customers and by staff? [/INST]

Output: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What are the last names that are used by customers and staff? [/INST]

Output: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the first name of the staff who did not give any lesson? [/INST]

Output: SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id  =  T2.staff_id;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the first name of all employees who do not give any lessons? [/INST]

Output: SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id  =  T2.staff_id;


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

Staff :
staff_id [ INT ] primary_key
staff_address_id [ INT ] Staff.staff_address_id = Addresses.address_id
nickname [ TEXT ]
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
date_of_birth [ TEXT ]
date_joined_staff [ TEXT ]
date_left_staff [ TEXT ]

Vehicles :
vehicle_id [ INT ] primary_key
vehicle_details [ TEXT ]

Customers :
customer_id [ INT ] primary_key
customer_address_id [ INT ] Customers.customer_address_id = Addresses.address_id
customer_status_code [ TEXT ]
date_became_customer [ TEXT ]
date_of_birth [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
amount_outstanding [ INT ]
email_address [ TEXT ]
phone_number [ TEXT ]
cell_mobile_phone_number [ TEXT ]

Customer_Payments :
customer_id [ INT ] primary_key Customer_Payments.customer_id = Customers.customer_id
datetime_payment [ TEXT ]
payment_method_code [ TEXT ]
amount_payment [ INT ]

Lessons :
lesson_id [ INT ] primary_key
customer_id [ INT ] Lessons.customer_id = Customers.customer_id
lesson_status_code [ TEXT ]
staff_id [ INT ] Lessons.staff_id = Staff.staff_id
vehicle_id [ INT ] Lessons.vehicle_id = Vehicles.vehicle_id
lesson_date [ TEXT ]
lesson_time [ TEXT ]
price [ INT ]

Please write me a SQL statement that answers the following question: What is the id and detail of the vehicle used in lessons for most of the times? [/INST]

Output: SELECT T1.vehicle_id ,  T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id  =  T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many faculty do we have? [/INST]

Output: SELECT count(*) FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

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

Output: SELECT count(*) FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What ranks do we have for faculty? [/INST]

Output: SELECT DISTINCT rank FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Find the list of distinct ranks for faculty. [/INST]

Output: SELECT DISTINCT rank FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the distinct buildings that have faculty rooms. [/INST]

Output: SELECT DISTINCT building FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What buildings have faculty offices? [/INST]

Output: SELECT DISTINCT building FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show the rank, first name, and last name for all the faculty. [/INST]

Output: SELECT rank ,  Fname ,  Lname FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What are the rank, first name, and last name of the faculty members? [/INST]

Output: SELECT rank ,  Fname ,  Lname FROM Faculty;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show the first name, last name, and phone number for all female faculty members. [/INST]

Output: SELECT Fname ,  Lname ,  phone FROM Faculty WHERE Sex  =  'F';


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What are the first name, last name, and phone number of all the female faculty members? [/INST]

Output: SELECT Fname ,  Lname ,  phone FROM Faculty WHERE Sex  =  'F';


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show ids for all the male faculty. [/INST]

Output: SELECT FacID FROM Faculty WHERE Sex  =  'M';


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What are the faculty ids of all the male faculty members? [/INST]

Output: SELECT FacID FROM Faculty WHERE Sex  =  'M';


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many female Professors do we have? [/INST]

Output: SELECT count(*) FROM Faculty WHERE Sex  =  'F' AND Rank  =  "Professor";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

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

Output: SELECT count(*) FROM Faculty WHERE Sex  =  'F' AND Rank  =  "Professor";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show the phone, room, and building for the faculty named Jerry Prince. [/INST]

Output: SELECT phone ,  room ,  building FROM Faculty WHERE Fname  =  "Jerry" AND Lname  =  "Prince";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What are the phone, room, and building of the faculty member called Jerry Prince? [/INST]

Output: SELECT phone ,  room ,  building FROM Faculty WHERE Fname  =  "Jerry" AND Lname  =  "Prince";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many Professors are in building NEB? [/INST]

Output: SELECT count(*) FROM Faculty WHERE Rank  =  "Professor" AND building  =  "NEB";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of Professors who have office in building NEB. [/INST]

Output: SELECT count(*) FROM Faculty WHERE Rank  =  "Professor" AND building  =  "NEB";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show the first name and last name for all the instructors. [/INST]

Output: SELECT fname ,  lname FROM Faculty WHERE Rank  =  "Instructor";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: What are the first name and last name of all the instructors? [/INST]

Output: SELECT fname ,  lname FROM Faculty WHERE Rank  =  "Instructor";


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the buildings along with the number of faculty members the buildings have. [/INST]

Output: SELECT building ,  count(*) FROM Faculty GROUP BY building;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many faculty members does each building have? List the result with the name of the building. [/INST]

Output: SELECT building ,  count(*) FROM Faculty GROUP BY building;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

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

Output: SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Find the building that has the largest number of faculty members. [/INST]

Output: SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the buildings that have at least 10 professors. [/INST]

Output: SELECT building FROM Faculty WHERE rank  =  "Professor" GROUP BY building HAVING count(*)  >=  10;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: In which buildings are there at least ten professors? [/INST]

Output: SELECT building FROM Faculty WHERE rank  =  "Professor" GROUP BY building HAVING count(*)  >=  10;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: For each faculty rank, show the number of faculty members who have it. [/INST]

Output: SELECT rank ,  count(*) FROM Faculty GROUP BY rank;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many faculty members do we have for each faculty rank? [/INST]

Output: SELECT rank ,  count(*) FROM Faculty GROUP BY rank;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the ranks and the number of male and female faculty for each rank. [/INST]

Output: SELECT rank ,  sex ,  count(*) FROM Faculty GROUP BY rank ,  sex;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: How many faculty members do we have for each rank and gender? [/INST]

Output: SELECT rank ,  sex ,  count(*) FROM Faculty GROUP BY rank ,  sex;


Input:
[INST] Here is a database schema:
Activity :
actid [ INT ] primary_key
activity_name [ TEXT ]

Participates_in :
stuid [ INT ] Participates_in.stuid = Student.StuID
actid [ INT ] Participates_in.actid = Activity.actid

Faculty_Participates_in :
FacID [ INT ] Faculty_Participates_in.FacID = Faculty.FacID
actid [ INT ] Faculty_Participates_in.actid = Activity.actid

Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Faculty :
FacID [ INT ] primary_key
Lname [ TEXT ]
Fname [ TEXT ]
Rank [ TEXT ]
Sex [ TEXT ]
Phone [ INT ]
Room [ TEXT ]
Building [ TEXT ]

Please write me a SQL statement that answers the following question: Which rank has the smallest number of faculty members? [/INST]

Output: SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1;