Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of festivals that have nominated artworks of type "Program Talent Show". [/INST]

Output: SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID WHERE T2.Type  =  "Program Talent Show";


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the ids and names of festivals that have at least two nominations for artworks. [/INST]

Output: SELECT T1.Festival_ID ,  T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the id, name of each festival and the number of artworks it has nominated. [/INST]

Output: SELECT T1.Festival_ID ,  T3.Festival_Name ,  COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Please show different types of artworks with the corresponding number of artworks of each type. [/INST]

Output: SELECT TYPE ,  COUNT(*) FROM artwork GROUP BY TYPE;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the most common type of artworks. [/INST]

Output: SELECT TYPE FROM artwork GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the year in which there are more than one festivals. [/INST]

Output: SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*)  >  1;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: List the name of artworks that are not nominated. [/INST]

Output: SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination);


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: Show the number of audience in year 2008 or 2010. [/INST]

Output: SELECT Num_of_Audience FROM festival_detail WHERE YEAR  =  2008 OR YEAR  =  2010;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: What are the total number of the audiences who visited any of the festivals? [/INST]

Output: SELECT sum(Num_of_Audience) FROM festival_detail;


Input:
[INST] Here is a database schema:
festival_detail :
Festival_ID [ INT ] primary_key
Festival_Name [ TEXT ]
Chair_Name [ TEXT ]
Location [ TEXT ]
Year [ INT ]
Num_of_Audience [ INT ]

artwork :
Artwork_ID [ INT ] primary_key
Type [ TEXT ]
Name [ TEXT ]

nomination :
Artwork_ID [ INT ] primary_key nomination.Artwork_ID = artwork.Artwork_ID
Festival_ID [ INT ] nomination.Festival_ID = festival_detail.Festival_ID
Result [ TEXT ]

Please write me a SQL statement that answers the following question: In which year are there festivals both inside the 'United States' and outside the 'United States'? [/INST]

Output: SELECT YEAR FROM festival_detail WHERE LOCATION  =  'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != 'United States';


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

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

Output: SELECT count(*) FROM premises;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

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

Output: SELECT DISTINCT premises_type FROM premises;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Find the types and details for all premises and order by the premise type. [/INST]

Output: SELECT premises_type ,  premise_details FROM premises ORDER BY premises_type;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show each premise type and the number of premises in that type. [/INST]

Output: SELECT premises_type ,  count(*) FROM premises GROUP BY premises_type;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show all distinct product categories along with the number of mailshots in each category. [/INST]

Output: SELECT product_category ,  count(*) FROM mailshot_campaigns GROUP BY product_category;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name and phone of the customer without any mailshot. [/INST]

Output: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers);


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name and phone for customers with a mailshot with outcome code 'No Response'. [/INST]

Output: SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.outcome_code  =  'No Response';


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the outcome code of mailshots along with the number of mailshots in each outcome code. [/INST]

Output: SELECT outcome_code ,  count(*) FROM mailshot_customers GROUP BY outcome_code;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of customers who have at least 2 mailshots with outcome code 'Order'. [/INST]

Output: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  'Order' GROUP BY T1.customer_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of customers who have the most mailshots. [/INST]

Output: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome. [/INST]

Output: SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'Order' INTERSECT SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'No Response';


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the premise type and address type code for all customer addresses. [/INST]

Output: SELECT T2.premises_type ,  T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id  =  T2.premise_id;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct address type codes for all customer addresses? [/INST]

Output: SELECT DISTINCT address_type_code FROM customer_addresses;


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the shipping charge and customer id for customer orders with order status Cancelled or Paid. [/INST]

Output: SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Cancelled' OR order_status_code  =  'Paid';


Input:
[INST] Here is a database schema:
Premises :
premise_id [ INT ] primary_key
premises_type [ TEXT ]
premise_details [ TEXT ]

Products :
product_id [ INT ] primary_key
product_category [ TEXT ]
product_name [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
customer_address [ TEXT ]
customer_login [ TEXT ]
customer_password [ TEXT ]

Mailshot_Campaigns :
mailshot_id [ INT ] primary_key
product_category [ TEXT ]
mailshot_name [ TEXT ]
mailshot_start_date [ TEXT ]
mailshot_end_date [ TEXT ]

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
premise_id [ INT ] Customer_Addresses.premise_id = Premises.premise_id
date_address_from [ TEXT ]
address_type_code [ TEXT ]
date_address_to [ TEXT ]

Customer_Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Customer_Orders.customer_id = Customers.customer_id
order_status_code [ TEXT ]
shipping_method_code [ TEXT ]
order_placed_datetime [ TEXT ]
order_delivered_datetime [ TEXT ]
order_shipping_charges [ TEXT ]

Mailshot_Customers :
mailshot_id [ INT ] Mailshot_Customers.mailshot_id = Mailshot_Campaigns.mailshot_id
customer_id [ INT ] Mailshot_Customers.customer_id = Customers.customer_id
outcome_code [ TEXT ]
mailshot_customer_date [ TEXT ]

Order_Items :
item_id [ INT ]
order_item_status_code [ TEXT ]
order_id [ INT ] Order_Items.order_id = Customer_Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
item_status_code [ TEXT ]
item_delivered_datetime [ TEXT ]
item_order_quantity [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of customers having an order with shipping method FedEx and order status Paid. [/INST]

Output: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE shipping_method_code  =  'FedEx' AND order_status_code  =  'Paid';


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

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

Output: SELECT count(*) FROM COURSE;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

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

Output: SELECT count(*) FROM COURSE;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: How many courses have more than 2 credits? [/INST]

Output: SELECT count(*) FROM COURSE WHERE Credits  >  2;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Count the number of courses with more than 2 credits. [/INST]

Output: SELECT count(*) FROM COURSE WHERE Credits  >  2;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: List all names of courses with 1 credit? [/INST]

Output: SELECT CName FROM COURSE WHERE Credits  =  1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the names of courses with 1 credit? [/INST]

Output: SELECT CName FROM COURSE WHERE Credits  =  1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Which courses are taught on days MTW? [/INST]

Output: SELECT CName FROM COURSE WHERE Days  =  "MTW";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the course names for courses taught on MTW? [/INST]

Output: SELECT CName FROM COURSE WHERE Days  =  "MTW";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the number of departments in Division "AS"? [/INST]

Output: SELECT count(*) FROM DEPARTMENT WHERE Division  =  "AS";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: How many departments are in the division AS? [/INST]

Output: SELECT count(*) FROM DEPARTMENT WHERE Division  =  "AS";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the phones of departments in Room 268? [/INST]

Output: SELECT DPhone FROM DEPARTMENT WHERE Room  =  268;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Give the phones for departments in room 268. [/INST]

Output: SELECT DPhone FROM DEPARTMENT WHERE Room  =  268;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the number of students that have at least one grade "B". [/INST]

Output: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade  =  "B";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: How many students have had at least one "B" grade? [/INST]

Output: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade  =  "B";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the max and min grade point for all letter grade. [/INST]

Output: SELECT max(gradepoint) ,  min(gradepoint) FROM GRADECONVERSION;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the maximum and minumum grade points? [/INST]

Output: SELECT max(gradepoint) ,  min(gradepoint) FROM GRADECONVERSION;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of students whose first names contain letter "a". [/INST]

Output: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%';


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the first names for students who have an "a" in their first name? [/INST]

Output: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%';


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and last names of male (sex is M) faculties who live in building NEB. [/INST]

Output: SELECT Fname ,  Lname FROM FACULTY WHERE sex  =  "M" AND Building  =  "NEB";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the full names of faculties with sex M and who live in building NEB? [/INST]

Output: SELECT Fname ,  Lname FROM FACULTY WHERE sex  =  "M" AND Building  =  "NEB";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the rooms of faculties with rank professor who live in building NEB. [/INST]

Output: SELECT Room FROM FACULTY WHERE Rank  =  "Professor" AND Building  =  "NEB";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the rooms for members of the faculty who are professors and who live in building NEB? [/INST]

Output: SELECT Room FROM FACULTY WHERE Rank  =  "Professor" AND Building  =  "NEB";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the department name that is in Building "Mergenthaler". [/INST]

Output: SELECT DName FROM DEPARTMENT WHERE Building  =  "Mergenthaler";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the department in the Building Mergenthaler? [/INST]

Output: SELECT DName FROM DEPARTMENT WHERE Building  =  "Mergenthaler";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: List all information about courses sorted by credits in the ascending order. [/INST]

Output: SELECT * FROM COURSE ORDER BY Credits;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is all the information about courses, ordered by credits ascending? [/INST]

Output: SELECT * FROM COURSE ORDER BY Credits;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: List the course name of courses sorted by credits. [/INST]

Output: SELECT CName FROM COURSE ORDER BY Credits;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

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

Output: SELECT CName FROM COURSE ORDER BY Credits;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the first name of students in the descending order of age. [/INST]

Output: SELECT Fname FROM STUDENT ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of students, ordered by age from greatest to least? [/INST]

Output: SELECT Fname FROM STUDENT ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the last name of female (sex is F) students in the descending order of age. [/INST]

Output: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the last names of female students, ordered by age descending? [/INST]

Output: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the last names of faculties in building Barton in alphabetic order. [/INST]

Output: SELECT Lname FROM FACULTY WHERE Building  =  "Barton" ORDER BY Lname;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the last names of faculty in building Barton, sorted by last name? [/INST]

Output: SELECT Lname FROM FACULTY WHERE Building  =  "Barton" ORDER BY Lname;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of faculties of rank Professor in alphabetic order. [/INST]

Output: SELECT Fname FROM FACULTY WHERE Rank  =  "Professor" ORDER BY Fname;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the first names for all faculty professors, ordered by first name? [/INST]

Output: SELECT Fname FROM FACULTY WHERE Rank  =  "Professor" ORDER BY Fname;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the department that has the biggest number of students minored in? [/INST]

Output: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the department with the most students minoring in it? [/INST]

Output: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the department that has no students minored in? [/INST]

Output: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the department htat has no students minoring in it? [/INST]

Output: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the department that has the fewest members. [/INST]

Output: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the department with the fewest members? [/INST]

Output: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Find the rank of the faculty that the fewest faculties belong to. [/INST]

Output: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What is the least common faculty rank? [/INST]

Output: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the first and last names of the instructors who teach the top 3 number of courses? [/INST]

Output: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: What are the full names of the 3 instructors who teach the most courses? [/INST]

Output: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Which building does the instructor who teaches the most number of courses live in? [/INST]

Output: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

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

Department :
DNO [ INT ] primary_key
Division [ TEXT ]
DName [ TEXT ]
Room [ TEXT ]
Building [ TEXT ]
DPhone [ INT ]

Member_of :
FacID [ INT ] Member_of.FacID = Faculty.FacID
DNO [ INT ] Member_of.DNO = Department.DNO
Appt_Type [ TEXT ]

Course :
CID [ TEXT ] primary_key
CName [ TEXT ]
Credits [ INT ]
Instructor [ INT ] Course.Instructor = Faculty.FacID
Days [ TEXT ]
Hours [ TEXT ]
DNO [ INT ] Course.DNO = Department.DNO

Minor_in :
StuID [ INT ] Minor_in.StuID = Student.StuID
DNO [ INT ] Minor_in.DNO = Department.DNO

Enrolled_in :
StuID [ INT ] Enrolled_in.StuID = Student.StuID
CID [ TEXT ] Enrolled_in.CID = Course.CID
Grade [ TEXT ] Enrolled_in.Grade = Gradeconversion.lettergrade

Gradeconversion :
lettergrade [ TEXT ] primary_key
gradepoint [ INT ]

Please write me a SQL statement that answers the following question: Give the building that the instructor who teaches the greatest number of courses lives in. [/INST]

Output: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1;