brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
What are card ids, customer ids, card types, and card numbers for each customer card?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are card ids, customer ids, card types, and card numbers for each customer card?` to a syntactically-correct PostgreSQL query.
SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards
Show the date valid from and the date valid to for the card with card number '4560596484842'.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the date valid from and the date valid to for the card with card number '4560596484842'.` to a syntactically-correct PostgreSQL query.
SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842"
What are the valid from and valid to dates for the card with the number 4560596484842?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the valid from and valid to dates for the card with the number 4560596484842?` to a syntactically-correct PostgreSQL query.
SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842"
What is the first name, last name, and phone of the customer with card 4560596484842.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the first name, last name, and phone of the customer with card 4560596484842.` to a syntactically-correct PostgreSQL query.
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"
Return the full name and phone of the customer who has card number 4560596484842.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the full name and phone of the customer who has card number 4560596484842.` to a syntactically-correct PostgreSQL query.
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"
How many cards does customer Art Turcotte have?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many cards does customer Art Turcotte have?` to a syntactically-correct PostgreSQL query.
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"
Count the number of cards the customer with the first name Art and last name Turcotte has.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of cards the customer with the first name Art and last name Turcotte has.` to a syntactically-correct PostgreSQL query.
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"
How many debit cards do we have?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many debit cards do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit"
Count the number of customer cards of the type Debit.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of customer cards of the type Debit.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit"
How many credit cards does customer Blanche Huels have?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many credit cards does customer Blanche Huels have?` to a syntactically-correct PostgreSQL query.
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"
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of credit cards that the customer with first name Blanche and last name Huels has.` to a syntactically-correct PostgreSQL query.
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"
Show all customer ids and the number of cards owned by each customer.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all customer ids and the number of cards owned by each customer.` to a syntactically-correct PostgreSQL query.
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id
What are the different customer ids, and how many cards does each one hold?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different customer ids, and how many cards does each one hold?` to a syntactically-correct PostgreSQL query.
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id
What is the customer id with most number of cards, and how many does he have?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the customer id with most number of cards, and how many does he have?` to a syntactically-correct PostgreSQL query.
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1
Return the id of the customer who has the most cards, as well as the number of cards.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the id of the customer who has the most cards, as well as the number of cards.` to a syntactically-correct PostgreSQL query.
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1
Show id, first and last names for all customers with at least two cards.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show id, first and last names for all customers with at least two cards.` to a syntactically-correct PostgreSQL query.
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
What are the ids and full names of customers who hold two or more cards?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and full names of customers who hold two or more cards?` to a syntactically-correct PostgreSQL query.
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
What is the customer id, first and last name with least number of accounts.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the customer id, first and last name with least number of accounts.` to a syntactically-correct PostgreSQL query.
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
Return the id and full name of the customer who has the fewest accounts.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the id and full name of the customer who has the fewest accounts.` to a syntactically-correct PostgreSQL query.
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
Show all card type codes and the number of cards in each type.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all card type codes and the number of cards in each type.` to a syntactically-correct PostgreSQL query.
SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code
What are the different card types, and how many cards are there of each?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different card types, and how many cards are there of each?` to a syntactically-correct PostgreSQL query.
SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code
What is the card type code with most number of cards?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the card type code with most number of cards?` to a syntactically-correct PostgreSQL query.
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1
Return the code of the card type that is most common.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the code of the card type that is most common.` to a syntactically-correct PostgreSQL query.
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1
Show card type codes with at least 5 cards.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show card type codes with at least 5 cards.` to a syntactically-correct PostgreSQL query.
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5
What are the codes of card types that have 5 or more cards?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the codes of card types that have 5 or more cards?` to a syntactically-correct PostgreSQL query.
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5
Show all card type codes and the number of customers holding cards in each type.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all card type codes and the number of customers holding cards in each type.` to a syntactically-correct PostgreSQL query.
SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
What are the different card type codes, and how many different customers hold each type?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different card type codes, and how many different customers hold each type?` to a syntactically-correct PostgreSQL query.
SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
Show the customer ids and firstname without a credit card.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the customer ids and firstname without a credit card.` to a syntactically-correct PostgreSQL query.
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"
What are the ids and first names of customers who do not hold a credit card?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and first names of customers who do not hold a credit card?` to a syntactically-correct PostgreSQL query.
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"
Show all card type codes.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all card type codes.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT card_type_code FROM Customers_Cards
What are the different card type codes?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different card type codes?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT card_type_code FROM Customers_Cards
Show the number of card types.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the number of card types.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT card_type_code) FROM Customers_Cards
How many different card types are there?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many different card types are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT card_type_code) FROM Customers_Cards
Show all transaction types.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all transaction types.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT transaction_type FROM Financial_Transactions
What are the different types of transactions?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different types of transactions?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT transaction_type FROM Financial_Transactions
Show the number of transaction types.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the number of transaction types.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT transaction_type) FROM Financial_Transactions
How many different types of transactions are there?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many different types of transactions are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT transaction_type) FROM Financial_Transactions
What is the average and total transaction amount?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average and total transaction amount?` to a syntactically-correct PostgreSQL query.
SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
Return the average transaction amount, as well as the total amount of all transactions.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the average transaction amount, as well as the total amount of all transactions.` to a syntactically-correct PostgreSQL query.
SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
Show the card type codes and the number of transactions.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the card type codes and the number of transactions.` to a syntactically-correct PostgreSQL query.
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
What are the different card types, and how many transactions have been made with each?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different card types, and how many transactions have been made with each?` to a syntactically-correct PostgreSQL query.
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
Show the transaction type and the number of transactions.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the transaction type and the number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type
What are the different transaction types, and how many transactions of each have taken place?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different transaction types, and how many transactions of each have taken place?` to a syntactically-correct PostgreSQL query.
SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type
What is the transaction type that has processed the greatest total amount in transactions?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the transaction type that has processed the greatest total amount in transactions?` to a syntactically-correct PostgreSQL query.
SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1
Return the type of transaction with the highest total amount.
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the type of transaction with the highest total amount.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY sum(transaction_amount) DESC LIMIT 1
Show the account id and the number of transactions for each account
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the account id and the number of transactions for each account` to a syntactically-correct PostgreSQL query.
SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id
What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?
-- Language PostgreSQL -- Tables: -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['account name', 'text'], ['other account details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer last name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['other customer details', 'text']] -- Table: customers cards columns : [['card id', 'number'], ['customer id', 'number'], ['card type code', 'text'], ['card number', 'text'], ['date valid from', 'time'], ['date valid to', 'time'], ['other card details', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['previous transaction id', 'number'], ['account id', 'number'], ['card id', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?` to a syntactically-correct PostgreSQL query.
SELECT account_id , count(*) FROM Financial_transactions GROUP BY account_id
How many tracks do we have?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many tracks do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM track
Count the number of tracks.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of tracks.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM track
Show the name and location for all tracks.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name and location for all tracks.` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION FROM track
What are the names and locations of all tracks?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and locations of all tracks?` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION FROM track
Show names and seatings, ordered by seating for all tracks opened after 2000.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show names and seatings, ordered by seating for all tracks opened after 2000.` to a syntactically-correct PostgreSQL query.
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
What are the names and seatings for all tracks opened after 2000, ordered by seating?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and seatings for all tracks opened after 2000, ordered by seating?` to a syntactically-correct PostgreSQL query.
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
What is the name, location and seating for the most recently opened track?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name, location and seating for the most recently opened track?` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1
Return the name, location, and seating of the track that was opened in the most recent year.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the name, location, and seating of the track that was opened in the most recent year.` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1
What is the minimum, maximum, and average seating for all tracks.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the minimum, maximum, and average seating for all tracks.` to a syntactically-correct PostgreSQL query.
SELECT min(seating) , max(seating) , avg(seating) FROM track
Return the minimum, maximum, and average seating across all tracks.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the minimum, maximum, and average seating across all tracks.` to a syntactically-correct PostgreSQL query.
SELECT min(seating) , max(seating) , avg(seating) FROM track
Show the name, location, open year for all tracks with a seating higher than the average.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name, location, open year for all tracks with a seating higher than the average.` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
What are the names, locations, and years of opening for tracks with seating higher than average?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names, locations, and years of opening for tracks with seating higher than average?` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
What are distinct locations where tracks are located?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are distinct locations where tracks are located?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT LOCATION FROM track
Give the different locations of tracks.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the different locations of tracks.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT LOCATION FROM track
How many races are there?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many races are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM race
Count the number of races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of races.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM race
What are the distinct classes that races can have?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the distinct classes that races can have?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT CLASS FROM race
Return the different classes of races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the different classes of races.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT CLASS FROM race
Show name, class, and date for all races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show name, class, and date for all races.` to a syntactically-correct PostgreSQL query.
SELECT name , CLASS , date FROM race
What are the names, classes, and dates for all races?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names, classes, and dates for all races?` to a syntactically-correct PostgreSQL query.
SELECT name , CLASS , date FROM race
Show the race class and number of races in each class.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the race class and number of races in each class.` to a syntactically-correct PostgreSQL query.
SELECT CLASS , count(*) FROM race GROUP BY CLASS
What are the different classes of races, and how many races correspond to each?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different classes of races, and how many races correspond to each?` to a syntactically-correct PostgreSQL query.
SELECT CLASS , count(*) FROM race GROUP BY CLASS
What is the race class with most number of races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the race class with most number of races.` to a syntactically-correct PostgreSQL query.
SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
Give the class of races that is most common.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the class of races that is most common.` to a syntactically-correct PostgreSQL query.
SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
List the race class with at least two races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the race class with at least two races.` to a syntactically-correct PostgreSQL query.
SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2
What are the classes of races that have two or more corresponding races?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the classes of races that have two or more corresponding races?` to a syntactically-correct PostgreSQL query.
SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2
What are the names for tracks without a race in class 'GT'.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names for tracks without a race in class 'GT'.` to a syntactically-correct PostgreSQL query.
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'
Give the names of tracks that do not have a race in the class 'GT'.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the names of tracks that do not have a race in the class 'GT'.` to a syntactically-correct PostgreSQL query.
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'
Show all track names that have had no races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all track names that have had no races.` to a syntactically-correct PostgreSQL query.
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
Return the names of tracks that have no had any races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the names of tracks that have no had any races.` to a syntactically-correct PostgreSQL query.
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.` to a syntactically-correct PostgreSQL query.
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
What are the years of opening for tracks with seating between 4000 and 5000?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the years of opening for tracks with seating between 4000 and 5000?` to a syntactically-correct PostgreSQL query.
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
Show the name of track and the number of races in each track.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name of track and the number of races in each track.` to a syntactically-correct PostgreSQL query.
SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
What are the names of different tracks, and how many races has each had?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of different tracks, and how many races has each had?` to a syntactically-correct PostgreSQL query.
SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
Show the name of track with most number of races.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name of track with most number of races.` to a syntactically-correct PostgreSQL query.
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
What is the name of the track that has had the greatest number of races?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name of the track that has had the greatest number of races?` to a syntactically-correct PostgreSQL query.
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
Show the name and date for each race and its track name.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name and date for each race and its track name.` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
What are the names and dates of races, and the names of the tracks where they are held?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and dates of races, and the names of the tracks where they are held?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
Show the name and location of track with 1 race.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name and location of track with 1 race.` to a syntactically-correct PostgreSQL query.
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
What are the names and locations of tracks that have had exactly 1 race?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and locations of tracks that have had exactly 1 race?` to a syntactically-correct PostgreSQL query.
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
Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?
-- Language PostgreSQL -- Tables: -- Table: race columns : [['race id', 'number'], ['name', 'text'], ['class', 'text'], ['date', 'text'], ['track id', 'text']] -- Table: track columns : [['track id', 'number'], ['name', 'text'], ['location', 'text'], ['seating', 'number'], ['year opened', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
How many members have the black membership card?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many members have the black membership card?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM member WHERE Membership_card = 'Black'
Find the number of members living in each address.
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of members living in each address.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , address FROM member GROUP BY address
Give me the names of members whose address is in Harford or Waterbury.
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give me the names of members whose address is in Harford or Waterbury.` to a syntactically-correct PostgreSQL query.
SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'
Find the ids and names of members who are under age 30 or with black membership card.
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the ids and names of members who are under age 30 or with black membership card.` to a syntactically-correct PostgreSQL query.
SELECT name , member_id FROM member WHERE Membership_card = 'Black' OR age < 30
Find the purchase time, age and address of each member, and show the results in the order of purchase time.
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the purchase time, age and address of each member, and show the results in the order of purchase time.` to a syntactically-correct PostgreSQL query.
SELECT Time_of_purchase , age , address FROM member ORDER BY Time_of_purchase
Which membership card has more than 5 members?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which membership card has more than 5 members?` to a syntactically-correct PostgreSQL query.
SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*) > 5
Which address has both members younger than 30 and members older than 40?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which address has both members younger than 30 and members older than 40?` to a syntactically-correct PostgreSQL query.
SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40
What is the membership card held by both members living in Hartford and ones living in Waterbury address?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the membership card held by both members living in Hartford and ones living in Waterbury address?` to a syntactically-correct PostgreSQL query.
SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'
How many members are not living in Hartford?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many members are not living in Hartford?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM member WHERE address != 'Hartford'
Which address do not have any member with the black membership card?
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which address do not have any member with the black membership card?` to a syntactically-correct PostgreSQL query.
SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'
Show the shop addresses ordered by their opening year.
-- Language PostgreSQL -- Tables: -- Table: shop columns : [['shop id', 'number'], ['address', 'text'], ['num of staff', 'text'], ['score', 'number'], ['open year', 'text']] -- Table: member columns : [['member id', 'number'], ['name', 'text'], ['membership card', 'text'], ['age', 'number'], ['time of purchase', 'number'], ['level of membership', 'number'], ['address', 'text']] -- Table: happy hour columns : [['hh id', 'number'], ['shop id', 'number'], ['month', 'text'], ['num of shaff in charge', 'number']] -- Table: happy hour member columns : [['hh id', 'number'], ['member id', 'number'], ['total amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the shop addresses ordered by their opening year.` to a syntactically-correct PostgreSQL query.
SELECT address FROM shop ORDER BY open_year