db_id
stringclasses
140 values
messages
listlengths
2
2
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are card ids, customer ids, card types, and card numbers for each customer card?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the date valid from and the date valid to for the card with card number '4560596484842'.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = \"4560596484842\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the valid from and valid to dates for the card with the number 4560596484842?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = \"4560596484842\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the first name, last name, and phone of the customer with card 4560596484842.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = \"4560596484842\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the full name and phone of the customer who has card number 4560596484842.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = \"4560596484842\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: How many cards does customer Art Turcotte have?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Art\" AND T2.customer_last_name = \"Turcotte\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Count the number of cards the customer with the first name Art and last name Turcotte has.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Art\" AND T2.customer_last_name = \"Turcotte\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: How many debit cards do we have?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards WHERE card_type_code = \"Debit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Count the number of customer cards of the type Debit.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards WHERE card_type_code = \"Debit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: How many credit cards does customer Blanche Huels have?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Blanche\" AND T2.customer_last_name = \"Huels\" AND T1.card_type_code = \"Credit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Count the number of credit cards that the customer with first name Blanche and last name Huels has.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Blanche\" AND T2.customer_last_name = \"Huels\" AND T1.card_type_code = \"Credit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show all customer ids and the number of cards owned by each customer.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different customer ids, and how many cards does each one hold?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the customer id with most number of cards, and how many does he have?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the id of the customer who has the most cards, as well as the number of cards.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show id, first and last names for all customers with at least two cards.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the ids and full names of customers who hold two or more cards?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the customer id, first and last name with least number of accounts.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the id and full name of the customer who has the fewest accounts.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show all card type codes and the number of cards in each type.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different card types, and how many cards are there of each?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the card type code with most number of cards?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the code of the card type that is most common.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show card type codes with at least 5 cards.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the codes of card types that have 5 or more cards?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show all card type codes and the number of customers holding cards in each type.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different card type codes, and how many different customers hold each type?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the customer ids and firstname without a credit card.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = \"Credit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the ids and first names of customers who do not hold a credit card?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = \"Credit\"", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show all card type codes.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT DISTINCT card_type_code FROM Customers_Cards", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different card type codes?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT DISTINCT card_type_code FROM Customers_Cards", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the number of card types.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT card_type_code) FROM Customers_Cards", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: How many different card types are there?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT card_type_code) FROM Customers_Cards", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show all transaction types.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT DISTINCT transaction_type FROM Financial_Transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different types of transactions?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT DISTINCT transaction_type FROM Financial_Transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the number of transaction types.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT transaction_type) FROM Financial_Transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: How many different types of transactions are there?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT transaction_type) FROM Financial_Transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the average and total transaction amount?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the average transaction amount, as well as the total amount of all transactions.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the card type codes and the number of transactions.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T2.card_type_code , count(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different card types, and how many transactions have been made with each?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT T2.card_type_code , count(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the transaction type and the number of transactions.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different transaction types, and how many transactions of each have taken place?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What is the transaction type that has processed the greatest total amount in transactions?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Return the type of transaction with the highest total amount.\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: Show the account id and the number of transactions for each account\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id", "role": "assistant" } ]
customers_card_transactions
[ { "content": "Translate the following question to SQL: What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?\n\nSchema: CREATE TABLE Accounts (\n account_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n account_name VARCHAR(50),\n other_account_details VARCHAR(255)\n);\n\nCREATE TABLE Customers (\n customer_id INTEGER PRIMARY KEY,\n customer_first_name VARCHAR(20),\n customer_last_name VARCHAR(20),\n customer_address VARCHAR(255),\n customer_phone VARCHAR(255),\n customer_email VARCHAR(255),\n other_customer_details VARCHAR(255)\n);\n\nCREATE TABLE Customers_Cards (\n card_id INTEGER PRIMARY KEY,\n customer_id INTEGER NOT NULL,\n card_type_code VARCHAR(15) NOT NULL,\n card_number VARCHAR(80),\n date_valid_from DATETIME,\n date_valid_to DATETIME,\n other_card_details VARCHAR(255)\n);\n\nCREATE TABLE Financial_Transactions (\n transaction_id INTEGER NOT NULL,\n previous_transaction_id INTEGER,\n account_id INTEGER NOT NULL,\n card_id INTEGER NOT NULL,\n transaction_type VARCHAR(15) NOT NULL,\n transaction_date DATETIME,\n transaction_amount DOUBLE,\n transaction_comment VARCHAR(255),\n other_transaction_details VARCHAR(255),\n FOREIGN KEY (account_id) REFERENCES Accounts(account_id),\n FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)\n);", "role": "user" }, { "content": "SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: How many tracks do we have?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Count the number of tracks.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name and location for all tracks.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names and locations of all tracks?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show names and seatings, ordered by seating for all tracks opened after 2000.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names and seatings for all tracks opened after 2000, ordered by seating?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What is the name, location and seating for the most recently opened track?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Return the name, location, and seating of the track that was opened in the most recent year.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What is the minimum, maximum, and average seating for all tracks.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT min(seating) , max(seating) , avg(seating) FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Return the minimum, maximum, and average seating across all tracks.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT min(seating) , max(seating) , avg(seating) FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name, location, open year for all tracks with a seating higher than the average.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names, locations, and years of opening for tracks with seating higher than average?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are distinct locations where tracks are located?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT LOCATION FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Give the different locations of tracks.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT LOCATION FROM track", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: How many races are there?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Count the number of races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the distinct classes that races can have?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT CLASS FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Return the different classes of races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT CLASS FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show name, class, and date for all races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , CLASS , date FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names, classes, and dates for all races?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name , CLASS , date FROM race", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the race class and number of races in each class.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS , count(*) FROM race GROUP BY CLASS", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the different classes of races, and how many races correspond to each?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS , count(*) FROM race GROUP BY CLASS", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What is the race class with most number of races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Give the class of races that is most common.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: List the race class with at least two races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the classes of races that have two or more corresponding races?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names for tracks without a race in class 'GT'.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Give the names of tracks that do not have a race in the class 'GT'.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show all track names that have had no races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Return the names of tracks that have no had any races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the years of opening for tracks with seating between 4000 and 5000?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name of track and the number of races in each track.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names of different tracks, and how many races has each had?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name of track with most number of races.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What is the name of the track that has had the greatest number of races?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name and date for each race and its track name.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names and dates of races, and the names of the tracks where they are held?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Show the name and location of track with 1 race.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name , T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING count(*) = 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the names and locations of tracks that have had exactly 1 race?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT T2.name , T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING count(*) = 1", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000", "role": "assistant" } ]
race_track
[ { "content": "Translate the following question to SQL: What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?\n\nSchema: CREATE TABLE race (\n Race_ID INT PRIMARY KEY,\n Name TEXT,\n Class TEXT,\n Date TEXT,\n Track_ID TEXT,\n UNIQUE (Race_ID),\n FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)\n);\n\nCREATE TABLE track (\n Track_ID INT PRIMARY KEY,\n Name TEXT,\n Location TEXT,\n Seating REAL,\n Year_Opened REAL,\n UNIQUE (Track_ID)\n);", "role": "user" }, { "content": "SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: How many members have the black membership card?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM member WHERE Membership_card = 'Black'", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Find the number of members living in each address.\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT count(*) , address FROM member GROUP BY address", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Give me the names of members whose address is in Harford or Waterbury.\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Find the ids and names of members who are under age 30 or with black membership card.\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT name , member_id FROM member WHERE Membership_card = 'Black' OR age < 30", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Find the purchase time, age and address of each member, and show the results in the order of purchase time.\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT Time_of_purchase , age , address FROM member ORDER BY Time_of_purchase", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Which membership card has more than 5 members?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*) > 5", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Which address has both members younger than 30 and members older than 40?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: What is the membership card held by both members living in Hartford and ones living in Waterbury address?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: How many members are not living in Hartford?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM member WHERE address != 'Hartford'", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Which address do not have any member with the black membership card?\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'", "role": "assistant" } ]
coffee_shop
[ { "content": "Translate the following question to SQL: Show the shop addresses ordered by their opening year.\n\nSchema: CREATE TABLE shop (\n Shop_ID INT PRIMARY KEY,\n Address TEXT,\n Num_of_staff TEXT,\n Score REAL,\n Open_Year TEXT,\n UNIQUE (Shop_ID)\n);\n\nCREATE TABLE member (\n Member_ID INT PRIMARY KEY,\n Name TEXT,\n Membership_card TEXT,\n Age INT,\n Time_of_purchase INT,\n Level_of_membership INT,\n Address TEXT,\n UNIQUE (Member_ID)\n);\n\nCREATE TABLE happy_hour (\n HH_ID INT PRIMARY KEY,\n Shop_ID INT PRIMARY KEY,\n Month TEXT PRIMARY KEY,\n Num_of_shaff_in_charge INT,\n PRIMARY KEY (HH_ID, Shop_ID, Month),\n UNIQUE (HH_ID, Shop_ID, Month),\n FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)\n);\n\nCREATE TABLE happy_hour_member (\n HH_ID INT PRIMARY KEY,\n Member_ID INT PRIMARY KEY,\n Total_amount REAL,\n PRIMARY KEY (HH_ID, Member_ID),\n UNIQUE (HH_ID, Member_ID),\n FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)\n);", "role": "user" }, { "content": "SELECT address FROM shop ORDER BY open_year", "role": "assistant" } ]