db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
---|---|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are card ids, customer ids, card types, and card numbers for each customer card?
#
### SQL:
#
# SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the date valid from and the date valid to for the card with card number '4560596484842'.
#
### SQL:
#
# SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the valid from and valid to dates for the card with the number 4560596484842?
#
### SQL:
#
# SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the first name, last name, and phone of the customer with card 4560596484842.
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the full name and phone of the customer who has card number 4560596484842.
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# How many cards does customer Art Turcotte have?
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Count the number of cards the customer with the first name Art and last name Turcotte has.
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# How many debit cards do we have?
#
### SQL:
#
# SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Count the number of customer cards of the type Debit.
#
### SQL:
#
# SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# How many credit cards does customer Blanche Huels have?
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Count the number of credit cards that the customer with first name Blanche and last name Huels has.
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show all customer ids and the number of cards owned by each customer.
#
### SQL:
#
# SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different customer ids, and how many cards does each one hold?
#
### SQL:
#
# SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the customer id with most number of cards, and how many does he have?
#
### SQL:
#
# SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the id of the customer who has the most cards, as well as the number of cards.
#
### SQL:
#
# SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show id, first and last names for all customers with at least two cards.
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the ids and full names of customers who hold two or more cards?
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the customer id, first and last name with least number of accounts.
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the id and full name of the customer who has the fewest accounts.
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show all card type codes and the number of cards in each type.
#
### SQL:
#
# SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different card types, and how many cards are there of each?
#
### SQL:
#
# SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the card type code with most number of cards?
#
### SQL:
#
# SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the code of the card type that is most common.
#
### SQL:
#
# SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show card type codes with at least 5 cards.
#
### SQL:
#
# SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the codes of card types that have 5 or more cards?
#
### SQL:
#
# SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show all card type codes and the number of customers holding cards in each type.
#
### SQL:
#
# SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different card type codes, and how many different customers hold each type?
#
### SQL:
#
# SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the customer ids and firstname without a credit card.
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the ids and first names of customers who do not hold a credit card?
#
### SQL:
#
# 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"
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show all card type codes.
#
### SQL:
#
# SELECT DISTINCT card_type_code FROM Customers_Cards
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different card type codes?
#
### SQL:
#
# SELECT DISTINCT card_type_code FROM Customers_Cards
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the number of card types.
#
### SQL:
#
# SELECT count(DISTINCT card_type_code) FROM Customers_Cards
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# How many different card types are there?
#
### SQL:
#
# SELECT count(DISTINCT card_type_code) FROM Customers_Cards
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show all transaction types.
#
### SQL:
#
# SELECT DISTINCT transaction_type FROM Financial_Transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different types of transactions?
#
### SQL:
#
# SELECT DISTINCT transaction_type FROM Financial_Transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the number of transaction types.
#
### SQL:
#
# SELECT count(DISTINCT transaction_type) FROM Financial_Transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# How many different types of transactions are there?
#
### SQL:
#
# SELECT count(DISTINCT transaction_type) FROM Financial_Transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the average and total transaction amount?
#
### SQL:
#
# SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the average transaction amount, as well as the total amount of all transactions.
#
### SQL:
#
# SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the card type codes and the number of transactions.
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different card types, and how many transactions have been made with each?
#
### SQL:
#
# 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
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the transaction type and the number of transactions.
#
### SQL:
#
# SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different transaction types, and how many transactions of each have taken place?
#
### SQL:
#
# SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What is the transaction type that has processed the greatest total amount in transactions?
#
### SQL:
#
# SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Return the type of transaction with the highest total amount.
#
### SQL:
#
# SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# Show the account id and the number of transactions for each account
#
### SQL:
#
# SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id
#
### End.
|
customers_card_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, card_number, date_valid_from, date_valid_to, other_card_details )
# Financial_Transactions ( transaction_id, previous_transaction_id, account_id, card_id, transaction_type, transaction_date, transaction_amount, transaction_comment, other_transaction_details )
#
# Financial_Transactions.account_id can be joined with Accounts.account_id
# Financial_Transactions.card_id can be joined with Customers_Cards.card_id
#
### Question:
#
# What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?
#
### SQL:
#
# SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# How many tracks do we have?
#
### SQL:
#
# SELECT count(*) FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Count the number of tracks.
#
### SQL:
#
# SELECT count(*) FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name and location for all tracks.
#
### SQL:
#
# SELECT name , LOCATION FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names and locations of all tracks?
#
### SQL:
#
# SELECT name , LOCATION FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show names and seatings, ordered by seating for all tracks opened after 2000.
#
### SQL:
#
# SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names and seatings for all tracks opened after 2000, ordered by seating?
#
### SQL:
#
# SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What is the name, location and seating for the most recently opened track?
#
### SQL:
#
# SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Return the name, location, and seating of the track that was opened in the most recent year.
#
### SQL:
#
# SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What is the minimum, maximum, and average seating for all tracks.
#
### SQL:
#
# SELECT min(seating) , max(seating) , avg(seating) FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Return the minimum, maximum, and average seating across all tracks.
#
### SQL:
#
# SELECT min(seating) , max(seating) , avg(seating) FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name, location, open year for all tracks with a seating higher than the average.
#
### SQL:
#
# SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names, locations, and years of opening for tracks with seating higher than average?
#
### SQL:
#
# SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are distinct locations where tracks are located?
#
### SQL:
#
# SELECT DISTINCT LOCATION FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Give the different locations of tracks.
#
### SQL:
#
# SELECT DISTINCT LOCATION FROM track
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# How many races are there?
#
### SQL:
#
# SELECT count(*) FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Count the number of races.
#
### SQL:
#
# SELECT count(*) FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the distinct classes that races can have?
#
### SQL:
#
# SELECT DISTINCT CLASS FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Return the different classes of races.
#
### SQL:
#
# SELECT DISTINCT CLASS FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show name, class, and date for all races.
#
### SQL:
#
# SELECT name , CLASS , date FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names, classes, and dates for all races?
#
### SQL:
#
# SELECT name , CLASS , date FROM race
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the race class and number of races in each class.
#
### SQL:
#
# SELECT CLASS , count(*) FROM race GROUP BY CLASS
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the different classes of races, and how many races correspond to each?
#
### SQL:
#
# SELECT CLASS , count(*) FROM race GROUP BY CLASS
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What is the race class with most number of races.
#
### SQL:
#
# SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Give the class of races that is most common.
#
### SQL:
#
# SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# List the race class with at least two races.
#
### SQL:
#
# SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the classes of races that have two or more corresponding races?
#
### SQL:
#
# SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names for tracks without a race in class 'GT'.
#
### SQL:
#
# 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'
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Give the names of tracks that do not have a race in the class 'GT'.
#
### SQL:
#
# 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'
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show all track names that have had no races.
#
### SQL:
#
# SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Return the names of tracks that have no had any races.
#
### SQL:
#
# SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
#
### SQL:
#
# SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the years of opening for tracks with seating between 4000 and 5000?
#
### SQL:
#
# SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name of track and the number of races in each track.
#
### SQL:
#
# SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names of different tracks, and how many races has each had?
#
### SQL:
#
# SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name of track with most number of races.
#
### SQL:
#
# 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
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What is the name of the track that has had the greatest number of races?
#
### SQL:
#
# 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
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name and date for each race and its track name.
#
### SQL:
#
# SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names and dates of races, and the names of the tracks where they are held?
#
### SQL:
#
# SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Show the name and location of track with 1 race.
#
### SQL:
#
# 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
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the names and locations of tracks that have had exactly 1 race?
#
### SQL:
#
# 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
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
#
### SQL:
#
# SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
#
### End.
|
race_track
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# race ( Race_ID, Name, Class, Date, Track_ID )
# track ( Track_ID, Name, Location, Seating, Year_Opened )
#
# race.Track_ID can be joined with track.Track_ID
#
### Question:
#
# What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?
#
### SQL:
#
# SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# How many members have the black membership card?
#
### SQL:
#
# SELECT count(*) FROM member WHERE Membership_card = 'Black'
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Find the number of members living in each address.
#
### SQL:
#
# SELECT count(*) , address FROM member GROUP BY address
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Give me the names of members whose address is in Harford or Waterbury.
#
### SQL:
#
# SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Find the ids and names of members who are under age 30 or with black membership card.
#
### SQL:
#
# SELECT name , member_id FROM member WHERE Membership_card = 'Black' OR age < 30
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Find the purchase time, age and address of each member, and show the results in the order of purchase time.
#
### SQL:
#
# SELECT Time_of_purchase , age , address FROM member ORDER BY Time_of_purchase
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Which membership card has more than 5 members?
#
### SQL:
#
# SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*) > 5
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Which address has both members younger than 30 and members older than 40?
#
### SQL:
#
# SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# What is the membership card held by both members living in Hartford and ones living in Waterbury address?
#
### SQL:
#
# SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# How many members are not living in Hartford?
#
### SQL:
#
# SELECT count(*) FROM member WHERE address != 'Hartford'
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Which address do not have any member with the black membership card?
#
### SQL:
#
# SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'
#
### End.
|
coffee_shop
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# 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, Total_amount )
#
# happy_hour.Shop_ID can be joined with shop.Shop_ID
# happy_hour_member.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the shop addresses ordered by their opening year.
#
### SQL:
#
# SELECT address FROM shop ORDER BY open_year
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.