messages
listlengths
3
3
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are card ids, customer ids, card types, and card numbers for each customer card?\nSELECT \n" }, { "role": "assistant", "content": "card_id , customer_id , card_type_code , card_number from customers_cards" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the date valid from and the date valid to for the card with card number '4560596484842'.\nSELECT \n" }, { "role": "assistant", "content": "date_valid_from , date_valid_to from customers_cards where card_number = '4560596484842'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the valid from and valid to dates for the card with the number 4560596484842?\nSELECT \n" }, { "role": "assistant", "content": "date_valid_from , date_valid_to from customers_cards where card_number = '4560596484842'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the first name, last name, and phone of the customer with card 4560596484842.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_first_name , customers.customer_last_name , customers.customer_phone from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers_cards.card_number = '4560596484842'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the full name and phone of the customer who has card number 4560596484842.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_first_name , customers.customer_last_name , customers.customer_phone from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers_cards.card_number = '4560596484842'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### How many cards does customer Art Turcotte have?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers.customer_first_name = 'Art' and customers.customer_last_name = 'Turcotte'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Count the number of cards the customer with the first name Art and last name Turcotte has.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers.customer_first_name = 'Art' and customers.customer_last_name = 'Turcotte'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### How many debit cards do we have?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards where card_type_code = 'Debit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Count the number of customer cards of the type Debit.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards where card_type_code = 'Debit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### How many credit cards does customer Blanche Huels have?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers.customer_first_name = 'Blanche' and customers.customer_last_name = 'Huels' and customers_cards.card_type_code = 'Credit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Count the number of credit cards that the customer with first name Blanche and last name Huels has.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from customers_cards join customers on customers_cards.customer_id = customers.customer_id where customers.customer_first_name = 'Blanche' and customers.customer_last_name = 'Huels' and customers_cards.card_type_code = 'Credit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show all customer ids and the number of cards owned by each customer.\nSELECT \n" }, { "role": "assistant", "content": "customer_id , count ( * ) from customers_cards group by customer_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different customer ids, and how many cards does each one hold?\nSELECT \n" }, { "role": "assistant", "content": "customer_id , count ( * ) from customers_cards group by customer_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the customer id with most number of cards, and how many does he have?\nSELECT \n" }, { "role": "assistant", "content": "customer_id , count ( * ) from customers_cards group by customer_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the id of the customer who has the most cards, as well as the number of cards.\nSELECT \n" }, { "role": "assistant", "content": "customer_id , count ( * ) from customers_cards group by customer_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show id, first and last names for all customers with at least two cards.\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.customer_id , customers.customer_first_name , customers.customer_last_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id group by customers_cards.customer_id having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the ids and full names of customers who hold two or more cards?\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.customer_id , customers.customer_first_name , customers.customer_last_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id group by customers_cards.customer_id having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the customer id, first and last name with least number of accounts.\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.customer_id , customers.customer_first_name , customers.customer_last_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id group by customers_cards.customer_id order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the id and full name of the customer who has the fewest accounts.\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.customer_id , customers.customer_first_name , customers.customer_last_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id group by customers_cards.customer_id order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show all card type codes and the number of cards in each type.\nSELECT \n" }, { "role": "assistant", "content": "card_type_code , count ( * ) from customers_cards group by card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different card types, and how many cards are there of each?\nSELECT \n" }, { "role": "assistant", "content": "card_type_code , count ( * ) from customers_cards group by card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the card type code with most number of cards?\nSELECT \n" }, { "role": "assistant", "content": "card_type_code from customers_cards group by card_type_code order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the code of the card type that is most common.\nSELECT \n" }, { "role": "assistant", "content": "card_type_code from customers_cards group by card_type_code order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show card type codes with at least 5 cards.\nSELECT \n" }, { "role": "assistant", "content": "card_type_code from customers_cards group by card_type_code having count ( * ) >= 5" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the codes of card types that have 5 or more cards?\nSELECT \n" }, { "role": "assistant", "content": "card_type_code from customers_cards group by card_type_code having count ( * ) >= 5" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show all card type codes and the number of customers holding cards in each type.\nSELECT \n" }, { "role": "assistant", "content": "card_type_code , count ( distinct customer_id ) from customers_cards group by card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different card type codes, and how many different customers hold each type?\nSELECT \n" }, { "role": "assistant", "content": "card_type_code , count ( distinct customer_id ) from customers_cards group by card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the customer ids and firstname without a credit card.\nSELECT \n" }, { "role": "assistant", "content": "customer_id , customer_first_name from customers except select customers_cards.customer_id , customers.customer_first_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id where card_type_code = 'Credit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the ids and first names of customers who do not hold a credit card?\nSELECT \n" }, { "role": "assistant", "content": "customer_id , customer_first_name from customers except select customers_cards.customer_id , customers.customer_first_name from customers_cards join customers on customers_cards.customer_id = customers.customer_id where card_type_code = 'Credit'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show all card type codes.\nSELECT \n" }, { "role": "assistant", "content": "distinct card_type_code from customers_cards" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different card type codes?\nSELECT \n" }, { "role": "assistant", "content": "distinct card_type_code from customers_cards" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the number of card types.\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct card_type_code ) from customers_cards" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### How many different card types are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct card_type_code ) from customers_cards" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show all transaction types.\nSELECT \n" }, { "role": "assistant", "content": "distinct transaction_type from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different types of transactions?\nSELECT \n" }, { "role": "assistant", "content": "distinct transaction_type from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the number of transaction types.\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct transaction_type ) from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### How many different types of transactions are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct transaction_type ) from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the average and total transaction amount?\nSELECT \n" }, { "role": "assistant", "content": "avg ( transaction_amount ) , sum ( transaction_amount ) from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the average transaction amount, as well as the total amount of all transactions.\nSELECT \n" }, { "role": "assistant", "content": "avg ( transaction_amount ) , sum ( transaction_amount ) from financial_transactions" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the card type codes and the number of transactions.\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.card_type_code , count ( * ) from financial_transactions join customers_cards on financial_transactions.card_id = customers_cards.card_id group by customers_cards.card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different card types, and how many transactions have been made with each?\nSELECT \n" }, { "role": "assistant", "content": "customers_cards.card_type_code , count ( * ) from financial_transactions join customers_cards on financial_transactions.card_id = customers_cards.card_id group by customers_cards.card_type_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the transaction type and the number of transactions.\nSELECT \n" }, { "role": "assistant", "content": "transaction_type , count ( * ) from financial_transactions group by transaction_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different transaction types, and how many transactions of each have taken place?\nSELECT \n" }, { "role": "assistant", "content": "transaction_type , count ( * ) from financial_transactions group by transaction_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What is the transaction type that has processed the greatest total amount in transactions?\nSELECT \n" }, { "role": "assistant", "content": "transaction_type from financial_transactions group by transaction_type order by sum ( transaction_amount ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Return the type of transaction with the highest total amount.\nSELECT \n" }, { "role": "assistant", "content": "transaction_type from financial_transactions group by transaction_type order by sum ( transaction_amount ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### Show the account id and the number of transactions for each account\nSELECT \n" }, { "role": "assistant", "content": "account_id , count ( * ) from financial_transactions group by account_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# accounts ( account_id , customer_id , account_name , other_account_details )\n# customers ( customer_id , customer_first_name , customer_last_name , customer_address , customer_phone , customer_email , other_customer_details )\n# customers_cards ( card_id , customer_id , card_type_code , card_number , date_valid_from , date_valid_to , other_card_details )\n# financial_transactions ( transaction_id , previous_transaction_id , account_id , card_id , transaction_type , transaction_date , transaction_amount , transaction_comment , other_transaction_details )\n# financial_transactions.account_id = accounts.account_id\n# financial_transactions.card_id = customers_cards.card_id\n\n#\n### What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?\nSELECT \n" }, { "role": "assistant", "content": "account_id , count ( * ) from financial_transactions group by account_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### How many tracks do we have?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Count the number of tracks.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name and location for all tracks.\nSELECT \n" }, { "role": "assistant", "content": "name , location from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names and locations of all tracks?\nSELECT \n" }, { "role": "assistant", "content": "name , location from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show names and seatings, ordered by seating for all tracks opened after 2000.\nSELECT \n" }, { "role": "assistant", "content": "name , seating from track where year_opened > 2000 order by seating asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names and seatings for all tracks opened after 2000, ordered by seating?\nSELECT \n" }, { "role": "assistant", "content": "name , seating from track where year_opened > 2000 order by seating asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What is the name, location and seating for the most recently opened track?\nSELECT \n" }, { "role": "assistant", "content": "name , location , seating from track order by year_opened desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Return the name, location, and seating of the track that was opened in the most recent year.\nSELECT \n" }, { "role": "assistant", "content": "name , location , seating from track order by year_opened desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What is the minimum, maximum, and average seating for all tracks.\nSELECT \n" }, { "role": "assistant", "content": "min ( seating ) , max ( seating ) , avg ( seating ) from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Return the minimum, maximum, and average seating across all tracks.\nSELECT \n" }, { "role": "assistant", "content": "min ( seating ) , max ( seating ) , avg ( seating ) from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name, location, open year for all tracks with a seating higher than the average.\nSELECT \n" }, { "role": "assistant", "content": "name , location , year_opened from track where seating > ( select avg ( seating ) from track )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names, locations, and years of opening for tracks with seating higher than average?\nSELECT \n" }, { "role": "assistant", "content": "name , location , year_opened from track where seating > ( select avg ( seating ) from track )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are distinct locations where tracks are located?\nSELECT \n" }, { "role": "assistant", "content": "distinct location from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Give the different locations of tracks.\nSELECT \n" }, { "role": "assistant", "content": "distinct location from track" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### How many races are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Count the number of races.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the distinct classes that races can have?\nSELECT \n" }, { "role": "assistant", "content": "distinct class from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Return the different classes of races.\nSELECT \n" }, { "role": "assistant", "content": "distinct class from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show name, class, and date for all races.\nSELECT \n" }, { "role": "assistant", "content": "name , class , date from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names, classes, and dates for all races?\nSELECT \n" }, { "role": "assistant", "content": "name , class , date from race" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the race class and number of races in each class.\nSELECT \n" }, { "role": "assistant", "content": "class , count ( * ) from race group by class" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the different classes of races, and how many races correspond to each?\nSELECT \n" }, { "role": "assistant", "content": "class , count ( * ) from race group by class" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What is the race class with most number of races.\nSELECT \n" }, { "role": "assistant", "content": "class from race group by class order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Give the class of races that is most common.\nSELECT \n" }, { "role": "assistant", "content": "class from race group by class order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### List the race class with at least two races.\nSELECT \n" }, { "role": "assistant", "content": "class from race group by class having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the classes of races that have two or more corresponding races?\nSELECT \n" }, { "role": "assistant", "content": "class from race group by class having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names for tracks without a race in class 'GT'.\nSELECT \n" }, { "role": "assistant", "content": "name from track except select track.name from race join track on race.track_id = track.track_id where race.class = 'GT'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Give the names of tracks that do not have a race in the class 'GT'.\nSELECT \n" }, { "role": "assistant", "content": "name from track except select track.name from race join track on race.track_id = track.track_id where race.class = 'GT'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show all track names that have had no races.\nSELECT \n" }, { "role": "assistant", "content": "name from track where track_id not in ( select track_id from race )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Return the names of tracks that have no had any races.\nSELECT \n" }, { "role": "assistant", "content": "name from track where track_id not in ( select track_id from race )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.\nSELECT \n" }, { "role": "assistant", "content": "year_opened from track where seating between 4000 and 5000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the years of opening for tracks with seating between 4000 and 5000?\nSELECT \n" }, { "role": "assistant", "content": "year_opened from track where seating between 4000 and 5000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name of track and the number of races in each track.\nSELECT \n" }, { "role": "assistant", "content": "track.name , count ( * ) from race join track on race.track_id = track.track_id group by race.track_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names of different tracks, and how many races has each had?\nSELECT \n" }, { "role": "assistant", "content": "track.name , count ( * ) from race join track on race.track_id = track.track_id group by race.track_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name of track with most number of races.\nSELECT \n" }, { "role": "assistant", "content": "track.name from race join track on race.track_id = track.track_id group by race.track_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What is the name of the track that has had the greatest number of races?\nSELECT \n" }, { "role": "assistant", "content": "track.name from race join track on race.track_id = track.track_id group by race.track_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name and date for each race and its track name.\nSELECT \n" }, { "role": "assistant", "content": "race.name , race.date , track.name from race join track on race.track_id = track.track_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names and dates of races, and the names of the tracks where they are held?\nSELECT \n" }, { "role": "assistant", "content": "race.name , race.date , track.name from race join track on race.track_id = track.track_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Show the name and location of track with 1 race.\nSELECT \n" }, { "role": "assistant", "content": "track.name , track.location from race join track on race.track_id = track.track_id group by race.track_id having count ( * ) = 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the names and locations of tracks that have had exactly 1 race?\nSELECT \n" }, { "role": "assistant", "content": "track.name , track.location from race join track on race.track_id = track.track_id group by race.track_id having count ( * ) = 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.\nSELECT \n" }, { "role": "assistant", "content": "location from track where seating > 90000 intersect select location from track where seating < 70000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# race ( race_id , name , class , date , track_id )\n# track ( track_id , name , location , seating , year_opened )\n# race.track_id = track.track_id\n\n#\n### What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?\nSELECT \n" }, { "role": "assistant", "content": "location from track where seating > 90000 intersect select location from track where seating < 70000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### How many members have the black membership card?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from member where membership_card = 'Black'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Find the number of members living in each address.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) , address from member group by address" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Give me the names of members whose address is in Harford or Waterbury.\nSELECT \n" }, { "role": "assistant", "content": "name from member where address = 'Harford' or address = 'Waterbury'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Find the ids and names of members who are under age 30 or with black membership card.\nSELECT \n" }, { "role": "assistant", "content": "name , member_id from member where membership_card = 'Black' or age < 30" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Find the purchase time, age and address of each member, and show the results in the order of purchase time.\nSELECT \n" }, { "role": "assistant", "content": "time_of_purchase , age , address from member order by time_of_purchase asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Which membership card has more than 5 members?\nSELECT \n" }, { "role": "assistant", "content": "membership_card from member group by membership_card having count ( * ) > 5" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Which address has both members younger than 30 and members older than 40?\nSELECT \n" }, { "role": "assistant", "content": "address from member where age < 30 intersect select address from member where age > 40" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### What is the membership card held by both members living in Hartford and ones living in Waterbury address?\nSELECT \n" }, { "role": "assistant", "content": "membership_card from member where address = 'Hartford' intersect select membership_card from member where address = 'Waterbury'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### How many members are not living in Hartford?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from member where address != 'Hartford'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Which address do not have any member with the black membership card?\nSELECT \n" }, { "role": "assistant", "content": "address from member except select address from member where membership_card = 'Black'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# shop ( shop_id , address , num_of_staff , score , open_year )\n# member ( member_id , name , membership_card , age , time_of_purchase , level_of_membership , address )\n# happy_hour ( hh_id , shop_id , month , num_of_shaff_in_charge )\n# happy_hour_member ( hh_id , member_id , total_amount )\n# happy_hour.shop_id = shop.shop_id\n# happy_hour_member.member_id = member.member_id\n\n#\n### Show the shop addresses ordered by their opening year.\nSELECT \n" }, { "role": "assistant", "content": "address from shop order by open_year asc" } ]