Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: Give me the title and highest price for each film. [/INST]

Output: SELECT T2.title ,  max(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id  =  T2.film_id GROUP BY T1.film_id;


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: Show cinema name, film title, date, and price for each record in schedule. [/INST]

Output: SELECT T3.name ,  T2.title ,  T1.date ,  T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id  =  T2.film_id JOIN cinema AS T3 ON T1.cinema_id  =  T3.cinema_id;


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: What are the title and director of the films without any schedule? [/INST]

Output: SELECT title ,  directed_by FROM film WHERE film_id NOT IN (SELECT film_id FROM schedule);


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: Show director with the largest number of show times in total. [/INST]

Output: SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id  =  T2.film_id GROUP BY T2.directed_by ORDER BY sum(T1.show_times_per_day) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: Find the locations that have more than one movie theater with capacity above 300. [/INST]

Output: SELECT LOCATION FROM cinema WHERE capacity  >  300 GROUP BY LOCATION HAVING count(*)  >  1;


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: In which locations are there more than one movie theater with capacity above 300? [/INST]

Output: SELECT LOCATION FROM cinema WHERE capacity  >  300 GROUP BY LOCATION HAVING count(*)  >  1;


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: How many films have the word 'Dummy' in their titles? [/INST]

Output: SELECT count(*) FROM film WHERE title LIKE "%Dummy%";


Input:
[INST] Here is a database schema:
film :
Film_ID [ INT ] primary_key
Rank_in_series [ INT ]
Number_in_season [ INT ]
Title [ TEXT ]
Directed_by [ TEXT ]
Original_air_date [ TEXT ]
Production_code [ TEXT ]

cinema :
Cinema_ID [ INT ] primary_key
Name [ TEXT ]
Openning_year [ INT ]
Capacity [ INT ]
Location [ TEXT ]

schedule :
Cinema_ID [ INT ] primary_key schedule.Cinema_ID = cinema.Cinema_ID
Film_ID [ INT ] schedule.Film_ID = film.Film_ID
Date [ TEXT ]
Show_times_per_day [ INT ]
Price [ INT ]

Please write me a SQL statement that answers the following question: Count the number of films whose title contains the word 'Dummy'. [/INST]

Output: SELECT count(*) FROM film WHERE title LIKE "%Dummy%";


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: Are the customers holding coupons with amount 500 bad or good? [/INST]

Output: SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id  =  T2.coupon_id WHERE T2.coupon_amount  =  500;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: How many bookings did each customer make? List the customer id, first name, and the count. [/INST]

Output: SELECT T1.customer_id ,  T1.first_name ,  count(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum total amount paid by a customer? List the customer id and amount. [/INST]

Output: SELECT customer_id ,  sum(amount_paid) FROM Payments GROUP BY customer_id ORDER BY sum(amount_paid) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the id and the amount of refund of the booking that incurred the most times of payments? [/INST]

Output: SELECT T1.booking_id ,  T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id  =  T2.booking_id GROUP BY T1.booking_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the product that is booked for 3 times? [/INST]

Output: SELECT product_id FROM products_booked GROUP BY product_id HAVING count(*)  =  3;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What is the product description of the product booked with an amount of 102.76? [/INST]

Output: SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id  =  T2.product_id WHERE T1.booked_amount  =  102.76;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the start date and end date of the booking that has booked the product named 'Book collection A'? [/INST]

Output: SELECT T3.booking_start_date ,   T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id  =  T2.product_id JOIN bookings AS T3 ON T2.booking_id  =  T3.booking_id WHERE T1.product_name  =  'Book collection A';


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of products whose availability equals to 1? [/INST]

Output: SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id  =  T2.product_id WHERE T1.available_yn  =  1;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

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

Output: SELECT count(DISTINCT product_type_code) FROM products_for_hire;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the first name, last name, and gender of all the good customers? Order by their last name. [/INST]

Output: SELECT first_name ,  last_name ,  gender_mf FROM customers WHERE good_or_bad_customer  =  'good' ORDER BY last_name;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average amount due for all the payments? [/INST]

Output: SELECT avg(amount_due) FROM payments;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum, minimum, and average booked count for the products booked? [/INST]

Output: SELECT max(booked_count) ,  min(booked_count) ,  avg(booked_count) FROM products_booked;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are all the distinct payment types? [/INST]

Output: SELECT DISTINCT payment_type_code FROM payments;


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the daily hire costs for the products with substring 'Book' in its name? [/INST]

Output: SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%';


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: How many products are never booked with amount higher than 200? [/INST]

Output: SELECT count(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount  >  200 );


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the coupon amount of the coupons owned by both good and bad customers? [/INST]

Output: SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id  =  T2.coupon_id WHERE T2.good_or_bad_customer  =  'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id  =  T2.coupon_id WHERE T2.good_or_bad_customer  =  'bad';


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check' [/INST]

Output: SELECT payment_date FROM payments WHERE amount_paid  >  300 OR payment_type_code  =  'Check';


Input:
[INST] Here is a database schema:
Discount_Coupons :
coupon_id [ INT ] primary_key
date_issued [ TEXT ]
coupon_amount [ INT ]

Customers :
customer_id [ INT ] primary_key
coupon_id [ INT ] Customers.coupon_id = Discount_Coupons.coupon_id
good_or_bad_customer [ TEXT ]
first_name [ TEXT ]
last_name [ TEXT ]
gender_mf [ TEXT ]
date_became_customer [ TEXT ]
date_last_hire [ TEXT ]

Bookings :
booking_id [ INT ] primary_key
customer_id [ INT ] Bookings.customer_id = Customers.customer_id
booking_status_code [ TEXT ]
returned_damaged_yn [ TEXT ]
booking_start_date [ TEXT ]
booking_end_date [ TEXT ]
count_hired [ TEXT ]
amount_payable [ INT ]
amount_of_discount [ INT ]
amount_outstanding [ INT ]
amount_of_refund [ INT ]

Products_for_Hire :
product_id [ INT ] primary_key
product_type_code [ TEXT ]
daily_hire_cost [ INT ]
product_name [ TEXT ]
product_description [ TEXT ]

Payments :
payment_id [ INT ] primary_key
booking_id [ INT ] Payments.booking_id = Bookings.booking_id
customer_id [ INT ] Payments.customer_id = Customers.customer_id
payment_type_code [ TEXT ]
amount_paid_in_full_yn [ TEXT ]
payment_date [ TEXT ]
amount_due [ INT ]
amount_paid [ INT ]

Products_Booked :
booking_id [ INT ] primary_key Products_Booked.booking_id = Bookings.booking_id
product_id [ INT ] Products_Booked.product_id = Products_for_Hire.product_id
returned_yn [ TEXT ]
returned_late_yn [ TEXT ]
booked_count [ INT ]
booked_amount [ INT ]

View_Product_Availability :
product_id [ INT ] View_Product_Availability.product_id = Products_for_Hire.product_id
booking_id [ INT ] View_Product_Availability.booking_id = Bookings.booking_id
status_date [ TEXT ] primary_key
available_yn [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20? [/INST]

Output: SELECT product_name ,  product_description FROM products_for_hire WHERE product_type_code  =  'Cutlery' AND daily_hire_cost  <  20;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

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

Output: SELECT count(*) FROM phone;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: List the names of phones in ascending order of price. [/INST]

Output: SELECT Name FROM phone ORDER BY Price ASC;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: What are the memories and carriers of phones? [/INST]

Output: SELECT Memory_in_G ,  Carrier FROM phone;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: List the distinct carriers of phones with memories bigger than 32. [/INST]

Output: SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G  >  32;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the names of phones with carrier either "Sprint" or "TMobile". [/INST]

Output: SELECT Name FROM phone WHERE Carrier  =  "Sprint" OR Carrier  =  "TMobile";


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: What is the carrier of the most expensive phone? [/INST]

Output: SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show different carriers of phones together with the number of phones with each carrier. [/INST]

Output: SELECT Carrier ,  COUNT(*) FROM phone GROUP BY Carrier;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the most frequently used carrier of the phones. [/INST]

Output: SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64. [/INST]

Output: SELECT Carrier FROM phone WHERE Memory_in_G  <  32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G  >  64;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the names of phones and the districts of markets they are on. [/INST]

Output: SELECT T3.Name ,  T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID  =  T3.Phone_ID;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market. [/INST]

Output: SELECT T3.Name ,  T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID  =  T3.Phone_ID ORDER BY T2.Ranking;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the names of phones that are on market with number of shops greater than 50. [/INST]

Output: SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID  =  T3.Phone_ID WHERE T2.Num_of_shops  >  50;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: For each phone, show its names and total number of stocks. [/INST]

Output: SELECT T2.Name ,  sum(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID  =  T2.Phone_ID GROUP BY T2.Name;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks. [/INST]

Output: SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID  =  T2.Phone_ID GROUP BY T2.Name HAVING sum(T1.Num_of_stock)  >=  2000 ORDER BY sum(T1.Num_of_stock) DESC;


Input:
[INST] Here is a database schema:
phone :
Name [ TEXT ]
Phone_ID [ INT ] primary_key
Memory_in_G [ INT ]
Carrier [ TEXT ]
Price [ INT ]

market :
Market_ID [ INT ] primary_key
District [ TEXT ]
Num_of_employees [ INT ]
Num_of_shops [ INT ]
Ranking [ INT ]

phone_market :
Market_ID [ INT ] primary_key phone_market.Market_ID = market.Market_ID
Phone_ID [ TEXT ] phone_market.Phone_ID = phone.Phone_ID
Num_of_stock [ INT ]

Please write me a SQL statement that answers the following question: List the names of phones that are not on any market. [/INST]

Output: SELECT Name FROM phone WHERE Phone_id NOT IN (SELECT Phone_ID FROM phone_market);


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

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

Output: SELECT count(*) FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

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

Output: SELECT count(*) FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: List the company name and rank for all companies in the decreasing order of their sales. [/INST]

Output: SELECT company ,  rank FROM company ORDER BY Sales_billion DESC;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What is the name and rank of every company ordered by descending number of sales? [/INST]

Output: SELECT company ,  rank FROM company ORDER BY Sales_billion DESC;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show the company name and the main industry for all companies whose headquarters are not from USA. [/INST]

Output: SELECT company ,  main_industry FROM company WHERE headquarters != 'USA';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the companies and main industries of all companies that are not headquartered in the United States? [/INST]

Output: SELECT company ,  main_industry FROM company WHERE headquarters != 'USA';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all company names and headquarters in the descending order of market value. [/INST]

Output: SELECT company ,  headquarters FROM company ORDER BY market_value DESC;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the names and headquarters of all companies ordered by descending market value? [/INST]

Output: SELECT company ,  headquarters FROM company ORDER BY market_value DESC;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show minimum, maximum, and average market value for all companies. [/INST]

Output: SELECT min(market_value) ,  max(market_value) ,  avg(market_value) FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What is the minimum, maximum, and average market value for every company? [/INST]

Output: SELECT min(market_value) ,  max(market_value) ,  avg(market_value) FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all main industry for all companies. [/INST]

Output: SELECT DISTINCT main_industry FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the different main industries for all companies? [/INST]

Output: SELECT DISTINCT main_industry FROM company;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: List all headquarters and the number of companies in each headquarter. [/INST]

Output: SELECT headquarters ,  count(*) FROM company GROUP BY headquarters;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: For each headquarter, what are the headquarter and how many companies are centered there? [/INST]

Output: SELECT headquarters ,  count(*) FROM company GROUP BY headquarters;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all main industry and total market value in each industry. [/INST]

Output: SELECT main_industry ,  sum(market_value) FROM company GROUP BY main_industry;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the main indstries and total market value for each industry? [/INST]

Output: SELECT main_industry ,  sum(market_value) FROM company GROUP BY main_industry;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: List the main industry with highest total market value and its number of companies. [/INST]

Output: SELECT main_industry ,  count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: For each main industry, what is the total number of companies for the industry with the highest total market value? [/INST]

Output: SELECT main_industry ,  count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show headquarters with at least two companies in the banking industry. [/INST]

Output: SELECT headquarters FROM company WHERE main_industry  =  'Banking' GROUP BY headquarters HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the headquarters with at least two companies in the banking industry? [/INST]

Output: SELECT headquarters FROM company WHERE main_industry  =  'Banking' GROUP BY headquarters HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show gas station id, location, and manager_name for all gas stations ordered by open year. [/INST]

Output: SELECT station_id ,  LOCATION ,  manager_name FROM gas_station ORDER BY open_year;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the gas station ids, locations, and manager names for the gas stations ordered by opening year? [/INST]

Output: SELECT station_id ,  LOCATION ,  manager_name FROM gas_station ORDER BY open_year;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: How many gas station are opened between 2000 and 2005? [/INST]

Output: SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of gas stations that opened between 2000 and 2005? [/INST]

Output: SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all locations and the number of gas stations in each location ordered by the count. [/INST]

Output: SELECT LOCATION ,  count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*);


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: For each location, how many gas stations are there in order? [/INST]

Output: SELECT LOCATION ,  count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*);


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all headquarters with both a company in banking industry and a company in Oil and gas. [/INST]

Output: SELECT headquarters FROM company WHERE main_industry  =  'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry  =  'Oil and gas';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the headquarters that have both a company in the banking and 'oil and gas' industries? [/INST]

Output: SELECT headquarters FROM company WHERE main_industry  =  'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry  =  'Oil and gas';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all headquarters without a company in banking industry. [/INST]

Output: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry  =  'Banking';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the headquarters without companies that are in the banking industry? [/INST]

Output: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry  =  'Banking';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show the company name with the number of gas station. [/INST]

Output: SELECT T2.company ,  count(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id GROUP BY T1.company_id;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: For each company id, what are the companies and how many gas stations does each one operate? [/INST]

Output: SELECT T2.company ,  count(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id GROUP BY T1.company_id;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show company name and main industry without a gas station. [/INST]

Output: SELECT company ,  main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company);


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the main industries of the companies without gas stations and what are the companies? [/INST]

Output: SELECT company ,  main_industry FROM company WHERE company_id NOT IN (SELECT company_id FROM station_company);


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show the manager name for gas stations belonging to the ExxonMobil company. [/INST]

Output: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id WHERE T2.company  =  'ExxonMobil';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the managers for gas stations that are operated by the ExxonMobil company? [/INST]

Output: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id WHERE T2.company  =  'ExxonMobil';


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show all locations where a gas station for company with market value greater than 100 is located. [/INST]

Output: SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id WHERE T2.market_value  >  100;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the locations that have gas stations owned by a company with a market value greater than 100? [/INST]

Output: SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id WHERE T2.market_value  >  100;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: Show the manager name with most number of gas stations opened after 2000. [/INST]

Output: SELECT manager_name FROM gas_station WHERE open_year  >  2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the manager with the most gas stations that opened after 2000? [/INST]

Output: SELECT manager_name FROM gas_station WHERE open_year  >  2000 GROUP BY manager_name ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: order all gas station locations by the opening year. [/INST]

Output: SELECT LOCATION FROM gas_station ORDER BY open_year;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the locations of all the gas stations ordered by opening year? [/INST]

Output: SELECT LOCATION FROM gas_station ORDER BY open_year;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion. [/INST]

Output: SELECT rank ,  company ,  market_value FROM company WHERE main_industry  =  'Banking' ORDER BY sales_billion ,  profits_billion;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What is the rank, company, and market value of every comapny in the banking industry ordered by sales and profits? [/INST]

Output: SELECT rank ,  company ,  market_value FROM company WHERE main_industry  =  'Banking' ORDER BY sales_billion ,  profits_billion;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts. [/INST]

Output: SELECT T3.location ,  T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3;


Input:
[INST] Here is a database schema:
company :
Company_ID [ INT ] primary_key
Rank [ INT ]
Company [ TEXT ]
Headquarters [ TEXT ]
Main_Industry [ TEXT ]
Sales_billion [ INT ]
Profits_billion [ INT ]
Assets_billion [ INT ]
Market_Value [ INT ]

gas_station :
Station_ID [ INT ] primary_key
Open_Year [ INT ]
Location [ TEXT ]
Manager_Name [ TEXT ]
Vice_Manager_Name [ TEXT ]
Representative_Name [ TEXT ]

station_company :
Station_ID [ INT ] primary_key station_company.Station_ID = gas_station.Station_ID
Company_ID [ INT ] station_company.Company_ID = company.Company_ID
Rank_of_the_Year [ INT ]

Please write me a SQL statement that answers the following question: What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets? [/INST]

Output: SELECT T3.location ,  T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id  =  T2.company_id JOIN gas_station AS T3 ON T1.station_id  =  T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

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

Output: SELECT count(*) FROM region;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

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

Output: SELECT count(*) FROM region;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

Please write me a SQL statement that answers the following question: Show all distinct region names ordered by their labels. [/INST]

Output: SELECT DISTINCT region_name FROM region ORDER BY Label;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

Please write me a SQL statement that answers the following question: What are the different region names, ordered by labels? [/INST]

Output: SELECT DISTINCT region_name FROM region ORDER BY Label;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

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

Output: SELECT count(DISTINCT party_name) FROM party;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

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

Output: SELECT count(DISTINCT party_name) FROM party;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

Please write me a SQL statement that answers the following question: Show the ministers and the time they took and left office, listed by the time they left office. [/INST]

Output: SELECT minister ,  took_office ,  left_office FROM party ORDER BY left_office;


Input:
[INST] Here is a database schema:
region :
Region_ID [ INT ] primary_key
Region_name [ TEXT ]
Date [ TEXT ]
Label [ TEXT ]
Format [ TEXT ]
Catalogue [ TEXT ]

party :
Party_ID [ INT ] primary_key
Minister [ TEXT ]
Took_office [ TEXT ]
Left_office [ TEXT ]
Region_ID [ INT ] party.Region_ID = region.Region_ID
Party_name [ TEXT ]

member :
Member_ID [ INT ] primary_key
Member_Name [ TEXT ]
Party_ID [ TEXT ] member.Party_ID = party.Party_ID
In_office [ TEXT ]

party_events :
Event_ID [ INT ] primary_key
Event_Name [ TEXT ]
Party_ID [ INT ] party_events.Party_ID = party.Party_ID
Member_in_charge_ID [ INT ] party_events.Member_in_charge_ID = member.Member_ID

Please write me a SQL statement that answers the following question: Who are the ministers, when did they take office, and when did they leave office, ordered by when they left office? [/INST]

Output: SELECT minister ,  took_office ,  left_office FROM party ORDER BY left_office;