input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = "Credit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = "Credit";
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT DISTINCT card_type_code FROM Customers_Cards;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT DISTINCT card_type_code FROM Customers_Cards;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(DISTINCT card_type_code) FROM Customers_Cards;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(DISTINCT card_type_code) FROM Customers_Cards;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT DISTINCT transaction_type FROM Financial_Transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT DISTINCT transaction_type FROM Financial_Transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(DISTINCT transaction_type) FROM Financial_Transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT count(DISTINCT transaction_type) FROM Financial_Transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T2.card_type_code , count(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT T2.card_type_code , count(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id;
Tables: Accounts, Customers, Customers_Cards, Financial_Transactions Columns: Accounts.account_id, Accounts.customer_id, Accounts.account_name, Accounts.other_account_details, Customers.customer_id, Customers.customer_first_name, Customers.customer_last_name, Customers.customer_address, Customers.customer_phone, Custom...
SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: How many tracks do we have? [/INST]
SELECT count(*) FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Count the number of tracks. [/INST]
SELECT count(*) FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name and location for all tracks. [/INST]
SELECT name , LOCATION FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names and locations of all tracks? [/INST]
SELECT name , LOCATION FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show names and seatings, ordered by seating for all tracks opened after 2000. [/INST]
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names and seatings for all tracks opened after 2000, ordered by seating? [/INST]
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What is the name, location and seating for the most recently opened track? [/INST]
SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Return the name, location, and seating of the track that was opened in the most recent year. [/INST]
SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What is the minimum, maximum, and average seating for all tracks. [/INST]
SELECT min(seating) , max(seating) , avg(seating) FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Return the minimum, maximum, and average seating across all tracks. [/INST]
SELECT min(seating) , max(seating) , avg(seating) FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name, location, open year for all tracks with a seating higher than the average. [/INST]
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track);
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names, locations, and years of opening for tracks with seating higher than average? [/INST]
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track);
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are distinct locations where tracks are located? [/INST]
SELECT DISTINCT LOCATION FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Give the different locations of tracks. [/INST]
SELECT DISTINCT LOCATION FROM track;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: How many races are there? [/INST]
SELECT count(*) FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Count the number of races. [/INST]
SELECT count(*) FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the distinct classes that races can have? [/INST]
SELECT DISTINCT CLASS FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Return the different classes of races. [/INST]
SELECT DISTINCT CLASS FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show name, class, and date for all races. [/INST]
SELECT name , CLASS , date FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names, classes, and dates for all races? [/INST]
SELECT name , CLASS , date FROM race;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the race class and number of races in each class. [/INST]
SELECT CLASS , count(*) FROM race GROUP BY CLASS;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the different classes of races, and how many races correspond to each? [/INST]
SELECT CLASS , count(*) FROM race GROUP BY CLASS;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What is the race class with most number of races. [/INST]
SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Give the class of races that is most common. [/INST]
SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: List the race class with at least two races. [/INST]
SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the classes of races that have two or more corresponding races? [/INST]
SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names for tracks without a race in class 'GT'. [/INST]
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';
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Give the names of tracks that do not have a race in the class 'GT'. [/INST]
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';
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show all track names that have had no races. [/INST]
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race);
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Return the names of tracks that have no had any races. [/INST]
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race);
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened. [/INST]
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the years of opening for tracks with seating between 4000 and 5000? [/INST]
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name of track and the number of races in each track. [/INST]
SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names of different tracks, and how many races has each had? [/INST]
SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name of track with most number of races. [/INST]
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;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What is the name of the track that has had the greatest number of races? [/INST]
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;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name and date for each race and its track name. [/INST]
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names and dates of races, and the names of the tracks where they are held? [/INST]
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Show the name and location of track with 1 race. [/INST]
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;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the names and locations of tracks that have had exactly 1 race? [/INST]
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;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats. [/INST]
SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000;
Tables: race, track Columns: race.Race_ID, race.Name, race.Class, race.Date, race.Track_ID, track.Track_ID, track.Name, track.Location, track.Seating, track.Year_Opened Question: What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats? [/INST]
SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT count(*) FROM member WHERE Membership_card = 'Black';
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT count(*) , address FROM member GROUP BY address;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury';
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT name , member_id FROM member WHERE Membership_card = 'Black' OR age < 30;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT Time_of_purchase , age , address FROM member ORDER BY Time_of_purchase;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*) > 5;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40;
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury';
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT count(*) FROM member WHERE address != 'Hartford';
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black';
Tables: shop, member, happy_hour, happy_hour_member Columns: shop.Shop_ID, shop.Address, shop.Num_of_staff, shop.Score, shop.Open_Year, member.Member_ID, member.Name, member.Membership_card, member.Age, member.Time_of_purchase, member.Level_of_membership, member.Address, happy_hour.HH_ID, happy_hour.Shop_ID, happy_hour...
SELECT address FROM shop ORDER BY open_year;