Question: Show the distinct themes of journals.

Context: CREATE TABLE journal (Theme VARCHAR)

Answer: [SQL] SELECT DISTINCT Theme FROM journal [/SQL]


Question: Show the names of editors and the theme of journals for which they serve on committees.

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)

Answer: [SQL] 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 [/SQL]


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.

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)

Answer: [SQL] 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 [/SQL]


Question: Show the names of editors that are on the committee of journals with sales bigger than 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)

Answer: [SQL] 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 [/SQL]


Question: Show the id, name of each editor and the number of journal committees they are on.

Context: CREATE TABLE editor (editor_id VARCHAR, Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)

Answer: [SQL] 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 [/SQL]


Question: Show the names of editors that are on at least two journal committees.

Context: CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR)

Answer: [SQL] 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 [/SQL]


Question: List the names of editors that are not on any journal committee.

Context: CREATE TABLE editor (Name VARCHAR, editor_id VARCHAR); CREATE TABLE journal_committee (Name VARCHAR, editor_id VARCHAR)

Answer: [SQL] SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee) [/SQL]


Question: List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.

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)

Answer: [SQL] 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 [/SQL]


Question: What is the average sales of the journals that have an editor whose work type is 'Photo'?

Context: CREATE TABLE journal_committee (journal_ID VARCHAR, work_type VARCHAR); CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR)

Answer: [SQL] 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' [/SQL]


Question: How many accounts do we have?

Context: CREATE TABLE Accounts (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Accounts [/SQL]


Question: Show ids, customer ids, names for all accounts.

Context: CREATE TABLE Accounts (account_id VARCHAR, customer_id VARCHAR, account_name VARCHAR)

Answer: [SQL] SELECT account_id, customer_id, account_name FROM Accounts [/SQL]


Question: Show other account details for account with name 338.

Context: CREATE TABLE Accounts (other_account_details VARCHAR, account_name VARCHAR)

Answer: [SQL] SELECT other_account_details FROM Accounts WHERE account_name = "338" [/SQL]


Question: What is the first name, last name, and phone of the customer with 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)

Answer: [SQL] 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" [/SQL]


Question: How many accounts does the customer with first name Art and last name Turcotte have?

Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)

Answer: [SQL] 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" [/SQL]


Question: Show all customer ids and the number of accounts for each customer.

Context: CREATE TABLE Accounts (customer_id VARCHAR)

Answer: [SQL] SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id [/SQL]


Question: Show the customer id and number of accounts with most accounts.

Answer: [SQL] SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What is the customer first, last name and id with least number of accounts.

Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)

Answer: [SQL] 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 [/SQL]


Question: Show the number of all customers without an account.

Context: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts) [/SQL]


Question: Show the first names and last names of customers without any account.

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)

Answer: [SQL] 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 [/SQL]


Question: Show distinct first and last names for all customers with an account.

Answer: [SQL] 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 [/SQL]


Question: How many customers have an account?

Answer: [SQL] SELECT COUNT(DISTINCT customer_id) FROM Accounts [/SQL]


Question: How many customers do we have?

Context: CREATE TABLE Customers (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Customers [/SQL]


Question: Show ids, first names, last names, and phones for all customers.

Context: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR)

Answer: [SQL] SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers [/SQL]


Question: What is the phone and email for customer with first name Aniyah and last name Feest?

Context: CREATE TABLE Customers (customer_phone VARCHAR, customer_email VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)

Answer: [SQL] SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest" [/SQL]


Question: Show the number of customer cards.

Context: CREATE TABLE Customers_cards (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Customers_cards [/SQL]


Question: Show ids, customer ids, card type codes, card numbers for all cards.

Context: CREATE TABLE Customers_cards (card_id VARCHAR, customer_id VARCHAR, card_type_code VARCHAR, card_number VARCHAR)

Answer: [SQL] SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards [/SQL]


Question: Show the date valid from and the date valid to for the card with card number '4560596484842'.

Context: CREATE TABLE Customers_cards (date_valid_from VARCHAR, date_valid_to VARCHAR, card_number VARCHAR)

Answer: [SQL] SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = "4560596484842" [/SQL]


Question: What is the first name, last name, and phone of the customer with card 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)

Answer: [SQL] SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842" [/SQL]


Question: How many cards does customer Art Turcotte have?

Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" [/SQL]


Question: How many debit cards do we have?

Context: CREATE TABLE Customers_cards (card_type_code VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = "Debit" [/SQL]


Question: How many credit cards does customer Blanche Huels have?

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)

Answer: [SQL] SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit" [/SQL]


Question: Show all customer ids and the number of cards owned by each customer.

Context: CREATE TABLE Customers_cards (customer_id VARCHAR)

Answer: [SQL] SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id [/SQL]


Question: What is the customer id with most number of cards, and how many does he have?

Answer: [SQL] SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Show id, first and last names for all customers with at least two cards.

Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR)

Answer: [SQL] SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2 [/SQL]


Question: What is the customer id, first and last name with least number of accounts.

Answer: [SQL] SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) LIMIT 1 [/SQL]


Question: Show all card type codes and the number of cards in each type.

Answer: [SQL] SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code [/SQL]


Question: What is the card type code with most number of cards?

Answer: [SQL] SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Show card type codes with at least 5 cards.

Answer: [SQL] SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5 [/SQL]


Question: Show all card type codes and the number of customers holding cards in each type.

Context: CREATE TABLE Customers_cards (card_type_code VARCHAR, customer_id VARCHAR)

Answer: [SQL] SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code [/SQL]


Question: Show the customer ids and firstname without a credit card.

Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, card_type_code VARCHAR)

Answer: [SQL] SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = "Credit" [/SQL]


Question: Show all card type codes.

Context: CREATE TABLE Customers_Cards (card_type_code VARCHAR)

Answer: [SQL] SELECT DISTINCT card_type_code FROM Customers_Cards [/SQL]


Question: Show the number of card types.

Answer: [SQL] SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards [/SQL]


Question: Show all transaction types.

Context: CREATE TABLE Financial_Transactions (transaction_type VARCHAR)

Answer: [SQL] SELECT DISTINCT transaction_type FROM Financial_Transactions [/SQL]


Question: Show the number of transaction types.

Answer: [SQL] SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions [/SQL]


Question: What is the average and total transaction amount?

Context: CREATE TABLE Financial_transactions (transaction_amount INTEGER)

Answer: [SQL] SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions [/SQL]


Question: Show the card type codes and the number of transactions.

Context: CREATE TABLE Financial_transactions (card_id VARCHAR); CREATE TABLE Customers_cards (card_type_code VARCHAR, card_id VARCHAR)

Answer: [SQL] SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code [/SQL]


Question: Show the transaction type and the number of transactions.

Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR)

Answer: [SQL] SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type [/SQL]


Question: What is the transaction type that has processed the greatest total amount in transactions?

Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER)

Answer: [SQL] SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1 [/SQL]


Question: Show the account id and the number of transactions for each account

Context: CREATE TABLE Financial_transactions (account_id VARCHAR)

Answer: [SQL] SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id [/SQL]


Question: How many tracks do we have?

Context: CREATE TABLE track (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM track [/SQL]


Question: Show the name and location for all tracks.

Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR)

Answer: [SQL] SELECT name, LOCATION FROM track [/SQL]


Question: Show names and seatings, ordered by seating for all tracks opened after 2000.

Context: CREATE TABLE track (name VARCHAR, seating VARCHAR, year_opened INTEGER)

Answer: [SQL] SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating [/SQL]


Question: What is the name, location and seating for the most recently opened track?

Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, seating VARCHAR, year_opened VARCHAR)

Answer: [SQL] SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1 [/SQL]


Question: What is the minimum, maximum, and average seating for all tracks.

Context: CREATE TABLE track (seating INTEGER)

Answer: [SQL] SELECT MIN(seating), MAX(seating), AVG(seating) FROM track [/SQL]


Question: Show the name, location, open year for all tracks with a seating higher than the average.

Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, year_opened VARCHAR, seating INTEGER)

Answer: [SQL] SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track) [/SQL]


Question: What are distinct locations where tracks are located?

Context: CREATE TABLE track (LOCATION VARCHAR)

Answer: [SQL] SELECT DISTINCT LOCATION FROM track [/SQL]


Question: How many races are there?

Context: CREATE TABLE race (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM race [/SQL]


Question: What are the distinct classes that races can have?

Context: CREATE TABLE race (CLASS VARCHAR)

Answer: [SQL] SELECT DISTINCT CLASS FROM race [/SQL]


Question: Show name, class, and date for all races.

Context: CREATE TABLE race (name VARCHAR, CLASS VARCHAR, date VARCHAR)

Answer: [SQL] SELECT name, CLASS, date FROM race [/SQL]


Question: Show the race class and number of races in each class.

Context: CREATE TABLE race (CLASS VARCHAR)

Answer: [SQL] SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS [/SQL]


Question: What is the race class with most number of races.

Context: CREATE TABLE race (CLASS VARCHAR)

Answer: [SQL] SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: List the race class with at least two races.

Context: CREATE TABLE race (CLASS VARCHAR)

Answer: [SQL] SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2 [/SQL]


Question: What are the names for tracks without a race in class 'GT'.

Context: CREATE TABLE race (track_id VARCHAR, class VARCHAR); CREATE TABLE track (name VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)

Answer: [SQL] SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT' [/SQL]


Question: Show all track names that have had no races.

Context: CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (name VARCHAR, track_id VARCHAR)

Answer: [SQL] SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race) [/SQL]


Question: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.

Context: CREATE TABLE track (year_opened VARCHAR, seating INTEGER)

Answer: [SQL] SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000 [/SQL]


Question: Show the name of track and the number of races in each track.

Context: CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR)

Answer: [SQL] SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id [/SQL]


Question: Show the name of track with most number of races.

Answer: [SQL] SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Show the name and date for each race and its track name.

Context: CREATE TABLE race (name VARCHAR, date VARCHAR, track_id VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)

Answer: [SQL] SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id [/SQL]


Question: Show the name and location of track with 1 race.

Context: CREATE TABLE race (track_id VARCHAR); CREATE TABLE track (name VARCHAR, location VARCHAR, track_id VARCHAR)

Answer: [SQL] SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1 [/SQL]


Question: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.

Context: CREATE TABLE track (LOCATION VARCHAR, seating INTEGER)

Answer: [SQL] SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000 [/SQL]


Question: How many members have the black membership card?

Context: CREATE TABLE member (Membership_card VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM member WHERE Membership_card = 'Black' [/SQL]


Question: Find the number of members living in each address.

Context: CREATE TABLE member (address VARCHAR)

Answer: [SQL] SELECT COUNT(*), address FROM member GROUP BY address [/SQL]


Question: Give me the names of members whose address is in Harford or Waterbury.

Context: CREATE TABLE member (name VARCHAR, address VARCHAR)

Answer: [SQL] SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury' [/SQL]


Question: Find the ids and names of members who are under age 30 or with black membership card.

Context: CREATE TABLE member (name VARCHAR, member_id VARCHAR, Membership_card VARCHAR, age VARCHAR)

Answer: [SQL] SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30 [/SQL]


Question: Find the purchase time, age and address of each member, and show the results in the order of purchase time.

Context: CREATE TABLE member (Time_of_purchase VARCHAR, age VARCHAR, address VARCHAR)

Answer: [SQL] SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase [/SQL]


Question: Which membership card has more than 5 members?

Answer: [SQL] SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5 [/SQL]


Question: Which address has both members younger than 30 and members older than 40?

Context: CREATE TABLE member (address VARCHAR, age INTEGER)

Answer: [SQL] SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40 [/SQL]


Question: What is the membership card held by both members living in Hartford and ones living in Waterbury address?

Context: CREATE TABLE member (membership_card VARCHAR, address VARCHAR)

Answer: [SQL] SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury' [/SQL]


Question: How many members are not living in Hartford?

Context: CREATE TABLE member (address VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM member WHERE address <> 'Hartford' [/SQL]


Question: Which address do not have any member with the black membership card?

Context: CREATE TABLE member (address VARCHAR, Membership_card VARCHAR)

Answer: [SQL] SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black' [/SQL]


Question: Show the shop addresses ordered by their opening year.

Context: CREATE TABLE shop (address VARCHAR, open_year VARCHAR)

Answer: [SQL] SELECT address FROM shop ORDER BY open_year [/SQL]


Question: What are the average score and average staff number of all shops?

Context: CREATE TABLE shop (num_of_staff INTEGER, score INTEGER)

Answer: [SQL] SELECT AVG(num_of_staff), AVG(score) FROM shop [/SQL]


Question: Find the id and address of the shops whose score is below the average score.

Context: CREATE TABLE shop (shop_id VARCHAR, address VARCHAR, score INTEGER)

Answer: [SQL] SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop) [/SQL]


Question: Find the address and staff number of the shops that do not have any happy hour.

Context: CREATE TABLE shop (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR)

Answer: [SQL] SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour) [/SQL]


Question: What are the id and address of the shops which have a happy hour in May?

Context: CREATE TABLE shop (address VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (shop_id VARCHAR)

Answer: [SQL] SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May' [/SQL]


Question: which shop has happy hour most frequently? List its id and number of happy hours.

Context: CREATE TABLE happy_hour (shop_id VARCHAR)

Answer: [SQL] SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Which month has the most happy hours?

Context: CREATE TABLE happy_hour (MONTH VARCHAR)

Answer: [SQL] SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Which months have more than 2 happy hours?

Context: CREATE TABLE happy_hour (MONTH VARCHAR)

Answer: [SQL] SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2 [/SQL]


Question: How many albums are there?

Context: CREATE TABLE ALBUM (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM ALBUM [/SQL]


Question: List the names of all music genres.

Context: CREATE TABLE GENRE (Name VARCHAR)

Answer: [SQL] SELECT Name FROM GENRE [/SQL]


Question: Find all the customer information in state NY.

Context: CREATE TABLE CUSTOMER (State VARCHAR)

Answer: [SQL] SELECT * FROM CUSTOMER WHERE State = "NY" [/SQL]


Question: What are the first names and last names of the employees who live in Calgary city.

Context: CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, City VARCHAR)

Answer: [SQL] SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "Calgary" [/SQL]


Question: What are the distinct billing countries of the invoices?

Context: CREATE TABLE INVOICE (BillingCountry VARCHAR)

Answer: [SQL] SELECT DISTINCT (BillingCountry) FROM INVOICE [/SQL]


Question: Find the names of all artists that have "a" in their names.

Context: CREATE TABLE ARTIST (Name VARCHAR)

Answer: [SQL] SELECT Name FROM ARTIST WHERE Name LIKE "%a%" [/SQL]


Question: Find the title of all the albums of the artist "AC/DC".

Context: CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)

Answer: [SQL] SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC" [/SQL]


Question: Hom many albums does the artist "Metallica" have?

Answer: [SQL] SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica" [/SQL]


Question: Which artist does the album "Balls to the Wall" belong to?

Context: CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)

Answer: [SQL] SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall" [/SQL]


Question: Which artist has the most albums?

Context: CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)

Answer: [SQL] SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Find the names of all the tracks that contain the word "you".

Context: CREATE TABLE TRACK (Name VARCHAR)

Answer: [SQL] SELECT Name FROM TRACK WHERE Name LIKE '%you%' [/SQL]


Question: What is the average unit price of all the tracks?

Context: CREATE TABLE TRACK (UnitPrice INTEGER)

Answer: [SQL] SELECT AVG(UnitPrice) FROM TRACK [/SQL]


Question: What are the durations of the longest and the shortest tracks in milliseconds?

Context: CREATE TABLE TRACK (Milliseconds INTEGER)

Answer: [SQL] SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK [/SQL]


Question: Show the album names, ids and the number of tracks for each album.

Context: CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR)

Answer: [SQL] SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID [/SQL]


Question: What is the name of the most common genre in all tracks?

Context: CREATE TABLE GENRE (Name VARCHAR, GenreId VARCHAR); CREATE TABLE TRACK (GenreId VARCHAR)

Answer: [SQL] SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What is the least common media type in all tracks?

Context: CREATE TABLE MEDIATYPE (Name VARCHAR, MediaTypeId VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)

Answer: [SQL] SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) LIMIT 1 [/SQL]


Question: Show the album names and ids for albums that contain tracks with unit price bigger than 1.

Context: CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR, UnitPrice INTEGER)

Answer: [SQL] SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID [/SQL]


Question: How many tracks belong to rock genre?

Context: CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" [/SQL]


Question: What is the average unit price of tracks that belong to Jazz genre?

Answer: [SQL] SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz" [/SQL]


Question: What is the first name and last name of the customer that has email "luisg@embraer.com.br"?

Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, LastName VARCHAR, Email VARCHAR)

Answer: [SQL] SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br" [/SQL]


Question: How many customers have email that contains "gmail.com"?

Context: CREATE TABLE CUSTOMER (Email VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%" [/SQL]


Question: What is the first name and last name employee helps the customer with first name Leonie?

Context: CREATE TABLE CUSTOMER (SupportRepId VARCHAR, FirstName VARCHAR); CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, EmployeeId VARCHAR)

Answer: [SQL] SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie" [/SQL]


Question: What city does the employee who helps the customer with postal code 70174 live in?

Context: CREATE TABLE EMPLOYEE (City VARCHAR, EmployeeId VARCHAR); CREATE TABLE CUSTOMER (SupportRepId VARCHAR, PostalCode VARCHAR)

Answer: [SQL] SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174" [/SQL]


Question: How many distinct cities does the employees live in?

Context: CREATE TABLE EMPLOYEE (city VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT city) FROM EMPLOYEE [/SQL]


Question: Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.

Context: CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR); CREATE TABLE INVOICE (InvoiceDate VARCHAR, CustomerId VARCHAR)

Answer: [SQL] SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" [/SQL]


Question: Find all the customer last names that do not have invoice totals larger than 20.

Context: CREATE TABLE CUSTOMER (LastName VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, CustomerId VARCHAR); CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER)

Answer: [SQL] SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20 [/SQL]


Question: Find the first names of all customers that live in Brazil and have an invoice.

Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, CustomerId VARCHAR, country VARCHAR); CREATE TABLE INVOICE (CustomerId VARCHAR)

Answer: [SQL] SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil" [/SQL]


Question: Find the address of all customers that live in Germany and have invoice.

Context: CREATE TABLE INVOICE (CustomerId VARCHAR); CREATE TABLE CUSTOMER (Address VARCHAR, CustomerId VARCHAR, country VARCHAR)

Answer: [SQL] SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany" [/SQL]


Question: List the phone numbers of all employees.

Context: CREATE TABLE EMPLOYEE (Phone VARCHAR)

Answer: [SQL] SELECT Phone FROM EMPLOYEE [/SQL]


Question: How many tracks are in the AAC audio file media type?

Context: CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file" [/SQL]


Question: What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?

Answer: [SQL] SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop" [/SQL]


Question: Please show the employee first names and ids of employees who serve at least 10 customers.

Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR); CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)

Answer: [SQL] SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10 [/SQL]


Question: Please show the employee last names that serves no more than 20 customers.

Context: CREATE TABLE EMPLOYEE (EmployeeId VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, SupportRepId VARCHAR)

Answer: [SQL] SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20 [/SQL]


Question: Please list all album titles in alphabetical order.

Context: CREATE TABLE ALBUM (Title VARCHAR)

Answer: [SQL] SELECT Title FROM ALBUM ORDER BY Title [/SQL]


Question: Please list the name and id of all artists that have at least 3 albums in alphabetical order.

Context: CREATE TABLE ARTIST (Name VARCHAR, ArtistID VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)

Answer: [SQL] SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name [/SQL]


Question: Find the names of artists that do not have any albums.

Context: CREATE TABLE ARTIST (Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)

Answer: [SQL] SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId [/SQL]


Question: What is the average unit price of rock tracks?

Context: CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR)

Answer: [SQL] SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" [/SQL]


Question: What are the duration of the longest and shortest pop tracks in milliseconds?

Answer: [SQL] SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop" [/SQL]


Question: What are the birth dates of employees living in Edmonton?

Context: CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR)

Answer: [SQL] SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton" [/SQL]


Question: What are the distinct unit prices of all tracks?

Context: CREATE TABLE TRACK (UnitPrice VARCHAR)

Answer: [SQL] SELECT DISTINCT (UnitPrice) FROM TRACK [/SQL]


Question: How many artists do not have any album?

Context: CREATE TABLE ARTIST (artistid VARCHAR); CREATE TABLE ALBUM (artistid VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM) [/SQL]


Question: What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?

Context: CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR); CREATE TABLE Track (AlbumId VARCHAR, GenreID VARCHAR); CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR)

Answer: [SQL] SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock' [/SQL]


Question: Find all the phone numbers.

Context: CREATE TABLE available_policies (customer_phone VARCHAR)

Answer: [SQL] SELECT customer_phone FROM available_policies [/SQL]


Question: What are the customer phone numbers under the policy "Life Insurance"?

Context: CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR)

Answer: [SQL] SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance" [/SQL]


Question: Which policy type has the most records in the database?

Context: CREATE TABLE available_policies (policy_type_code VARCHAR)

Answer: [SQL] SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What are all the customer phone numbers under the most popular policy type?

Answer: [SQL] SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1) [/SQL]


Question: Find the policy type used by more than 4 customers.

Answer: [SQL] SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4 [/SQL]


Question: Find the total and average amount of settlements.

Context: CREATE TABLE settlements (settlement_amount INTEGER)

Answer: [SQL] SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements [/SQL]


Question: Find the name of services that have been used for more than 2 times in first notification of loss.

Context: CREATE TABLE services (service_name VARCHAR, service_id VARCHAR); CREATE TABLE first_notification_of_loss (service_id VARCHAR)

Answer: [SQL] SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING COUNT(*) > 2 [/SQL]


Question: What is the effective date of the claim that has the largest amount of total settlement?

Context: CREATE TABLE settlements (claim_id VARCHAR, settlement_amount INTEGER); CREATE TABLE claims (Effective_Date VARCHAR, claim_id VARCHAR)

Answer: [SQL] SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1 [/SQL]


Question: How many policies are listed for the customer named "Dayana Robel"?

Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Dayana Robel" [/SQL]


Question: What is the name of the customer who has the most policies listed?

Context: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR)

Answer: [SQL] SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What are all the policy types of the customer named "Dayana Robel"?

Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE available_policies (policy_type_code VARCHAR, policy_id VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR, policy_id VARCHAR)

Answer: [SQL] SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = "Dayana Robel" [/SQL]


Question: What are all the policy types of the customer that has the most policies listed?

Answer: [SQL] SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1) [/SQL]


Question: List all the services in the alphabetical order.

Context: CREATE TABLE services (service_name VARCHAR)

Answer: [SQL] SELECT service_name FROM services ORDER BY service_name [/SQL]


Question: How many services are there?

Context: CREATE TABLE services (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM services [/SQL]


Question: Find the names of users who do not have a first notification of loss record.

Context: CREATE TABLE first_notification_of_loss (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR)

Answer: [SQL] SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id [/SQL]


Question: Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".

Context: CREATE TABLE first_notification_of_loss (customer_id VARCHAR, service_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE services (service_id VARCHAR, service_name VARCHAR)

Answer: [SQL] SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" OR t3.service_name = "Upgrade a policy" [/SQL]


Question: Find the names of customers who have used both the service "Close a policy" and the service "New policy application".

Answer: [SQL] SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "New policy application" [/SQL]


Question: Find the IDs of customers whose name contains "Diana".

Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR)

Answer: [SQL] SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%" [/SQL]


Question: What are the maximum and minimum settlement amount on record?

Answer: [SQL] SELECT MAX(settlement_amount), MIN(settlement_amount) FROM settlements [/SQL]


Question: List all the customers in increasing order of IDs.

Answer: [SQL] SELECT customer_id, customer_name FROM customers ORDER BY customer_id [/SQL]


Question: Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana"

Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customers_policies (date_opened VARCHAR, date_closed VARCHAR, customer_id VARCHAR)

Answer: [SQL] SELECT t2.date_opened, t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE "%Diana%" [/SQL]


Question: How many kinds of enzymes are there?

Context: CREATE TABLE enzyme (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM enzyme [/SQL]


Question: List the name of enzymes in descending lexicographical order.

Context: CREATE TABLE enzyme (name VARCHAR)

Answer: [SQL] SELECT name FROM enzyme ORDER BY name DESC [/SQL]


Question: List the names and the locations that the enzymes can make an effect.

Context: CREATE TABLE enzyme (name VARCHAR, LOCATION VARCHAR)

Answer: [SQL] SELECT name, LOCATION FROM enzyme [/SQL]


Question: What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes?

Context: CREATE TABLE enzyme (OMIM INTEGER)

Answer: [SQL] SELECT MAX(OMIM) FROM enzyme [/SQL]


Question: What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'?

Context: CREATE TABLE enzyme (product VARCHAR, chromosome VARCHAR, porphyria VARCHAR, LOCATION VARCHAR)

Answer: [SQL] SELECT product, chromosome, porphyria FROM enzyme WHERE LOCATION = 'Cytosol' [/SQL]


Question: What are the names of enzymes who does not produce 'Heme'?

Context: CREATE TABLE enzyme (name VARCHAR, product VARCHAR)

Answer: [SQL] SELECT name FROM enzyme WHERE product <> 'Heme' [/SQL]


Question: What are the names and trade names of the medicines which has 'Yes' value in the FDA record?

Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, FDA_approved VARCHAR)

Answer: [SQL] SELECT name, trade_name FROM medicine WHERE FDA_approved = 'Yes' [/SQL]


Question: What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?

Context: CREATE TABLE medicine (id VARCHAR, name VARCHAR); CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, medicine_id VARCHAR, interaction_type VARCHAR); CREATE TABLE enzyme (name VARCHAR, id VARCHAR)

Answer: [SQL] SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor' [/SQL]


Question: What are the ids and names of the medicine that can interact with two or more enzymes?

Context: CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR); CREATE TABLE medicine (id VARCHAR, Name VARCHAR)

Answer: [SQL] SELECT T1.id, T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2 [/SQL]


Question: What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.

Context: CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR); CREATE TABLE medicine (id VARCHAR, Name VARCHAR, FDA_approved VARCHAR)

Answer: [SQL] SELECT T1.id, T1.Name, T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC [/SQL]


Question: What is the id and name of the enzyme with most number of medicines that can interact as 'activator'?

Context: CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, interaction_type VARCHAR); CREATE TABLE enzyme (id VARCHAR, name VARCHAR)

Answer: [SQL] SELECT T1.id, T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?

Context: CREATE TABLE enzyme (id VARCHAR, name VARCHAR); CREATE TABLE medicine (id VARCHAR, name VARCHAR); CREATE TABLE medicine_enzyme_interaction (interaction_type VARCHAR, medicine_id VARCHAR, enzyme_id VARCHAR)

Answer: [SQL] SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole' [/SQL]


Question: What is the most common interaction type between enzymes and medicine? And how many are there?

Context: CREATE TABLE medicine_enzyme_interaction (interaction_type VARCHAR)

Answer: [SQL] SELECT interaction_type, COUNT(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: How many medicines have the FDA approval status 'No' ?

Context: CREATE TABLE medicine (FDA_approved VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM medicine WHERE FDA_approved = 'No' [/SQL]


Question: How many enzymes do not have any interactions?

Context: CREATE TABLE medicine_enzyme_interaction (id VARCHAR, enzyme_id VARCHAR); CREATE TABLE enzyme (id VARCHAR, enzyme_id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM enzyme WHERE NOT id IN (SELECT enzyme_id FROM medicine_enzyme_interaction) [/SQL]


Question: What is the id and trade name of the medicines can interact with at least 3 enzymes?

Context: CREATE TABLE medicine (id VARCHAR, trade_name VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR)

Answer: [SQL] SELECT T1.id, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3 [/SQL]


Question: What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?

Context: CREATE TABLE enzyme (name VARCHAR, location VARCHAR, product VARCHAR, id VARCHAR); CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, interaction_type VARCHAR)

Answer: [SQL] SELECT DISTINCT T1.name, T1.location, T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor' [/SQL]


Question: List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.

Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, id VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR)

Answer: [SQL] SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor' [/SQL]


Question: Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'.

Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR, enzyme_id VARCHAR); CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, id VARCHAR); CREATE TABLE enzyme (id VARCHAR, product VARCHAR)

Answer: [SQL] SELECT name, trade_name FROM medicine EXCEPT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX' [/SQL]


Question: How many distinct FDA approval statuses are there for the medicines?

Answer: [SQL] SELECT COUNT(DISTINCT FDA_approved) FROM medicine [/SQL]


Question: Which enzyme names have the substring "ALA"?

Context: CREATE TABLE enzyme (name VARCHAR)

Answer: [SQL] SELECT name FROM enzyme WHERE name LIKE "%ALA%" [/SQL]


Question: find the number of medicines offered by each trade.

Context: CREATE TABLE medicine (trade_name VARCHAR)

Answer: [SQL] SELECT trade_name, COUNT(*) FROM medicine GROUP BY trade_name [/SQL]


Question: List all schools and their nicknames in the order of founded year.

Context: CREATE TABLE university (school VARCHAR, nickname VARCHAR, founded VARCHAR)

Answer: [SQL] SELECT school, nickname FROM university ORDER BY founded [/SQL]


Question: List all public schools and their locations.

Context: CREATE TABLE university (school VARCHAR, LOCATION VARCHAR, affiliation VARCHAR)

Answer: [SQL] SELECT school, LOCATION FROM university WHERE affiliation = 'Public' [/SQL]


Question: When was the school with the largest enrollment founded?

Context: CREATE TABLE university (founded VARCHAR, enrollment VARCHAR)

Answer: [SQL] SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1 [/SQL]


Question: Find the founded year of the newest non public school.

Context: CREATE TABLE university (founded VARCHAR, affiliation VARCHAR)

Answer: [SQL] SELECT founded FROM university WHERE affiliation <> 'Public' ORDER BY founded DESC LIMIT 1 [/SQL]


Question: How many schools are in the basketball match?

Context: CREATE TABLE basketball_match (school_id VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT school_id) FROM basketball_match [/SQL]


Question: What is the highest acc percent score in the competition?

Context: CREATE TABLE basketball_match (acc_percent VARCHAR)

Answer: [SQL] SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1 [/SQL]


Question: What is the primary conference of the school that has the lowest acc percent score in the competition?

Context: CREATE TABLE basketball_match (school_id VARCHAR, acc_percent VARCHAR); CREATE TABLE university (Primary_conference VARCHAR, school_id VARCHAR)

Answer: [SQL] SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1 [/SQL]


Question: What is the team name and acc regular season score of the school that was founded for the longest time?

Context: CREATE TABLE university (school_id VARCHAR, founded VARCHAR); CREATE TABLE basketball_match (team_name VARCHAR, ACC_Regular_Season VARCHAR, school_id VARCHAR)

Answer: [SQL] SELECT t2.team_name, t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1 [/SQL]


Question: Find the location and all games score of the school that has Clemson as its team name.

Context: CREATE TABLE basketball_match (All_Games VARCHAR, school_id VARCHAR); CREATE TABLE university (location VARCHAR, school_id VARCHAR)

Answer: [SQL] SELECT t2.All_Games, t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson' [/SQL]


Question: What are the average enrollment size of the universities that are founded before 1850?

Context: CREATE TABLE university (enrollment INTEGER, founded INTEGER)

Answer: [SQL] SELECT AVG(enrollment) FROM university WHERE founded < 1850 [/SQL]


Question: Show the enrollment and primary_conference of the oldest college.

Context: CREATE TABLE university (enrollment VARCHAR, primary_conference VARCHAR, founded VARCHAR)

Answer: [SQL] SELECT enrollment, primary_conference FROM university ORDER BY founded LIMIT 1 [/SQL]


Question: What is the total and minimum enrollment of all schools?

Context: CREATE TABLE university (enrollment INTEGER)

Answer: [SQL] SELECT SUM(enrollment), MIN(enrollment) FROM university [/SQL]


Question: Find the total student enrollment for different affiliation type schools.

Context: CREATE TABLE university (affiliation VARCHAR, enrollment INTEGER)

Answer: [SQL] SELECT SUM(enrollment), affiliation FROM university GROUP BY affiliation [/SQL]


Question: How many schools do not participate in the basketball match?

Context: CREATE TABLE university (school_id VARCHAR); CREATE TABLE basketball_match (school_id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match) [/SQL]


Question: Find the schools that were either founded after 1850 or public.

Context: CREATE TABLE university (school VARCHAR, founded VARCHAR, affiliation VARCHAR)

Answer: [SQL] SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public' [/SQL]


Question: Find how many different affiliation types there are.

Context: CREATE TABLE university (affiliation VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT affiliation) FROM university [/SQL]


Question: Find how many school locations have the word 'NY'.

Context: CREATE TABLE university (LOCATION VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM university WHERE LOCATION LIKE "%NY%" [/SQL]


Question: Find the team names of the universities whose enrollments are smaller than the average enrollment size.

Context: CREATE TABLE university (school_id VARCHAR); CREATE TABLE basketball_match (team_name VARCHAR, school_id VARCHAR); CREATE TABLE university (enrollment INTEGER)

Answer: [SQL] SELECT t2.team_name FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE enrollment < (SELECT AVG(enrollment) FROM university) [/SQL]


Question: Find the number of universities that have over a 20000 enrollment size for each affiliation type.

Answer: [SQL] SELECT COUNT(*), affiliation FROM university WHERE enrollment > 20000 GROUP BY affiliation [/SQL]


Question: Find the total number of students enrolled in the colleges that were founded after the year of 1850 for each affiliation type.

Context: CREATE TABLE university (affiliation VARCHAR, Enrollment INTEGER, founded INTEGER)

Answer: [SQL] SELECT SUM(Enrollment), affiliation FROM university WHERE founded > 1850 GROUP BY affiliation [/SQL]


Question: What is the maximum enrollment across all schools?

Context: CREATE TABLE university (Enrollment INTEGER)

Answer: [SQL] SELECT MAX(Enrollment) FROM university [/SQL]


Question: List all information regarding the basketball match.

Context: CREATE TABLE basketball_match (Id VARCHAR)

Answer: [SQL] SELECT * FROM basketball_match [/SQL]


Question: List names of all teams in the basketball competition, ordered by all home scores in descending order.

Context: CREATE TABLE basketball_match (team_name VARCHAR, All_Home VARCHAR)

Answer: [SQL] SELECT team_name FROM basketball_match ORDER BY All_Home DESC [/SQL]


Question: the names of models that launched between 2002 and 2004.

Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year INTEGER)

Answer: [SQL] SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004 [/SQL]


Question: Which model has the least amount of RAM? List the model name and the amount of RAM.

Context: CREATE TABLE chip_model (Model_name VARCHAR, RAM_MiB VARCHAR)

Answer: [SQL] SELECT Model_name, RAM_MiB FROM chip_model ORDER BY RAM_MiB LIMIT 1 [/SQL]


Question: What are the chip model and screen mode of the phone with hardware model name "LG-P760"?

Context: CREATE TABLE phone (chip_model VARCHAR, screen_mode VARCHAR, Hardware_Model_name VARCHAR)

Answer: [SQL] SELECT chip_model, screen_mode FROM phone WHERE Hardware_Model_name = "LG-P760" [/SQL]


Question: How many phone hardware models are produced by the company named "Nokia Corporation"?

Context: CREATE TABLE phone (Company_name VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM phone WHERE Company_name = "Nokia Corporation" [/SQL]


Question: What is maximum and minimum RAM size of phone produced by company named "Nokia Corporation"?

Context: CREATE TABLE phone (chip_model VARCHAR, Company_name VARCHAR); CREATE TABLE chip_model (RAM_MiB INTEGER, Model_name VARCHAR)

Answer: [SQL] SELECT MAX(T1.RAM_MiB), MIN(T1.RAM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = "Nokia Corporation" [/SQL]


Question: What is the average ROM size of phones produced by the company named "Nokia Corporation"?

Context: CREATE TABLE phone (chip_model VARCHAR, Company_name VARCHAR); CREATE TABLE chip_model (ROM_MiB INTEGER, Model_name VARCHAR)

Answer: [SQL] SELECT AVG(T1.ROM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = "Nokia Corporation" [/SQL]


Question: List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32.

Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, chip_model VARCHAR)

Answer: [SQL] SELECT T2.Hardware_Model_name, T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32 [/SQL]


Question: Find all phones that have word 'Full' in their accreditation types. List the Hardware Model name and Company name.

Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, Accreditation_type VARCHAR)

Answer: [SQL] SELECT Hardware_Model_name, Company_name FROM phone WHERE Accreditation_type LIKE 'Full' [/SQL]


Question: Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is "LG-P760".

Context: CREATE TABLE phone (screen_mode VARCHAR, Hardware_Model_name VARCHAR); CREATE TABLE screen_mode (Char_cells VARCHAR, Pixels VARCHAR, Hardware_colours VARCHAR, Graphics_mode VARCHAR)

Answer: [SQL] SELECT T1.Char_cells, T1.Pixels, T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = "LG-P760" [/SQL]


Question: List the hardware model name and company name for the phone whose screen mode type is "Graphics."

Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR)

Answer: [SQL] SELECT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" [/SQL]


Question: Find the name of the company that has the least number of phone models. List the company name and the number of phone model produced by that company.

Answer: [SQL] SELECT Company_name, COUNT(*) FROM phone GROUP BY Company_name ORDER BY COUNT(*) LIMIT 1 [/SQL]


Question: List the name of the company that produced more than one phone model.

Answer: [SQL] SELECT Company_name FROM phone GROUP BY Company_name HAVING COUNT(*) > 1 [/SQL]


Question: List the maximum, minimum and average number of used kb in screen mode.

Context: CREATE TABLE screen_mode (used_kb INTEGER)

Answer: [SQL] SELECT MAX(used_kb), MIN(used_kb), AVG(used_kb) FROM screen_mode [/SQL]


Question: List the name of the phone model launched in year 2002 and with the highest RAM size.

Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, chip_model VARCHAR)

Answer: [SQL] SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 ORDER BY T1.RAM_MiB DESC LIMIT 1 [/SQL]


Question: What are the wifi and screen mode type of the hardware model named "LG-P760"?

Context: CREATE TABLE phone (chip_model VARCHAR, screen_mode VARCHAR, Hardware_Model_name VARCHAR); CREATE TABLE chip_model (WiFi VARCHAR, Model_name VARCHAR); CREATE TABLE screen_mode (Type VARCHAR, Graphics_mode VARCHAR)

Answer: [SQL] SELECT T1.WiFi, T3.Type FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T2.Hardware_Model_name = "LG-P760" [/SQL]


Question: List the hardware model name for the phones that have screen mode type "Text" or RAM size greater than 32.

Context: CREATE TABLE chip_model (Model_name VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, chip_model VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR)

Answer: [SQL] SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = "Text" OR T1.RAM_MiB > 32 [/SQL]


Question: List the hardware model name for the phones that were produced by "Nokia Corporation" or whose screen mode type is "Graphics."

Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR)

Answer: [SQL] SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" OR t2.Company_name = "Nokia Corporation" [/SQL]


Question: List the hardware model name for the phons that were produced by "Nokia Corporation" but whose screen mode type is not Text.

Answer: [SQL] SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE t2.Company_name = "Nokia Corporation" AND T1.Type <> "Text" [/SQL]


Question: List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15.

Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, used_kb INTEGER)

Answer: [SQL] SELECT DISTINCT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15 [/SQL]


Question: Find the number of phones for each accreditation type.

Context: CREATE TABLE phone (Accreditation_type VARCHAR)

Answer: [SQL] SELECT Accreditation_type, COUNT(*) FROM phone GROUP BY Accreditation_type [/SQL]


Question: Find the accreditation level that more than 3 phones use.

Context: CREATE TABLE phone (Accreditation_level VARCHAR)

Answer: [SQL] SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING COUNT(*) > 3 [/SQL]


Question: Find the details for all chip models.

Context: CREATE TABLE chip_model (Id VARCHAR)

Answer: [SQL] SELECT * FROM chip_model [/SQL]


Question: How many models do not have the wifi function?

Context: CREATE TABLE chip_model (wifi VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM chip_model WHERE wifi = 'No' [/SQL]


Question: List all the model names sorted by their launch year.

Context: CREATE TABLE chip_model (model_name VARCHAR, launch_year VARCHAR)

Answer: [SQL] SELECT model_name FROM chip_model ORDER BY launch_year [/SQL]


Question: Find the average ram mib size of the chip models that are never used by any phone.

Context: CREATE TABLE chip_model (RAM_MiB INTEGER, model_name VARCHAR, chip_model VARCHAR); CREATE TABLE phone (RAM_MiB INTEGER, model_name VARCHAR, chip_model VARCHAR)

Answer: [SQL] SELECT AVG(RAM_MiB) FROM chip_model WHERE NOT model_name IN (SELECT chip_model FROM phone) [/SQL]


Question: Find the names of the chip models that are not used by any phone with full accreditation type.

Context: CREATE TABLE chip_model (model_name VARCHAR, chip_model VARCHAR, Accreditation_type VARCHAR); CREATE TABLE phone (model_name VARCHAR, chip_model VARCHAR, Accreditation_type VARCHAR)

Answer: [SQL] SELECT model_name FROM chip_model EXCEPT SELECT chip_model FROM phone WHERE Accreditation_type = 'Full' [/SQL]


Question: Find the pixels of the screen modes that are used by both phones with full accreditation types and phones with Provisional accreditation types.

Context: CREATE TABLE phone (screen_mode VARCHAR, Accreditation_type VARCHAR); CREATE TABLE screen_mode (pixels VARCHAR, Graphics_mode VARCHAR)

Answer: [SQL] SELECT t1.pixels FROM screen_mode AS t1 JOIN phone AS t2 ON t1.Graphics_mode = t2.screen_mode WHERE t2.Accreditation_type = 'Provisional' INTERSECT SELECT t1.pixels FROM screen_mode AS t1 JOIN phone AS t2 ON t1.Graphics_mode = t2.screen_mode WHERE t2.Accreditation_type = 'Full' [/SQL]


Question: How many countries are there in total?

Context: CREATE TABLE country (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM country [/SQL]


Question: Show the country name and capital of all countries.

Context: CREATE TABLE country (Country_name VARCHAR, Capital VARCHAR)

Answer: [SQL] SELECT Country_name, Capital FROM country [/SQL]


Question: Show all official native languages that contain the word "English".

Context: CREATE TABLE country (Official_native_language VARCHAR)

Answer: [SQL] SELECT Official_native_language FROM country WHERE Official_native_language LIKE "%English%" [/SQL]


Question: Show all distinct positions of matches.

Context: CREATE TABLE match_season (POSITION VARCHAR)

Answer: [SQL] SELECT DISTINCT POSITION FROM match_season [/SQL]


Question: Show the players from college UCLA.

Context: CREATE TABLE match_season (Player VARCHAR, College VARCHAR)

Answer: [SQL] SELECT Player FROM match_season WHERE College = "UCLA" [/SQL]


Question: Show the distinct position of players from college UCLA or Duke.

Context: CREATE TABLE match_season (POSITION VARCHAR, College VARCHAR)

Answer: [SQL] SELECT DISTINCT POSITION FROM match_season WHERE College = "UCLA" OR College = "Duke" [/SQL]


Question: Show the draft pick numbers and draft classes of players whose positions are defenders.

Context: CREATE TABLE match_season (Draft_Pick_Number VARCHAR, Draft_Class VARCHAR, POSITION VARCHAR)

Answer: [SQL] SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE POSITION = "Defender" [/SQL]


Question: How many distinct teams are involved in match seasons?

Context: CREATE TABLE match_season (Team VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT Team) FROM match_season [/SQL]


Question: Show the players and the years played.

Context: CREATE TABLE player (Player VARCHAR, Years_Played VARCHAR)

Answer: [SQL] SELECT Player, Years_Played FROM player [/SQL]


Question: Show all team names.

Context: CREATE TABLE Team (Name VARCHAR)

Answer: [SQL] SELECT Name FROM Team [/SQL]


Question: Show the season, the player, and the name of the country that player belongs to.

Context: CREATE TABLE match_season (Season VARCHAR, Player VARCHAR, Country VARCHAR); CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR)

Answer: [SQL] SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country [/SQL]


Question: Which players are from Indonesia?

Context: CREATE TABLE country (Country_id VARCHAR, Country_name VARCHAR); CREATE TABLE match_season (Player VARCHAR, Country VARCHAR)

Answer: [SQL] SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = "Indonesia" [/SQL]


Question: What are the distinct positions of the players from a country whose capital is Dublin?

Context: CREATE TABLE country (Country_id VARCHAR, Capital VARCHAR); CREATE TABLE match_season (Position VARCHAR, Country VARCHAR)

Answer: [SQL] SELECT DISTINCT T2.Position FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Capital = "Dublin" [/SQL]


Question: What are the official languages of the countries of players from Maryland or Duke college?

Context: CREATE TABLE country (Official_native_language VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, College VARCHAR)

Answer: [SQL] SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = "Maryland" OR T2.College = "Duke" [/SQL]


Question: How many distinct official languages are there among countries of players whose positions are defenders.

Context: CREATE TABLE country (Official_native_language VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, Position VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT T1.Official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Defender" [/SQL]


Question: Show the season, the player, and the name of the team that players belong to.

Context: CREATE TABLE team (Name VARCHAR, Team_id VARCHAR); CREATE TABLE match_season (Season VARCHAR, Player VARCHAR, Team VARCHAR)

Answer: [SQL] SELECT T1.Season, T1.Player, T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id [/SQL]


Question: Show the positions of the players from the team with name "Ryley Goldner".

Context: CREATE TABLE match_season (Position VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR)

Answer: [SQL] SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = "Ryley Goldner" [/SQL]


Question: How many distinct colleges are associated with players from the team with name "Columbus Crew".

Context: CREATE TABLE match_season (College VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT T1.College) FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = "Columbus Crew" [/SQL]


Question: Show the players and years played for players from team "Columbus Crew".

Context: CREATE TABLE player (Player VARCHAR, Years_Played VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR)

Answer: [SQL] SELECT T1.Player, T1.Years_Played FROM player AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = "Columbus Crew" [/SQL]


Question: Show the position of players and the corresponding number of players.

Answer: [SQL] SELECT POSITION, COUNT(*) FROM match_season GROUP BY POSITION [/SQL]


Question: Show the country names and the corresponding number of players.

Context: CREATE TABLE match_season (Country VARCHAR); CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR)

Answer: [SQL] SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name [/SQL]


Question: Return all players sorted by college in ascending alphabetical order.

Context: CREATE TABLE match_season (player VARCHAR, College VARCHAR)

Answer: [SQL] SELECT player FROM match_season ORDER BY College [/SQL]


Question: Show the most common position of players in match seasons.

Context: CREATE TABLE match_season (POSITION VARCHAR)

Answer: [SQL] SELECT POSITION FROM match_season GROUP BY POSITION ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Show the top 3 most common colleges of players in match seasons.

Context: CREATE TABLE match_season (College VARCHAR)

Answer: [SQL] SELECT College FROM match_season GROUP BY College ORDER BY COUNT(*) DESC LIMIT 3 [/SQL]


Question: Show the name of colleges that have at least two players.

Answer: [SQL] SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 [/SQL]


Question: Show the name of colleges that have at least two players in descending alphabetical order.

Answer: [SQL] SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC [/SQL]


Question: What are the names of teams that do no have match season record?

Context: CREATE TABLE match_season (Name VARCHAR, Team_id VARCHAR, Team VARCHAR); CREATE TABLE team (Name VARCHAR, Team_id VARCHAR, Team VARCHAR)

Answer: [SQL] SELECT Name FROM team WHERE NOT Team_id IN (SELECT Team FROM match_season) [/SQL]


Question: What are the names of countries that have both players with position forward and players with position defender?

Context: CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, Position VARCHAR)

Answer: [SQL] SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Forward" INTERSECT SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Defender" [/SQL]


Question: Which college have both players with position midfielder and players with position defender?

Context: CREATE TABLE match_season (College VARCHAR, POSITION VARCHAR)

Answer: [SQL] SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender" [/SQL]


Question: How many climbers are there?

Context: CREATE TABLE climber (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM climber [/SQL]


Question: List the names of climbers in descending order of points.

Context: CREATE TABLE climber (Name VARCHAR, Points VARCHAR)

Answer: [SQL] SELECT Name FROM climber ORDER BY Points DESC [/SQL]


Question: List the names of climbers whose country is not Switzerland.

Context: CREATE TABLE climber (Name VARCHAR, Country VARCHAR)

Answer: [SQL] SELECT Name FROM climber WHERE Country <> "Switzerland" [/SQL]


Question: What is the maximum point for climbers whose country is United Kingdom?

Context: CREATE TABLE climber (Points INTEGER, Country VARCHAR)

Answer: [SQL] SELECT MAX(Points) FROM climber WHERE Country = "United Kingdom" [/SQL]


Question: How many distinct countries are the climbers from?

Context: CREATE TABLE climber (Country VARCHAR)

Answer: [SQL] SELECT COUNT(DISTINCT Country) FROM climber [/SQL]


Question: What are the names of mountains in ascending alphabetical order?

Context: CREATE TABLE mountain (Name VARCHAR)

Answer: [SQL] SELECT Name FROM mountain ORDER BY Name [/SQL]


Question: What are the countries of mountains with height bigger than 5000?

Context: CREATE TABLE mountain (Country VARCHAR, Height INTEGER)

Answer: [SQL] SELECT Country FROM mountain WHERE Height > 5000 [/SQL]


Question: What is the name of the highest mountain?

Context: CREATE TABLE mountain (Name VARCHAR, Height VARCHAR)

Answer: [SQL] SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1 [/SQL]


Question: List the distinct ranges of the mountains with the top 3 prominence.

Context: CREATE TABLE mountain (Range VARCHAR, Prominence VARCHAR)

Answer: [SQL] SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3 [/SQL]


Question: Show names of climbers and the names of mountains they climb.

Context: CREATE TABLE mountain (Name VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Name VARCHAR, Mountain_ID VARCHAR)

Answer: [SQL] SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID [/SQL]


Question: Show the names of climbers and the heights of mountains they climb.

Context: CREATE TABLE mountain (Height VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Name VARCHAR, Mountain_ID VARCHAR)

Answer: [SQL] SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID [/SQL]


Question: Show the height of the mountain climbed by the climber with the maximum points.

Context: CREATE TABLE climber (Mountain_ID VARCHAR, Points VARCHAR); CREATE TABLE mountain (Height VARCHAR, Mountain_ID VARCHAR)

Answer: [SQL] SELECT T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID ORDER BY T1.Points DESC LIMIT 1 [/SQL]


Question: Show the distinct names of mountains climbed by climbers from country "West Germany".

Context: CREATE TABLE mountain (Name VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Mountain_ID VARCHAR, Country VARCHAR)

Answer: [SQL] SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany" [/SQL]


Question: Show the times used by climbers to climb mountains in Country Uganda.

Context: CREATE TABLE mountain (Mountain_ID VARCHAR, Country VARCHAR); CREATE TABLE climber (Time VARCHAR, Mountain_ID VARCHAR)

Answer: [SQL] SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = "Uganda" [/SQL]


Question: Please show the countries and the number of climbers from each country.

Context: CREATE TABLE climber (Country VARCHAR)

Answer: [SQL] SELECT Country, COUNT(*) FROM climber GROUP BY Country [/SQL]


Question: List the countries that have more than one mountain.

Context: CREATE TABLE mountain (Country VARCHAR)

Answer: [SQL] SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1 [/SQL]


Question: List the names of mountains that do not have any climber.

Answer: [SQL] SELECT Name FROM mountain WHERE NOT Mountain_ID IN (SELECT Mountain_ID FROM climber) [/SQL]


Question: Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200.

Answer: [SQL] SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200 [/SQL]


Question: Show the range that has the most number of mountains.

Context: CREATE TABLE mountain (Range VARCHAR)

Answer: [SQL] SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: Show the names of mountains with height more than 5000 or prominence more than 1000.

Context: CREATE TABLE mountain (Name VARCHAR, Height VARCHAR, Prominence VARCHAR)

Answer: [SQL] SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000 [/SQL]


Question: How many body builders are there?

Context: CREATE TABLE body_builder (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM body_builder [/SQL]


Question: List the total scores of body builders in ascending order.

Context: CREATE TABLE body_builder (Total VARCHAR)

Answer: [SQL] SELECT Total FROM body_builder ORDER BY Total [/SQL]


Question: List the snatch score and clean jerk score of body builders in ascending order of snatch score.

Context: CREATE TABLE body_builder (Snatch VARCHAR, Clean_Jerk VARCHAR)

Answer: [SQL] SELECT Snatch, Clean_Jerk FROM body_builder ORDER BY Snatch [/SQL]


Question: What is the average snatch score of body builders?

Context: CREATE TABLE body_builder (Snatch INTEGER)

Answer: [SQL] SELECT AVG(Snatch) FROM body_builder [/SQL]


Question: What are the clean and jerk score of the body builder with the highest total score?

Context: CREATE TABLE body_builder (Clean_Jerk VARCHAR, Total VARCHAR)

Answer: [SQL] SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1 [/SQL]


Question: What are the birthdays of people in ascending order of height?

Context: CREATE TABLE People (Birth_Date VARCHAR, Height VARCHAR)

Answer: [SQL] SELECT Birth_Date FROM People ORDER BY Height [/SQL]


Question: What are the names of body builders?

Context: CREATE TABLE body_builder (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR)

Answer: [SQL] SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID [/SQL]


Question: What are the names of body builders whose total score is higher than 300?

Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE body_builder (People_ID VARCHAR, Total INTEGER)

Answer: [SQL] SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300 [/SQL]


Question: What is the name of the body builder with the greatest body weight?

Context: CREATE TABLE body_builder (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Weight VARCHAR)

Answer: [SQL] SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1 [/SQL]


Question: What are the birth date and birth place of the body builder with the highest total points?

Context: CREATE TABLE body_builder (People_ID VARCHAR, Total VARCHAR); CREATE TABLE people (Birth_Date VARCHAR, Birth_Place VARCHAR, People_ID VARCHAR)

Answer: [SQL] SELECT T2.Birth_Date, T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC LIMIT 1 [/SQL]


Question: What are the heights of body builders with total score smaller than 315?

Context: CREATE TABLE people (Height VARCHAR, People_ID VARCHAR); CREATE TABLE body_builder (People_ID VARCHAR, Total INTEGER)

Answer: [SQL] SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315 [/SQL]


Question: What is the average total score of body builders with height bigger than 200?

Context: CREATE TABLE people (People_ID VARCHAR, Height INTEGER); CREATE TABLE body_builder (Total INTEGER, People_ID VARCHAR)

Answer: [SQL] SELECT AVG(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200 [/SQL]


Question: What are the names of body builders in descending order of total scores?

Context: CREATE TABLE body_builder (People_ID VARCHAR, Total VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR)

Answer: [SQL] SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC [/SQL]


Question: List each birth place along with the number of people from there.

Context: CREATE TABLE people (Birth_Place VARCHAR)

Answer: [SQL] SELECT Birth_Place, COUNT(*) FROM people GROUP BY Birth_Place [/SQL]


Question: What is the most common birth place of people?

Answer: [SQL] SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What are the birth places that are shared by at least two people?

Answer: [SQL] SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2 [/SQL]


Question: List the height and weight of people in descending order of height.

Context: CREATE TABLE people (Height VARCHAR, Weight VARCHAR)

Answer: [SQL] SELECT Height, Weight FROM people ORDER BY Height DESC [/SQL]


Question: Show all information about each body builder.

Context: CREATE TABLE body_builder (Id VARCHAR)

Answer: [SQL] SELECT * FROM body_builder [/SQL]


Question: List the names and origins of people who are not body builders.

Context: CREATE TABLE people (Name VARCHAR, birth_place VARCHAR, people_id VARCHAR); CREATE TABLE body_builder (people_id VARCHAR); CREATE TABLE people (Name VARCHAR, birth_place VARCHAR)

Answer: [SQL] SELECT Name, birth_place FROM people EXCEPT SELECT T1.Name, T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id = T2.people_id [/SQL]


Question: How many distinct birth places are there?

Answer: [SQL] SELECT COUNT(DISTINCT Birth_Place) FROM people [/SQL]


Question: How many persons are not body builders?

Context: CREATE TABLE body_builder (people_id VARCHAR, People_ID VARCHAR); CREATE TABLE people (people_id VARCHAR, People_ID VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM people WHERE NOT people_id IN (SELECT People_ID FROM body_builder) [/SQL]


Question: List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200.

Context: CREATE TABLE people (weight VARCHAR, people_id VARCHAR, height VARCHAR); CREATE TABLE body_builder (people_id VARCHAR, snatch VARCHAR)

Answer: [SQL] SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T1.snatch > 140 OR T2.height > 200 [/SQL]


Question: What are the total scores of the body builders whose birthday contains the string "January" ?

Context: CREATE TABLE people (people_id VARCHAR, Birth_Date VARCHAR); CREATE TABLE body_builder (total VARCHAR, people_id VARCHAR)

Answer: [SQL] SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE "%January%" [/SQL]


Question: What is the minimum snatch score?

Context: CREATE TABLE body_builder (snatch INTEGER)

Answer: [SQL] SELECT MIN(snatch) FROM body_builder [/SQL]


Question: How many elections are there?

Context: CREATE TABLE election (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM election [/SQL]


Question: List the votes of elections in descending order.

Context: CREATE TABLE election (Votes VARCHAR)

Answer: [SQL] SELECT Votes FROM election ORDER BY Votes DESC [/SQL]


Question: List the dates and vote percents of elections.

Context: CREATE TABLE election (Date VARCHAR, Vote_Percent VARCHAR)

Answer: [SQL] SELECT Date, Vote_Percent FROM election [/SQL]


Question: What are the minimum and maximum vote percents of elections?

Context: CREATE TABLE election (Vote_Percent INTEGER)

Answer: [SQL] SELECT MIN(Vote_Percent), MAX(Vote_Percent) FROM election [/SQL]


Question: What are the names and parties of representatives?

Context: CREATE TABLE representative (Name VARCHAR, Party VARCHAR)

Answer: [SQL] SELECT Name, Party FROM representative [/SQL]


Question: What are the names of representatives whose party is not "Republican"?

Context: CREATE TABLE Representative (Name VARCHAR, Party VARCHAR)

Answer: [SQL] SELECT Name FROM Representative WHERE Party <> "Republican" [/SQL]


Question: What are the life spans of representatives from New York state or Indiana state?

Context: CREATE TABLE representative (Lifespan VARCHAR, State VARCHAR)

Answer: [SQL] SELECT Lifespan FROM representative WHERE State = "New York" OR State = "Indiana" [/SQL]


Question: What are the names of representatives and the dates of elections they participated in.

Context: CREATE TABLE election (Date VARCHAR, Representative_ID VARCHAR); CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR)

Answer: [SQL] SELECT T2.Name, T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID [/SQL]


Question: What are the names of representatives with more than 10000 votes in election?

Context: CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR); CREATE TABLE election (Representative_ID VARCHAR)

Answer: [SQL] SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000 [/SQL]


Question: What are the names of representatives in descending order of votes?

Answer: [SQL] SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC [/SQL]


Question: What is the party of the representative that has the smallest number of votes.

Context: CREATE TABLE representative (Party VARCHAR, Representative_ID VARCHAR); CREATE TABLE election (Representative_ID VARCHAR)

Answer: [SQL] SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes LIMIT 1 [/SQL]


Question: What are the lifespans of representatives in descending order of vote percent?

Context: CREATE TABLE election (Representative_ID VARCHAR); CREATE TABLE representative (Lifespan VARCHAR, Representative_ID VARCHAR)

Answer: [SQL] SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC [/SQL]


Question: What is the average number of votes of representatives from party "Republican"?

Context: CREATE TABLE election (Votes INTEGER, Representative_ID VARCHAR); CREATE TABLE representative (Representative_ID VARCHAR, Party VARCHAR)

Answer: [SQL] SELECT AVG(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican" [/SQL]


Question: What are the different parties of representative? Show the party name and the number of representatives in each party.

Context: CREATE TABLE representative (Party VARCHAR)

Answer: [SQL] SELECT Party, COUNT(*) FROM representative GROUP BY Party [/SQL]


Question: What is the party that has the largest number of representatives?

Answer: [SQL] SELECT Party, COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1 [/SQL]


Question: What parties have at least three representatives?

Answer: [SQL] SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3 [/SQL]


Question: What states have at least two representatives?

Context: CREATE TABLE representative (State VARCHAR)

Answer: [SQL] SELECT State FROM representative GROUP BY State HAVING COUNT(*) >= 2 [/SQL]


Question: List the names of representatives that have not participated in elections listed here.

Context: CREATE TABLE election (Name VARCHAR, Representative_ID VARCHAR); CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR)

Answer: [SQL] SELECT Name FROM representative WHERE NOT Representative_ID IN (SELECT Representative_ID FROM election) [/SQL]


Question: Show the parties that have both representatives in New York state and representatives in Pennsylvania state.

Context: CREATE TABLE representative (Party VARCHAR, State VARCHAR)

Answer: [SQL] SELECT Party FROM representative WHERE State = "New York" INTERSECT SELECT Party FROM representative WHERE State = "Pennsylvania" [/SQL]


Question: How many distinct parties are there for representatives?

Answer: [SQL] SELECT COUNT(DISTINCT Party) FROM representative [/SQL]


Question: How many apartment bookings are there in total?

Context: CREATE TABLE Apartment_Bookings (Id VARCHAR)

Answer: [SQL] SELECT COUNT(*) FROM Apartment_Bookings [/SQL]


Question: Show the start dates and end dates of all the apartment bookings.

Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, booking_end_date VARCHAR)

Answer: [SQL] SELECT booking_start_date, booking_end_date FROM Apartment_Bookings [/SQL]


Question: Show all distinct building descriptions.

Context: CREATE TABLE Apartment_Buildings (building_description VARCHAR)

Answer: [SQL] SELECT DISTINCT building_description FROM Apartment_Buildings [/SQL]


Question: Show the short names of the buildings managed by "Emma".

Context: CREATE TABLE Apartment_Buildings (building_short_name VARCHAR, building_manager VARCHAR)

Answer: [SQL] SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma" [/SQL]


Question: Show the addresses and phones of all the buildings managed by "Brenden".

Context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_phone VARCHAR, building_manager VARCHAR)

Answer: [SQL] SELECT building_address, building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden" [/SQL]


Question: What are the building full names that contain the word "court"?

Context: CREATE TABLE Apartment_Buildings (building_full_name VARCHAR)

Answer: [SQL] SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%" [/SQL]


Question: What is the minimum and maximum number of bathrooms of all the apartments?

Context: CREATE TABLE Apartments (bathroom_count INTEGER)

Answer: [SQL] SELECT MIN(bathroom_count), MAX(bathroom_count) FROM Apartments [/SQL]


Question: What is the average number of bedrooms of all apartments?

Context: CREATE TABLE Apartments (bedroom_count INTEGER)

Answer: [SQL] SELECT AVG(bedroom_count) FROM Apartments [/SQL]


Question: Return the apartment number and the number of rooms for each apartment.

Context: CREATE TABLE Apartments (apt_number VARCHAR, room_count VARCHAR)

Answer: [SQL] SELECT apt_number, room_count FROM Apartments [/SQL]


Question: What is the average number of rooms of apartments with type code "Studio"?

Context: CREATE TABLE Apartments (room_count INTEGER, apt_type_code VARCHAR)

Answer: [SQL] SELECT AVG(room_count) FROM Apartments WHERE apt_type_code = "Studio" [/SQL]


Question: Return the apartment numbers of the apartments with type code "Flat".

Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_type_code VARCHAR)

Answer: [SQL] SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat" [/SQL]


Question: Return the first names and last names of all guests

Context: CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR)

Answer: [SQL] SELECT guest_first_name, guest_last_name FROM Guests [/SQL]


Question: Return the date of birth for all the guests with gender code "Male".

Context: CREATE TABLE Guests (date_of_birth VARCHAR, gender_code VARCHAR)

Answer: [SQL] SELECT date_of_birth FROM Guests WHERE gender_code = "Male" [/SQL]


Question: Show the apartment numbers, start dates, and end dates of all the apartment bookings.

Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR)

Answer: [SQL] SELECT T2.apt_number, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id [/SQL]


Question: What are the booking start and end dates of the apartments with type code "Duplex"?

Context: CREATE TABLE Apartments (apt_id VARCHAR, apt_type_code VARCHAR); CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR)

Answer: [SQL] SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex" [/SQL]


Question: What are the booking start and end dates of the apartments with more than 2 bedrooms?

Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER)

Answer: [SQL] SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 [/SQL]


Question: What is the booking status code of the apartment with apartment number "Suite 634"?

Context: CREATE TABLE Apartments (apt_id VARCHAR, apt_number VARCHAR); CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR, apt_id VARCHAR)

Answer: [SQL] SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = "Suite 634" [/SQL]


Question: Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".

Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR); CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR)

Answer: [SQL] SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" [/SQL]


Question: Show the average room count of the apartments that have booking status code "Provisional".

Context: CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR)

Answer: [SQL] SELECT AVG(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional" [/SQL]


Question: Show the guest first names, start dates, and end dates of all the apartment bookings.

Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_id VARCHAR)

Answer: [SQL] SELECT T2.guest_first_name, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id [/SQL]


Question: Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".

Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_id VARCHAR, gender_code VARCHAR)

Answer: [SQL] SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female" [/SQL]


Question: Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".

Context: CREATE TABLE Apartment_Bookings (guest_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR, guest_id VARCHAR)

Answer: [SQL] SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed" [/SQL]


Question: Show the facility codes of apartments with more than 4 bedrooms.

Context: CREATE TABLE Apartment_Facilities (facility_code VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER)

Answer: [SQL] SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 [/SQL]


Question: Show the total number of rooms of all apartments with facility code "Gym".

Context: CREATE TABLE Apartments (room_count INTEGER, apt_id VARCHAR); CREATE TABLE Apartment_Facilities (apt_id VARCHAR, facility_code VARCHAR)

Answer: [SQL] SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym" [/SQL]