Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the different classes of races, and how many races correspond to each? [/INST]

Output: SELECT CLASS ,  count(*) FROM race GROUP BY CLASS;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What is the race class with most number of races. [/INST]

Output: SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Give the class of races that is most common. [/INST]

Output: SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: List the race class with at least two races. [/INST]

Output: SELECT CLASS FROM race GROUP BY CLASS HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the classes of races that have two or more corresponding races? [/INST]

Output: SELECT CLASS FROM race GROUP BY CLASS HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the names for tracks without a race in class 'GT'. [/INST]

Output: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id WHERE T1.class  =  'GT';


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Give the names of tracks that do not have a race in the class 'GT'. [/INST]

Output: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id WHERE T1.class  =  'GT';


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show all track names that have had no races. [/INST]

Output: SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race);


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Return the names of tracks that have no had any races. [/INST]

Output: SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race);


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened. [/INST]

Output: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the years of opening for tracks with seating between 4000 and 5000? [/INST]

Output: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show the name of track and the number of races in each track. [/INST]

Output: SELECT T2.name ,  count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the names of different tracks, and how many races has each had? [/INST]

Output: SELECT T2.name ,  count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show the name of track with most number of races. [/INST]

Output: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the track that has had the greatest number of races? [/INST]

Output: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show the name and date for each race and its track name. [/INST]

Output: SELECT T1.name ,  T1.date ,  T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the names and dates of races, and the names of the tracks where they are held? [/INST]

Output: SELECT T1.name ,  T1.date ,  T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Show the name and location of track with 1 race. [/INST]

Output: SELECT T2.name ,  T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the names and locations of tracks that have had exactly 1 race? [/INST]

Output: SELECT T2.name ,  T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id  =  T2.track_id GROUP BY T1.track_id HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats. [/INST]

Output: SELECT LOCATION FROM track WHERE seating  >  90000 INTERSECT SELECT LOCATION FROM track WHERE seating  <  70000;


Input:
[INST] Here is a database schema:
race :
Race_ID [ INT ] primary_key
Name [ TEXT ]
Class [ TEXT ]
Date [ TEXT ]
Track_ID [ TEXT ] race.Track_ID = track.Track_ID

track :
Track_ID [ INT ] primary_key
Name [ TEXT ]
Location [ TEXT ]
Seating [ INT ]
Year_Opened [ INT ]

Please write me a SQL statement that answers the following question: What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats? [/INST]

Output: SELECT LOCATION FROM track WHERE seating  >  90000 INTERSECT SELECT LOCATION FROM track WHERE seating  <  70000;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: How many members have the black membership card? [/INST]

Output: SELECT count(*) FROM member WHERE Membership_card  =  'Black';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Find the number of members living in each address. [/INST]

Output: SELECT count(*) ,  address FROM member GROUP BY address;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Give me the names of members whose address is in Harford or Waterbury. [/INST]

Output: SELECT name FROM member WHERE address  =  'Harford' OR address  =  'Waterbury';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Find the ids and names of members who are under age 30 or with black membership card. [/INST]

Output: SELECT name ,  member_id FROM member WHERE Membership_card  =  'Black' OR age  <  30;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Find the purchase time, age and address of each member, and show the results in the order of purchase time. [/INST]

Output: SELECT Time_of_purchase ,  age ,  address FROM member ORDER BY Time_of_purchase;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Which membership card has more than 5 members? [/INST]

Output: SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*)  >  5;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Which address has both members younger than 30 and members older than 40? [/INST]

Output: SELECT address FROM member WHERE age  <  30 INTERSECT SELECT address FROM member WHERE age  >  40;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: What is the membership card held by both members living in Hartford and ones living in Waterbury address? [/INST]

Output: SELECT membership_card FROM member WHERE address  =  'Hartford' INTERSECT SELECT membership_card FROM member WHERE address  =  'Waterbury';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: How many members are not living in Hartford? [/INST]

Output: SELECT count(*) FROM member WHERE address != 'Hartford';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Which address do not have any member with the black membership card? [/INST]

Output: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card  =  'Black';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Show the shop addresses ordered by their opening year. [/INST]

Output: SELECT address FROM shop ORDER BY open_year;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: What are the average score and average staff number of all shops? [/INST]

Output: SELECT avg(num_of_staff) ,  avg(score) FROM shop;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Find the id and address of the shops whose score is below the average score. [/INST]

Output: SELECT shop_id ,  address FROM shop WHERE score  <  (SELECT avg(score) FROM shop);


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Find the address and staff number of the shops that do not have any happy hour. [/INST]

Output: SELECT address ,  num_of_staff FROM shop WHERE shop_id NOT IN (SELECT shop_id FROM happy_hour);


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: What are the id and address of the shops which have a happy hour in May? [/INST]

Output: SELECT t1.address ,  t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id  =  t2.shop_id WHERE MONTH  =  'May';


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: which shop has happy hour most frequently? List its id and number of happy hours. [/INST]

Output: SELECT shop_id ,  count(*) FROM happy_hour GROUP BY shop_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

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

Output: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
shop :
Shop_ID [ INT ] primary_key
Address [ TEXT ]
Num_of_staff [ TEXT ]
Score [ INT ]
Open_Year [ TEXT ]

member :
Member_ID [ INT ] primary_key
Name [ TEXT ]
Membership_card [ TEXT ]
Age [ INT ]
Time_of_purchase [ INT ]
Level_of_membership [ INT ]
Address [ TEXT ]

happy_hour :
HH_ID [ INT ] primary_key
Shop_ID [ INT ] happy_hour.Shop_ID = shop.Shop_ID
Month [ TEXT ]
Num_of_shaff_in_charge [ INT ]

happy_hour_member :
HH_ID [ INT ] primary_key
Member_ID [ INT ] happy_hour_member.Member_ID = member.Member_ID
Total_amount [ INT ]

Please write me a SQL statement that answers the following question: Which months have more than 2 happy hours? [/INST]

Output: SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

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

Output: SELECT count(*) FROM ALBUM;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

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

Output: SELECT count(*) FROM ALBUM;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: List the names of all music genres. [/INST]

Output: SELECT Name FROM GENRE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

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

Output: SELECT Name FROM GENRE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find all the customer information in state NY. [/INST]

Output: SELECT * FROM CUSTOMER WHERE State  =  "NY";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is all the customer information for customers in NY state? [/INST]

Output: SELECT * FROM CUSTOMER WHERE State  =  "NY";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the first names and last names of the employees who live in Calgary city. [/INST]

Output: SELECT FirstName ,  LastName FROM EMPLOYEE WHERE City  =  "Calgary";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the full names of employees living in the city of Calgary. [/INST]

Output: SELECT FirstName ,  LastName FROM EMPLOYEE WHERE City  =  "Calgary";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the distinct billing countries of the invoices? [/INST]

Output: SELECT distinct(BillingCountry) FROM INVOICE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the different billing countries for all invoices. [/INST]

Output: SELECT distinct(BillingCountry) FROM INVOICE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the names of all artists that have "a" in their names. [/INST]

Output: SELECT Name FROM ARTIST WHERE Name LIKE "%a%";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the names of artist who have the letter 'a' in their names? [/INST]

Output: SELECT Name FROM ARTIST WHERE Name LIKE "%a%";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the title of all the albums of the artist "AC/DC". [/INST]

Output: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T2.Name  =  "AC/DC";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the titles of albums by the artist "AC/DC"? [/INST]

Output: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T2.Name  =  "AC/DC";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Hom many albums does the artist "Metallica" have? [/INST]

Output: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T2.Name  =  "Metallica";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the number of albums by the artist "Metallica". [/INST]

Output: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T2.Name  =  "Metallica";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Which artist does the album "Balls to the Wall" belong to? [/INST]

Output: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T1.Title  =  "Balls to the Wall";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the artist who made the album "Balls to the Wall". [/INST]

Output: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId WHERE T1.Title  =  "Balls to the Wall";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

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

Output: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the artist with the greatest number of albums? [/INST]

Output: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the names of all the tracks that contain the word "you". [/INST]

Output: SELECT Name FROM TRACK WHERE Name LIKE '%you%';


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the names of tracks that contain the the word you in them? [/INST]

Output: SELECT Name FROM TRACK WHERE Name LIKE '%you%';


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

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

Output: SELECT AVG(UnitPrice) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the average unit price for a track. [/INST]

Output: SELECT AVG(UnitPrice) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the durations of the longest and the shortest tracks in milliseconds? [/INST]

Output: SELECT max(Milliseconds) ,  min(Milliseconds) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the maximum and minimum durations of tracks in milliseconds. [/INST]

Output: SELECT max(Milliseconds) ,  min(Milliseconds) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Show the album names, ids and the number of tracks for each album. [/INST]

Output: SELECT T1.Title ,  T2.AlbumID ,  COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId  =  T2.AlbumId GROUP BY T2.AlbumID;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the names and ids of the different albums, and how many tracks are on each? [/INST]

Output: SELECT T1.Title ,  T2.AlbumID ,  COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId  =  T2.AlbumId GROUP BY T2.AlbumID;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the most common genre in all tracks? [/INST]

Output: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the genre that is most frequent across all tracks. [/INST]

Output: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the least common media type in all tracks? [/INST]

Output: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId  =  T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the media type that is least common across all tracks? [/INST]

Output: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId  =  T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Show the album names and ids for albums that contain tracks with unit price bigger than 1. [/INST]

Output: SELECT T1.Title ,  T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId  =  T2.AlbumId WHERE T2.UnitPrice  >  1 GROUP BY T2.AlbumID;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the titles and ids for albums containing tracks with unit price greater than 1? [/INST]

Output: SELECT T1.Title ,  T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId  =  T2.AlbumId WHERE T2.UnitPrice  >  1 GROUP BY T2.AlbumID;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: How many tracks belong to rock genre? [/INST]

Output: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock";