Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Return the names of artists and the themes of their exhibitions that had a ticket price higher than average. [/INST]

Output: SELECT T1.theme ,  T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.ticket_price  >  (SELECT avg(ticket_price) FROM exhibition);


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009. [/INST]

Output: SELECT avg(ticket_price) ,  min(ticket_price) ,  max(ticket_price) FROM exhibition WHERE YEAR  <  2009;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: What are the average, minimum, and maximum ticket prices for exhibitions that happened prior to 2009? [/INST]

Output: SELECT avg(ticket_price) ,  min(ticket_price) ,  max(ticket_price) FROM exhibition WHERE YEAR  <  2009;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Show theme and year for all exhibitions in an descending order of ticket price. [/INST]

Output: SELECT theme ,  YEAR FROM exhibition ORDER BY ticket_price DESC;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: What are the themes and years for exhibitions, sorted by ticket price descending? [/INST]

Output: SELECT theme ,  YEAR FROM exhibition ORDER BY ticket_price DESC;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: What is the theme, date, and attendance for the exhibition in year 2004? [/INST]

Output: SELECT T2.theme ,  T1.date ,  T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T2.year  =  2004;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Return the themes, dates, and attendance for exhibitions that happened in 2004. [/INST]

Output: SELECT T2.theme ,  T1.date ,  T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T2.year  =  2004;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Show all artist names who didn't have an exhibition in 2004. [/INST]

Output: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.year  =  2004;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of artists who did not have an exhibition in 2004? [/INST]

Output: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.year  =  2004;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Show the theme for exhibitions with both records of an attendance below 100 and above 500. [/INST]

Output: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  <  100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  500;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Which themes have had corresponding exhibitions that have had attendance both below 100 and above 500? [/INST]

Output: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  <  100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  500;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: How many exhibitions have a attendance more than 100 or have a ticket price below 10? [/INST]

Output: SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  100 OR T2.ticket_price  <  10;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Count the number of exhibitions that have had an attendnance of over 100 or a ticket prices under 10. [/INST]

Output: SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  100 OR T2.ticket_price  <  10;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: Show all artist names with an average exhibition attendance over 200. [/INST]

Output: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id JOIN artist AS T3 ON T3.artist_id  =  T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance)  >  200;


Input:
[INST] Here is a database schema:
artist :
Artist_ID [ INT ] primary_key
Name [ TEXT ]
Country [ TEXT ]
Year_Join [ INT ]
Age [ INT ]

exhibition :
Exhibition_ID [ INT ] primary_key
Year [ INT ]
Theme [ TEXT ]
Artist_ID [ INT ] exhibition.Artist_ID = artist.Artist_ID
Ticket_Price [ INT ]

exhibition_record :
Exhibition_ID [ INT ] primary_key exhibition_record.Exhibition_ID = exhibition.Exhibition_ID
Date [ TEXT ]
Attendance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of artist whose exhibitions draw over 200 attendees on average? [/INST]

Output: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id JOIN artist AS T3 ON T3.artist_id  =  T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance)  >  200;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the id of the item whose title is "orange". [/INST]

Output: SELECT i_id FROM item WHERE title  =  "orange";


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: List all information in the item table. [/INST]

Output: SELECT * FROM item;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

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

Output: SELECT count(*) FROM review;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

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

Output: SELECT count(*) FROM useracct;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the average and maximum rating of all reviews. [/INST]

Output: SELECT avg(rating) ,  max(rating) FROM review;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the highest rank of all reviews. [/INST]

Output: SELECT min(rank) FROM review;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: How many different users wrote some reviews? [/INST]

Output: SELECT count(DISTINCT u_id) FROM review;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: How many different items were reviewed by some users? [/INST]

Output: SELECT count(DISTINCT i_id) FROM review;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the number of items that did not receive any review. [/INST]

Output: SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the names of users who did not leave any review. [/INST]

Output: SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the names of goods that receive a rating of 10. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  =  10;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the titles of items whose rating is higher than the average review rating of all items. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  >  (SELECT avg(rating) FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the titles of items that received any rating below 5. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  <  5;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the titles of items that received both a rating higher than 8 and a rating below 5. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  >  8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  <  5;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the names of items whose rank is higher than 3 and whose average rating is above 5. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rank  >  3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id HAVING avg(T2.rating)  >  5;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the item with the lowest average rating. [/INST]

Output: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: List the titles of all items in alphabetic order . [/INST]

Output: SELECT title FROM item ORDER BY title;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the user who gives the most reviews. [/INST]

Output: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name and id of the item with the highest average rating. [/INST]

Output: SELECT T1.title ,  T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name and id of the good with the highest average rank. [/INST]

Output: SELECT T1.title ,  T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rank) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: For each user, return the name and the average rating of reviews given by them. [/INST]

Output: SELECT T1.name ,  avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: For each user, find their name and the number of reviews written by them. [/INST]

Output: SELECT T1.name ,  count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the user who gave the highest rating. [/INST]

Output: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id ORDER BY T2.rating DESC LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the source user with the highest average trust score. [/INST]

Output: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.source_u_id GROUP BY T2.source_u_id ORDER BY avg(trust) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find each target user's name and average trust score. [/INST]

Output: SELECT T1.name ,  avg(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.target_u_id GROUP BY T2.target_u_id;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the target user with the lowest trust score. [/INST]

Output: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.target_u_id ORDER BY trust LIMIT 1;


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the names of the items that did not receive any review. [/INST]

Output: SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the names of users who did not leave any review. [/INST]

Output: SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the number of users who did not write any review. [/INST]

Output: SELECT count(*) FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);


Input:
[INST] Here is a database schema:
item :
i_id [ INT ] primary_key
title [ TEXT ]

review :
a_id [ INT ] primary_key
u_id [ INT ] review.u_id = useracct.u_id
i_id [ INT ] review.i_id = item.i_id
rating [ INT ]
rank [ INT ]

useracct :
u_id [ INT ] primary_key
name [ TEXT ]

trust :
source_u_id [ INT ] trust.source_u_id = useracct.u_id
target_u_id [ INT ] trust.target_u_id = useracct.u_id
trust [ INT ]

Please write me a SQL statement that answers the following question: Find the number of items without any review. [/INST]

Output: SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review);


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

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

Output: SELECT count(*) FROM player;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

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

Output: SELECT Player_name FROM player ORDER BY Votes ASC;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: What are the gender and occupation of players? [/INST]

Output: SELECT Gender ,  Occupation FROM player;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: List the name and residence for players whose occupation is not "Researcher". [/INST]

Output: SELECT Player_name ,  residence FROM player WHERE Occupation != "Researcher";


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the names of sponsors of players whose residence is either "Brandon" or "Birtle". [/INST]

Output: SELECT Sponsor_name FROM player WHERE Residence  =  "Brandon" OR Residence  =  "Birtle";


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the player with the largest number of votes? [/INST]

Output: SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show different occupations along with the number of players in each occupation. [/INST]

Output: SELECT Occupation ,  COUNT(*) FROM player GROUP BY Occupation;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Please show the most common occupation of players. [/INST]

Output: SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the residences that have at least two players. [/INST]

Output: SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the names of players and names of their coaches. [/INST]

Output: SELECT T3.Player_name ,  T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID  =  T2.Coach_ID JOIN player AS T3 ON T1.Player_ID  =  T3.Player_ID;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the names of players coached by the rank 1 coach. [/INST]

Output: SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID  =  T2.Coach_ID JOIN player AS T3 ON T1.Player_ID  =  T3.Player_ID WHERE T2.Rank  =  1;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the names and genders of players with a coach starting after 2011. [/INST]

Output: SELECT T3.Player_name ,  T3.gender FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID  =  T2.Coach_ID JOIN player AS T3 ON T1.Player_ID  =  T3.Player_ID WHERE T1.Starting_year  >  2011;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the names of players and names of their coaches in descending order of the votes of players. [/INST]

Output: SELECT T3.Player_name ,  T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID  =  T2.Coach_ID JOIN player AS T3 ON T1.Player_ID  =  T3.Player_ID ORDER BY T3.Votes DESC;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: List the names of players that do not have coaches. [/INST]

Output: SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM player_coach);


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: Show the residences that have both a player of gender "M" and a player of gender "F". [/INST]

Output: SELECT Residence FROM player WHERE gender  =  "M" INTERSECT SELECT Residence FROM player WHERE gender  =  "F";


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: How many coaches does each club has? List the club id, name and the number of coaches. [/INST]

Output: SELECT T1.club_id ,  T1.club_name, count(*) FROM club AS T1 JOIN coach AS T2 ON T1.club_id  =  T2.club_id GROUP BY T1.club_id;


Input:
[INST] Here is a database schema:
player :
Player_ID [ INT ] primary_key
Sponsor_name [ TEXT ]
Player_name [ TEXT ]
Gender [ TEXT ]
Residence [ TEXT ]
Occupation [ TEXT ]
Votes [ INT ]
Rank [ TEXT ]

club :
Club_ID [ INT ] primary_key
Club_name [ TEXT ]
Region [ TEXT ]
Start_year [ INT ]

coach :
Coach_ID [ INT ] primary_key
Coach_name [ TEXT ]
Gender [ TEXT ]
Club_ID [ INT ] coach.Club_ID = club.Club_ID
Rank [ INT ]

player_coach :
Player_ID [ INT ] primary_key player_coach.Player_ID = player.Player_ID
Coach_ID [ INT ] player_coach.Coach_ID = coach.Coach_ID
Starting_year [ INT ]

match_result :
Rank [ INT ] primary_key
Club_ID [ INT ] match_result.Club_ID = club.Club_ID
Gold [ INT ]
Big_Silver [ INT ]
Small_Silver [ INT ]
Bronze [ INT ]
Points [ INT ]

Please write me a SQL statement that answers the following question: How many gold medals has the club with the most coaches won? [/INST]

Output: SELECT T1.club_id ,  T1.gold FROM match_result AS T1 JOIN coach AS T2 ON T1.club_id  =  T2.club_id GROUP BY T1.club_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT count(*) FROM gymnast;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT count(*) FROM gymnast;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: List the total points of gymnasts in descending order. [/INST]

Output: SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the total points for all gymnasts, ordered by total points descending? [/INST]

Output: SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: List the total points of gymnasts in descending order of floor exercise points. [/INST]

Output: SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the total points of gymnasts, ordered by their floor exercise points descending? [/INST]

Output: SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average horizontal bar points for all gymnasts? [/INST]

Output: SELECT avg(Horizontal_Bar_Points) FROM gymnast;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the average horizontal bar points across all gymnasts. [/INST]

Output: SELECT avg(Horizontal_Bar_Points) FROM gymnast;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of people in ascending alphabetical order? [/INST]

Output: SELECT Name FROM People ORDER BY Name ASC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names of people, ordered alphabetically. [/INST]

Output: SELECT Name FROM People ORDER BY Name ASC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names of the gymnasts. [/INST]

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of gymnasts whose hometown is not "Santo Domingo"? [/INST]

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID WHERE T2.Hometown != "Santo Domingo";


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names of gymnasts who did not grow up in Santo Domingo. [/INST]

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID WHERE T2.Hometown != "Santo Domingo";


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT Age FROM people ORDER BY Height DESC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the age of the person with the greatest height. [/INST]

Output: SELECT Age FROM people ORDER BY Height DESC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of the top 5 oldest people. [/INST]

Output: SELECT Name FROM People ORDER BY Age DESC LIMIT 5;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the five oldest people? [/INST]

Output: SELECT Name FROM People ORDER BY Age DESC LIMIT 5;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total point count of the youngest gymnast? [/INST]

Output: SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Age ASC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the total points of the gymnast with the lowest age. [/INST]

Output: SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Age ASC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT avg(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT avg(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct hometowns of gymnasts with total points more than 57.5? [/INST]

Output: SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID WHERE T1.Total_Points  >  57.5;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Give the different hometowns of gymnasts that have a total point score of above 57.5. [/INST]

Output: SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID WHERE T1.Total_Points  >  57.5;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the hometowns of gymnasts and the corresponding number of gymnasts? [/INST]

Output: SELECT T2.Hometown ,  COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: How many gymnasts are from each hometown? [/INST]

Output: SELECT T2.Hometown ,  COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Return the hometown that is most common among gymnasts. [/INST]

Output: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the hometowns that are shared by at least two gymnasts? [/INST]

Output: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Give the hometowns from which two or more gymnasts are from. [/INST]

Output: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of gymnasts in ascending order by their heights. [/INST]

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Height ASC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of gymnasts, ordered by their heights ascending? [/INST]

Output: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Height ASC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: List the distinct hometowns that are not associated with any gymnast. [/INST]

Output: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: From which hometowns did no gymnasts come from? [/INST]

Output: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Show the hometowns shared by people older than 23 and younger than 20. [/INST]

Output: SELECT Hometown FROM people WHERE Age  >  23 INTERSECT SELECT Hometown FROM people WHERE Age  <  20;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: From which hometowns did both people older than 23 and younger than 20 come from? [/INST]

Output: SELECT Hometown FROM people WHERE Age  >  23 INTERSECT SELECT Hometown FROM people WHERE Age  <  20;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: How many distinct hometowns did these people have? [/INST]

Output: SELECT count(DISTINCT Hometown) FROM people;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

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

Output: SELECT count(DISTINCT Hometown) FROM people;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: Show the ages of gymnasts in descending order of total points. [/INST]

Output: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T1.Total_Points DESC;


Input:
[INST] Here is a database schema:
gymnast :
Gymnast_ID [ INT ] primary_key gymnast.Gymnast_ID = people.People_ID
Floor_Exercise_Points [ INT ]
Pommel_Horse_Points [ INT ]
Rings_Points [ INT ]
Vault_Points [ INT ]
Parallel_Bars_Points [ INT ]
Horizontal_Bar_Points [ INT ]
Total_Points [ INT ]

people :
People_ID [ INT ] primary_key
Name [ TEXT ]
Age [ INT ]
Height [ INT ]
Hometown [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ages of the gymnasts, ordered descending by their total points? [/INST]

Output: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T1.Total_Points DESC;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the total savings balance of all accounts except the account with name ‘Brown’. [/INST]

Output: SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T1.name != 'Brown';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the total balance of savings accounts not belonging to someone with the name Brown? [/INST]

Output: SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T1.name != 'Brown';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

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

Output: SELECT count(*) FROM accounts;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

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

Output: SELECT count(*) FROM accounts;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the total checking balance in all accounts? [/INST]

Output: SELECT sum(balance) FROM checking;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the total balance across checking accounts. [/INST]

Output: SELECT sum(balance) FROM checking;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the average checking balance. [/INST]

Output: SELECT avg(balance) FROM checking;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the average balance in checking accounts? [/INST]

Output: SELECT avg(balance) FROM checking;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: How many accounts have a savings balance above the average savings balance? [/INST]

Output: SELECT count(*) FROM savings WHERE balance  >  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the number of accounts with a savings balance that is higher than the average savings balance. [/INST]

Output: SELECT count(*) FROM savings WHERE balance  >  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name and id of accounts whose checking balance is below the maximum checking balance. [/INST]

Output: SELECT T1.custid ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT max(balance) FROM checking);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the customer id and name corresponding to accounts with a checking balance less than the largest checking balance? [/INST]

Output: SELECT T1.custid ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT max(balance) FROM checking);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the checking balance of the account whose owner’s name contains the substring ‘ee’? [/INST]

Output: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name LIKE '%ee%';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the balance of the checking account belonging to an owner whose name contains 'ee'. [/INST]

Output: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name LIKE '%ee%';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the checking balance and saving balance in the Brown’s account. [/INST]

Output: SELECT T2.balance ,  T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T1.name  =  'Brown';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the checking and savings balances in accounts belonging to Brown? [/INST]

Output: SELECT T2.balance ,  T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T1.name  =  'Brown';


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance. [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of accounts with checking balances greater than the average checking balance and savings balances below the average savings balance? [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the checking balance of the accounts whose savings balance is higher than the average savings balance. [/INST]

Output: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM savings));


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the balances of checking accounts belonging to people with savings balances greater than the average savings balance? [/INST]

Output: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM savings));


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: List all customers’ names in the alphabetical order. [/INST]

Output: SELECT name FROM accounts ORDER BY name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all the customers in alphabetical order? [/INST]

Output: SELECT name FROM accounts ORDER BY name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name of account that has the lowest total checking and saving balance. [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the name corresponding to the accoung with the lowest sum of checking and savings balances? [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance. [/INST]

Output: SELECT T1.name ,  T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T3.balance  >  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names and sum of checking and savings balances for accounts with savings balances higher than the average savings balance? [/INST]

Output: SELECT T1.name ,  T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T3.balance  >  (SELECT avg(balance) FROM savings);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name and checking balance of the account with the lowest savings balance. [/INST]

Output: SELECT T1.name ,  T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names and balances of checking accounts belonging to the customer with the lowest savings balance? [/INST]

Output: SELECT T1.name ,  T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the number of checking accounts for each account name. [/INST]

Output: SELECT count(*) ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of customers with accounts, and how many checking accounts do each of them have? [/INST]

Output: SELECT count(*) ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the total saving balance for each account name. [/INST]

Output: SELECT sum(T2.balance) ,  T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of customers with accounts, and what are the total savings balances for each? [/INST]

Output: SELECT sum(T2.balance) ,  T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name of accounts whose checking balance is below the average checking balance. [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM checking);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names of customers with checking balances lower than the average checking balance? [/INST]

Output: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM checking);


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the saving balance of the account with the highest checking balance. [/INST]

Output: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the savings balance of the account belonging to the customer with the highest checking balance? [/INST]

Output: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the total checking and saving balance of all accounts sorted by the total balance in ascending order. [/INST]

Output: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid ORDER BY T1.balance + T2.balance;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the sum of checking and savings balances for all customers, ordered by the total balance? [/INST]

Output: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid ORDER BY T1.balance + T2.balance;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name and checking balance of the account with the lowest saving balance. [/INST]

Output: SELECT T2.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What is the name and checking balance of the account which has the lowest savings balance? [/INST]

Output: SELECT T2.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name, checking balance and saving balance of all accounts in the bank. [/INST]

Output: SELECT T2.balance ,  T3.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names, checking balances, and savings balances for all customers? [/INST]

Output: SELECT T2.balance ,  T3.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order. [/INST]

Output: SELECT T2.balance ,  T3.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance DESC;


Input:
[INST] Here is a database schema:
ACCOUNTS :
custid [ INT ] primary_key
name [ TEXT ]

SAVINGS :
custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid
balance [ INT ]

CHECKING :
custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid
balance [ INT ]

Please write me a SQL statement that answers the following question: What are the names, checking balances, and savings balances of customers, ordered by the total of checking and savings balances descending? [/INST]

Output: SELECT T2.balance ,  T3.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance DESC;