text
stringlengths
114
1.06k
### question: A list of the top 5 countries by number of invoices. List country name and number of invoices. ### answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5 ### context: CREATE TABLE invoices (billing_country VARCHAR)
### question: A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size. ### answer: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8 ### context: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER)
### question: A list of the top 10 countries by average invoice size. List country name and average invoice size. ### answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10 ### context: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER)
### question: Find out 5 customers who most recently purchased something. List customers' first and last name. ### answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5 ### context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR, invoice_date VARCHAR)
### question: Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders. ### answer: SELECT T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10 ### context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR)
### question: List the top 10 customers by total gross sales. List customers' first and last name and total gross sales. ### answer: SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10 ### context: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR)
### question: List the top 5 genres by number of tracks. List genres name and total tracks. ### answer: SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5 ### context: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR)
### question: List every album's title. ### answer: SELECT title FROM albums ### context: CREATE TABLE albums (title VARCHAR)
### question: List every album ordered by album title in ascending order. ### answer: SELECT title FROM albums ORDER BY title ### context: CREATE TABLE albums (title VARCHAR)
### question: List every album whose title starts with A in alphabetical order. ### answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title ### context: CREATE TABLE albums (title VARCHAR)
### question: List the customers first and last name of 10 least expensive invoices. ### answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10 ### context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR)
### question: List total amount of invoice from Chicago, IL. ### answer: SELECT SUM(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL" ### context: CREATE TABLE invoices (total INTEGER, billing_city VARCHAR, billing_state VARCHAR)
### question: List the number of invoices from Chicago, IL. ### answer: SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL" ### context: CREATE TABLE invoices (billing_city VARCHAR, billing_state VARCHAR)
### question: List the number of invoices from the US, grouped by state. ### answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ### context: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR)
### question: List the state in the US with the most invoices. ### answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR)
### question: List the number of invoices and the invoice total from California. ### answer: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = "CA" ### context: CREATE TABLE invoices (billing_state VARCHAR, total INTEGER)
### question: List Aerosmith's albums. ### answer: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith" ### context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR)
### question: How many albums does Billy Cobham has? ### answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham" ### context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (artist_id VARCHAR)
### question: Eduardo Martins is a customer at which company? ### answer: SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins" ### context: CREATE TABLE customers (company VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: What is Astrid Gruber's email and phone number? ### answer: SELECT email, phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber" ### context: CREATE TABLE customers (email VARCHAR, phone VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: How many customers live in Prague city? ### answer: SELECT COUNT(*) FROM customers WHERE city = "Prague" ### context: CREATE TABLE customers (city VARCHAR)
### question: How many customers in state of CA? ### answer: SELECT COUNT(*) FROM customers WHERE state = "CA" ### context: CREATE TABLE customers (state VARCHAR)
### question: What country does Roberto Almeida live? ### answer: SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida" ### context: CREATE TABLE customers (country VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: List the name of albums that are released by aritist whose name has 'Led' ### answer: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%' ### context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR)
### question: How many customers does Steve Johnson support? ### answer: SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson" ### context: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR)
### question: What is the title, phone and hire date of Nancy Edwards? ### answer: SELECT title, phone, hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards" ### context: CREATE TABLE employees (title VARCHAR, phone VARCHAR, hire_date VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: find the full name of employees who report to Nancy Edwards? ### answer: SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards" ### context: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, reports_to VARCHAR)
### question: What is the address of employee Nancy Edwards? ### answer: SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards" ### context: CREATE TABLE employees (address VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: Find the full name of employee who supported the most number of customers. ### answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR)
### question: How many employees are living in Canada? ### answer: SELECT COUNT(*) FROM employees WHERE country = "Canada" ### context: CREATE TABLE employees (country VARCHAR)
### question: What is employee Nancy Edwards's phone number? ### answer: SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards" ### context: CREATE TABLE employees (phone VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: Who is the youngest employee in the company? List employee's first and last name. ### answer: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1 ### context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, birth_date VARCHAR)
### question: List top 10 employee work longest in the company. List employee's first and last name. ### answer: SELECT first_name, last_name FROM employees ORDER BY hire_date LIMIT 10 ### context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR)
### question: Find the number of employees whose title is IT Staff from each city? ### answer: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city ### context: CREATE TABLE employees (city VARCHAR, title VARCHAR)
### question: Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee. ### answer: SELECT T2.first_name, T2.last_name, COUNT(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY COUNT(T1.reports_to) DESC LIMIT 1 ### context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE employees (reports_to VARCHAR)
### question: How many orders does Lucas Mancini has? ### answer: SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini" ### context: CREATE TABLE invoices (customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: What is the total amount of money spent by Lucas Mancini? ### answer: SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini" ### context: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: List all media types. ### answer: SELECT name FROM media_types ### context: CREATE TABLE media_types (name VARCHAR)
### question: List all different genre types. ### answer: SELECT DISTINCT name FROM genres ### context: CREATE TABLE genres (name VARCHAR)
### question: List the name of all playlist. ### answer: SELECT name FROM playlists ### context: CREATE TABLE playlists (name VARCHAR)
### question: Who is the composer of track Fast As a Shark? ### answer: SELECT composer FROM tracks WHERE name = "Fast As a Shark" ### context: CREATE TABLE tracks (composer VARCHAR, name VARCHAR)
### question: How long does track Fast As a Shark has? ### answer: SELECT milliseconds FROM tracks WHERE name = "Fast As a Shark" ### context: CREATE TABLE tracks (milliseconds VARCHAR, name VARCHAR)
### question: What is the name of tracks whose genre is Rock? ### answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock" ### context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR)
### question: What is title of album which track Balls to the Wall belongs to? ### answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = "Balls to the Wall" ### context: CREATE TABLE tracks (genre_id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR)
### question: List name of all tracks in Balls to the Wall. ### answer: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = "Balls to the Wall" ### context: CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR); CREATE TABLE albums (id VARCHAR, title VARCHAR)
### question: List title of albums have the number of tracks greater than 10. ### answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10 ### context: CREATE TABLE tracks (album_id VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR)
### question: List the name of tracks belongs to genre Rock and whose media type is MPEG audio file. ### answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" AND T3.name = "MPEG audio file" ### context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR)
### question: List the name of tracks belongs to genre Rock or media type is MPEG audio file. ### answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" OR T3.name = "MPEG audio file" ### context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR)
### question: List the name of tracks belongs to genre Rock or genre Jazz. ### answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock" OR T1.name = "Jazz" ### context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR)
### question: List the name of all tracks in the playlists of Movies. ### answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = "Movies" ### context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
### question: List the name of playlist which has number of tracks greater than 100. ### answer: SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100 ### context: CREATE TABLE playlist_tracks (playlist_id VARCHAR, track_id VARCHAR); CREATE TABLE playlists (name VARCHAR, id VARCHAR)
### question: List all tracks bought by customer Daan Peeters. ### answer: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = "Daan" AND T4.last_name = "Peeters" ### context: CREATE TABLE invoices (id VARCHAR, customer_id VARCHAR); CREATE TABLE invoice_lines (track_id VARCHAR, invoice_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR)
### question: How much is the track Fast As a Shark? ### answer: SELECT unit_price FROM tracks WHERE name = "Fast As a Shark" ### context: CREATE TABLE tracks (unit_price VARCHAR, name VARCHAR)
### question: Find the name of tracks which are in Movies playlist but not in music playlist. ### answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' ### context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
### question: Find the name of tracks which are in both Movies and music playlists. ### answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' ### context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR)
### question: Find number of tracks in each genre? ### answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name ### context: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR)
### question: How many editors are there? ### answer: SELECT COUNT(*) FROM editor ### context: CREATE TABLE editor (Id VARCHAR)
### question: List the names of editors in ascending order of age. ### answer: SELECT Name FROM editor ORDER BY Age ### context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
### question: What are the names and ages of editors? ### answer: SELECT Name, Age FROM editor ### context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
### question: List the names of editors who are older than 25. ### answer: SELECT Name FROM editor WHERE Age > 25 ### context: CREATE TABLE editor (Name VARCHAR, Age INTEGER)
### question: Show the names of editors of age either 24 or 25. ### answer: SELECT Name FROM editor WHERE Age = 24 OR Age = 25 ### context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
### question: What is the name of the youngest editor? ### answer: SELECT Name FROM editor ORDER BY Age LIMIT 1 ### context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
### question: What are the different ages of editors? Show each age along with the number of editors of that age. ### answer: SELECT Age, COUNT(*) FROM editor GROUP BY Age ### context: CREATE TABLE editor (Age VARCHAR)
### question: Please show the most common age of editors. ### answer: SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE editor (Age VARCHAR)
### question: Show the distinct themes of journals. ### answer: SELECT DISTINCT Theme FROM journal ### context: CREATE TABLE journal (Theme VARCHAR)
### question: Show the names of editors and the theme of journals for which they serve on committees. ### answer: SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ### context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR)
### question: Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme. ### answer: SELECT T2.Name, T2.age, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ### context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, age VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR)
### question: Show the names of editors that are on the committee of journals with sales bigger than 3000. ### answer: SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000 ### context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Journal_ID VARCHAR, Sales INTEGER)
### question: Show the id, name of each editor and the number of journal committees they are on. ### answer: SELECT T1.editor_id, T1.Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id ### context: CREATE TABLE editor (editor_id VARCHAR, Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)
### question: Show the names of editors that are on at least two journal committees. ### answer: SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2 ### context: CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)
### question: List the names of editors that are not on any journal committee. ### answer: SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee) ### context: CREATE TABLE editor (Name VARCHAR, editor_id VARCHAR); CREATE TABLE journal_committee (Name VARCHAR, editor_id VARCHAR)
### question: List the date, theme and sales of the journal which did not have any of the listed editors serving on committee. ### answer: SELECT date, theme, sales FROM journal EXCEPT SELECT T1.date, T1.theme, T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID ### context: CREATE TABLE journal_committee (journal_ID VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR, journal_ID VARCHAR)
### question: What is the average sales of the journals that have an editor whose work type is 'Photo'? ### answer: SELECT AVG(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo' ### context: CREATE TABLE journal_committee (journal_ID VARCHAR, work_type VARCHAR); CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR)
### question: How many accounts do we have? ### answer: SELECT COUNT(*) FROM Accounts ### context: CREATE TABLE Accounts (Id VARCHAR)
### question: Show ids, customer ids, names for all accounts. ### answer: SELECT account_id, customer_id, account_name FROM Accounts ### context: CREATE TABLE Accounts (account_id VARCHAR, customer_id VARCHAR, account_name VARCHAR)
### question: Show other account details for account with name 338. ### answer: SELECT other_account_details FROM Accounts WHERE account_name = "338" ### context: CREATE TABLE Accounts (other_account_details VARCHAR, account_name VARCHAR)
### question: What is the first name, last name, and phone of the customer with account name 162? ### answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162" ### context: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR)
### question: How many accounts does the customer with first name Art and last name Turcotte have? ### answer: SELECT COUNT(*) FROM Accounts 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" ### context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
### question: Show all customer ids and the number of accounts for each customer. ### answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ### context: CREATE TABLE Accounts (customer_id VARCHAR)
### question: Show the customer id and number of accounts with most accounts. ### answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE Accounts (customer_id VARCHAR)
### question: What is the customer first, last name and id with least number of accounts. ### answer: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) LIMIT 1 ### context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
### question: Show the number of all customers without an account. ### answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts) ### context: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR)
### question: Show the first names and last names of customers without any account. ### answer: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id ### context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR)
### question: Show distinct first and last names for all customers with an account. ### answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id ### context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
### question: How many customers have an account? ### answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts ### context: CREATE TABLE Accounts (customer_id VARCHAR)
### question: How many customers do we have? ### answer: SELECT COUNT(*) FROM Customers ### context: CREATE TABLE Customers (Id VARCHAR)
### question: Show ids, first names, last names, and phones for all customers. ### answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers ### context: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR)
### question: What is the phone and email for customer with first name Aniyah and last name Feest? ### answer: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest" ### context: CREATE TABLE Customers (customer_phone VARCHAR, customer_email VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
### question: Show the number of customer cards. ### answer: SELECT COUNT(*) FROM Customers_cards ### context: CREATE TABLE Customers_cards (Id VARCHAR)
### question: Show ids, customer ids, card type codes, card numbers for all cards. ### answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards ### context: CREATE TABLE Customers_cards (card_id VARCHAR, customer_id VARCHAR, card_type_code VARCHAR, card_number VARCHAR)
### question: Show the date valid from and the date valid to for the card with card number '4560596484842'. ### answer: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = "4560596484842" ### context: CREATE TABLE Customers_cards (date_valid_from VARCHAR, date_valid_to VARCHAR, card_number VARCHAR)
### question: What is the first name, last name, and phone of the customer with card 4560596484842. ### answer: 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" ### context: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Customers_cards (customer_id VARCHAR, card_number VARCHAR)
### question: How many cards does customer Art Turcotte have? ### answer: 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" ### context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
### question: How many debit cards do we have? ### answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = "Debit" ### context: CREATE TABLE Customers_cards (card_type_code VARCHAR)
### question: How many credit cards does customer Blanche Huels have? ### answer: 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" ### context: CREATE TABLE Customers_cards (customer_id VARCHAR, card_type_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)
### question: Show all customer ids and the number of cards owned by each customer. ### answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ### context: CREATE TABLE Customers_cards (customer_id VARCHAR)
### question: What is the customer id with most number of cards, and how many does he have? ### answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE Customers_cards (customer_id VARCHAR)
### question: Show id, first and last names for all customers with at least two cards. ### answer: 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 ### context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
### question: What is the customer id, first and last name with least number of accounts. ### answer: 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(*) LIMIT 1 ### context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)
### question: Show all card type codes and the number of cards in each type. ### answer: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code ### context: CREATE TABLE Customers_cards (card_type_code VARCHAR)