db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
customers_card_transactions | select card_id , customer_id , card_type_code , card_number from customers_cards | Question: what are card ids, customer ids, card types, and card numbers for each customer card? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details.... | what are card ids, customer ids, card types, and card numbers for each customer card? |
customers_card_transactions | select date_valid_from , date_valid_to from customers_cards where card_number = '4560596484842' | Question: show the date valid from and the date valid to for the card with card number '4560596484842'. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_... | show the date valid from and the date valid to for the card with card number '4560596484842'. |
customers_card_transactions | select date_valid_from , date_valid_to from customers_cards where card_number = '4560596484842' | Question: what are the valid from and valid to dates for the card with the number 4560596484842? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details... | what are the valid from and valid to dates for the card with the number 4560596484842? |
customers_card_transactions | 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' | Question: what is the first name, last name, and phone of the customer with card 4560596484842. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details.... | what is the first name, last name, and phone of the customer with card 4560596484842. |
customers_card_transactions | 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' | Question: return the full name and phone of the customer who has card number 4560596484842. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Cus... | return the full name and phone of the customer who has card number 4560596484842. |
customers_card_transactions | 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' | Question: how many cards does customer art turcotte have? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_... | how many cards does customer art turcotte have? |
customers_card_transactions | 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' | Question: count the number of cards the customer with the first name art and last name turcotte has. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_det... | count the number of cards the customer with the first name art and last name turcotte has. |
customers_card_transactions | select count(*) from customers_cards where card_type_code = 'debit' | Question: how many debit cards do we have? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card_type_c... | how many debit cards do we have? |
customers_card_transactions | select count(*) from customers_cards where card_type_code = 'debit' | Question: count the number of customer cards of the type debit. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, cus... | count the number of customer cards of the type debit. |
customers_card_transactions | 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' | Question: how many credit cards does customer blanche huels have? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, c... | how many credit cards does customer blanche huels have? |
customers_card_transactions | 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' | Question: count the number of credit cards that the customer with first name blanche and last name huels has. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_cus... | count the number of credit cards that the customer with first name blanche and last name huels has. |
customers_card_transactions | select customer_id , count(*) from customers_cards group by customer_id | Question: show all customer ids and the number of cards owned by each customer. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards... | show all customer ids and the number of cards owned by each customer. |
customers_card_transactions | select customer_id , count(*) from customers_cards group by customer_id | Question: what are the different customer ids, and how many cards does each one hold? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers... | what are the different customer ids, and how many cards does each one hold? |
customers_card_transactions | select customer_id , count(*) from customers_cards group by customer_id order by count(*) desc limit 1 | Question: what is the customer id with most number of cards, and how many does he have? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Custome... | what is the customer id with most number of cards, and how many does he have? |
customers_card_transactions | select customer_id , count(*) from customers_cards group by customer_id order by count(*) desc limit 1 | Question: return the id of the customer who has the most cards, as well as the number of cards. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details.... | return the id of the customer who has the most cards, as well as the number of cards. |
customers_card_transactions | 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 | Question: show id, first and last names for all customers with at least two cards. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Ca... | show id, first and last names for all customers with at least two cards. |
customers_card_transactions | 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 | Question: what are the ids and full names of customers who hold two or more cards? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Ca... | what are the ids and full names of customers who hold two or more cards? |
customers_card_transactions | 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 | Question: what is the customer id, first and last name with least number of accounts. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers... | what is the customer id, first and last name with least number of accounts. |
customers_card_transactions | 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 | Question: return the id and full name of the customer who has the fewest accounts. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Ca... | return the id and full name of the customer who has the fewest accounts. |
customers_card_transactions | select card_type_code , count(*) from customers_cards group by card_type_code | Question: show all card type codes and the number of cards in each type. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> car... | show all card type codes and the number of cards in each type. |
customers_card_transactions | select card_type_code , count(*) from customers_cards group by card_type_code | Question: what are the different card types, and how many cards are there of each? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Ca... | what are the different card types, and how many cards are there of each? |
customers_card_transactions | select card_type_code from customers_cards group by card_type_code order by count(*) desc limit 1 | Question: what is the card type code with most number of cards? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, cus... | what is the card type code with most number of cards? |
customers_card_transactions | select card_type_code from customers_cards group by card_type_code order by count(*) desc limit 1 | Question: return the code of the card type that is most common. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, cus... | return the code of the card type that is most common. |
customers_card_transactions | select card_type_code from customers_cards group by card_type_code having count(*) >= 5 | Question: show card type codes with at least 5 cards. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, ... | show card type codes with at least 5 cards. |
customers_card_transactions | select card_type_code from customers_cards group by card_type_code having count(*) >= 5 | Question: what are the codes of card types that have 5 or more cards? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_i... | what are the codes of card types that have 5 or more cards? |
customers_card_transactions | select card_type_code , count(distinct customer_id) from customers_cards group by card_type_code | Question: show all card type codes and the number of customers holding cards in each type. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Cust... | show all card type codes and the number of customers holding cards in each type. |
customers_card_transactions | select card_type_code , count(distinct customer_id) from customers_cards group by card_type_code | Question: what are the different card type codes, and how many different customers hold each type? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_detai... | what are the different card type codes, and how many different customers hold each type? |
customers_card_transactions | 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' | Question: show the customer ids and firstname without a credit card. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id... | show the customer ids and firstname without a credit card. |
customers_card_transactions | 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' | Question: what are the ids and first names of customers who do not hold a credit card? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customer... | what are the ids and first names of customers who do not hold a credit card? |
customers_card_transactions | select distinct card_type_code from customers_cards | Question: show all card type codes. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card_type_code, ca... | show all card type codes. |
customers_card_transactions | select distinct card_type_code from customers_cards | Question: what are the different card type codes? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card... | what are the different card type codes? |
customers_card_transactions | select count(distinct card_type_code) from customers_cards | Question: show the number of card types. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card_type_cod... | show the number of card types. |
customers_card_transactions | select count(distinct card_type_code) from customers_cards | Question: how many different card types are there? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, car... | how many different card types are there? |
customers_card_transactions | select distinct transaction_type from financial_transactions | Question: show all transaction types. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card_type_code, ... | show all transaction types. |
customers_card_transactions | select distinct transaction_type from financial_transactions | Question: what are the different types of transactions? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id... | what are the different types of transactions? |
customers_card_transactions | select count(distinct transaction_type) from financial_transactions | Question: show the number of transaction types. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, customer_id, card_t... | show the number of transaction types. |
customers_card_transactions | select count(distinct transaction_type) from financial_transactions | Question: how many different types of transactions are there? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, custo... | how many different types of transactions are there? |
customers_card_transactions | select avg(transaction_amount) , sum(transaction_amount) from financial_transactions | Question: what is the average and total transaction amount? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, custome... | what is the average and total transaction amount? |
customers_card_transactions | select avg(transaction_amount) , sum(transaction_amount) from financial_transactions | Question: return the average transaction amount, as well as the total amount of all transactions. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_detail... | return the average transaction amount, as well as the total amount of all transactions. |
customers_card_transactions | 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 | Question: show the card type codes and the number of transactions. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id, ... | show the card type codes and the number of transactions. |
customers_card_transactions | 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 | Question: what are the different card types, and how many transactions have been made with each? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details... | what are the different card types, and how many transactions have been made with each? |
customers_card_transactions | select transaction_type , count(*) from financial_transactions group by transaction_type | Question: show the transaction type and the number of transactions. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card_id,... | show the transaction type and the number of transactions. |
customers_card_transactions | select transaction_type , count(*) from financial_transactions group by transaction_type | Question: what are the different transaction types, and how many transactions of each have taken place? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_... | what are the different transaction types, and how many transactions of each have taken place? |
customers_card_transactions | select transaction_type from financial_transactions group by transaction_type order by sum(transaction_amount) desc limit 1 | Question: what is the transaction type that has processed the greatest total amount in transactions? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_det... | what is the transaction type that has processed the greatest total amount in transactions? |
customers_card_transactions | select transaction_type from financial_transactions group by transaction_type order by sum(transaction_amount) desc limit 1 | Question: return the type of transaction with the highest total amount. | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -> card... | return the type of transaction with the highest total amount. |
customers_card_transactions | select account_id , count(*) from financial_transactions group by account_id | Question: show the account id and the number of transactions for each account | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone, customer_email, other_customer_details. Customers_Cards -... | show the account id and the number of transactions for each account |
customers_card_transactions | select account_id , count(*) from financial_transactions group by account_id | Question: what are the different account ids that have made financial transactions, as well as how many transactions correspond to each? | Tables: Accounts -> account_id, customer_id, account_name, other_account_details. Customers -> customer_id, customer_first_name, customer_last_name, customer_address, customer_phone... | what are the different account ids that have made financial transactions, as well as how many transactions correspond to each? |
race_track | select count(*) from track | Question: how many tracks do we have? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | how many tracks do we have? |
race_track | select count(*) from track | Question: count the number of tracks. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | count the number of tracks. |
race_track | select name , location from track | Question: show the name and location for all tracks. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name and location for all tracks. |
race_track | select name , location from track | Question: what are the names and locations of all tracks? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names and locations of all tracks? |
race_track | select name , seating from track where year_opened > 2000 order by seating | Question: show names and seatings, ordered by seating for all tracks opened after 2000. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show names and seatings, ordered by seating for all tracks opened after 2000. |
race_track | select name , seating from track where year_opened > 2000 order by seating | Question: what are the names and seatings for all tracks opened after 2000, ordered by seating? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names and seatings for all tracks opened after 2000, ordered by seating? |
race_track | select name , location , seating from track order by year_opened desc limit 1 | Question: what is the name, location and seating for the most recently opened track? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what is the name, location and seating for the most recently opened track? |
race_track | select name , location , seating from track order by year_opened desc limit 1 | Question: return the name, location, and seating of the track that was opened in the most recent year. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | return the name, location, and seating of the track that was opened in the most recent year. |
race_track | select min(seating) , max(seating) , avg(seating) from track | Question: what is the minimum, maximum, and average seating for all tracks. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what is the minimum, maximum, and average seating for all tracks. |
race_track | select min(seating) , max(seating) , avg(seating) from track | Question: return the minimum, maximum, and average seating across all tracks. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | return the minimum, maximum, and average seating across all tracks. |
race_track | select name , location , year_opened from track where seating > (select avg(seating) from track) | Question: show the name, location, open year for all tracks with a seating higher than the average. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name, location, open year for all tracks with a seating higher than the average. |
race_track | select name , location , year_opened from track where seating > (select avg(seating) from track) | Question: what are the names, locations, and years of opening for tracks with seating higher than average? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names, locations, and years of opening for tracks with seating higher than average? |
race_track | select distinct location from track | Question: what are distinct locations where tracks are located? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are distinct locations where tracks are located? |
race_track | select distinct location from track | Question: give the different locations of tracks. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | give the different locations of tracks. |
race_track | select count(*) from race | Question: how many races are there? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | how many races are there? |
race_track | select count(*) from race | Question: count the number of races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | count the number of races. |
race_track | select distinct class from race | Question: what are the distinct classes that races can have? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the distinct classes that races can have? |
race_track | select distinct class from race | Question: return the different classes of races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | return the different classes of races. |
race_track | select name , class , date from race | Question: show name, class, and date for all races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show name, class, and date for all races. |
race_track | select name , class , date from race | Question: what are the names, classes, and dates for all races? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names, classes, and dates for all races? |
race_track | select class , count(*) from race group by class | Question: show the race class and number of races in each class. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the race class and number of races in each class. |
race_track | select class , count(*) from race group by class | Question: what are the different classes of races, and how many races correspond to each? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the different classes of races, and how many races correspond to each? |
race_track | select class from race group by class order by count(*) desc limit 1 | Question: what is the race class with most number of races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what is the race class with most number of races. |
race_track | select class from race group by class order by count(*) desc limit 1 | Question: give the class of races that is most common. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | give the class of races that is most common. |
race_track | select class from race group by class having count(*) >= 2 | Question: list the race class with at least two races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | list the race class with at least two races. |
race_track | select class from race group by class having count(*) >= 2 | Question: what are the classes of races that have two or more corresponding races? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the classes of races that have two or more corresponding races? |
race_track | 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' | Question: what are the names for tracks without a race in class 'gt'. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names for tracks without a race in class 'gt'. |
race_track | 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' | Question: give the names of tracks that do not have a race in the class 'gt'. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | give the names of tracks that do not have a race in the class 'gt'. |
race_track | select name from track where track_id not in (select track_id from race) | Question: show all track names that have had no races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show all track names that have had no races. |
race_track | select name from track where track_id not in (select track_id from race) | Question: return the names of tracks that have no had any races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | return the names of tracks that have no had any races. |
race_track | select year_opened from track where seating between 4000 and 5000 | Question: show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened. |
race_track | select year_opened from track where seating between 4000 and 5000 | Question: what are the years of opening for tracks with seating between 4000 and 5000? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the years of opening for tracks with seating between 4000 and 5000? |
race_track | select t2.name , count(*) from race as t1 join track as t2 on t1.track_id = t2.track_id group by t1.track_id | Question: show the name of track and the number of races in each track. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name of track and the number of races in each track. |
race_track | select t2.name , count(*) from race as t1 join track as t2 on t1.track_id = t2.track_id group by t1.track_id | Question: what are the names of different tracks, and how many races has each had? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names of different tracks, and how many races has each had? |
race_track | 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 | Question: show the name of track with most number of races. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name of track with most number of races. |
race_track | 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 | Question: what is the name of the track that has had the greatest number of races? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what is the name of the track that has had the greatest number of races? |
race_track | select t1.name , t1.date , t2.name from race as t1 join track as t2 on t1.track_id = t2.track_id | Question: show the name and date for each race and its track name. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name and date for each race and its track name. |
race_track | select t1.name , t1.date , t2.name from race as t1 join track as t2 on t1.track_id = t2.track_id | Question: what are the names and dates of races, and the names of the tracks where they are held? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names and dates of races, and the names of the tracks where they are held? |
race_track | 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 | Question: show the name and location of track with 1 race. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | show the name and location of track with 1 race. |
race_track | 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 | Question: what are the names and locations of tracks that have had exactly 1 race? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the names and locations of tracks that have had exactly 1 race? |
race_track | select location from track where seating > 90000 intersect select location from track where seating < 70000 | Question: find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats. | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats. |
race_track | select location from track where seating > 90000 intersect select location from track where seating < 70000 | Question: what are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats? | Tables: race -> Race_ID, Name, Class, Date, Track_ID. track -> Track_ID, Name, Location, Seating, Year_Opened. | Joins: race.Track_ID = track.Track_ID, | what are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats? |
coffee_shop | select count(*) from member where membership_card = 'black' | Question: how many members have the black membership card? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_member -> HH_ID, Member_... | how many members have the black membership card? |
coffee_shop | select count(*) , address from member group by address | Question: find the number of members living in each address. | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_member -> HH_ID, Membe... | find the number of members living in each address. |
coffee_shop | select name from member where address = 'harford' or address = 'waterbury' | Question: give me the names of members whose address is in harford or waterbury. | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_me... | give me the names of members whose address is in harford or waterbury. |
coffee_shop | select name , member_id from member where membership_card = 'black' or age < 30 | Question: find the ids and names of members who are under age 30 or with black membership card. | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge... | find the ids and names of members who are under age 30 or with black membership card. |
coffee_shop | select time_of_purchase , age , address from member order by time_of_purchase | Question: find the purchase time, age and address of each member, and show the results in the order of purchase time. | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, ... | find the purchase time, age and address of each member, and show the results in the order of purchase time. |
coffee_shop | select membership_card from member group by membership_card having count(*) > 5 | Question: which membership card has more than 5 members? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_member -> HH_ID, Member_ID... | which membership card has more than 5 members? |
coffee_shop | select address from member where age < 30 intersect select address from member where age > 40 | Question: which address has both members younger than 30 and members older than 40? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour... | which address has both members younger than 30 and members older than 40? |
coffee_shop | select membership_card from member where address = 'hartford' intersect select membership_card from member where address = 'waterbury' | Question: what is the membership card held by both members living in hartford and ones living in waterbury address? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Nu... | what is the membership card held by both members living in hartford and ones living in waterbury address? |
coffee_shop | select count(*) from member where address != 'hartford' | Question: how many members are not living in hartford? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_member -> HH_ID, Member_ID, ... | how many members are not living in hartford? |
coffee_shop | select address from member except select address from member where membership_card = 'black' | Question: which address do not have any member with the black membership card? | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_memb... | which address do not have any member with the black membership card? |
coffee_shop | select address from shop order by open_year | Question: show the shop addresses ordered by their opening year. | Tables: shop -> Shop_ID, Address, Num_of_staff, Score, Open_Year. member -> Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address. happy_hour -> HH_ID, Shop_ID, Month, Num_of_shaff_in_charge. happy_hour_member -> HH_ID, M... | show the shop addresses ordered by their opening year. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.