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)

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"


Question: How many debit cards do we have?

Context: CREATE TABLE Customers_cards (card_type_code VARCHAR)

SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = "Debit"


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)

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"


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

Context: CREATE TABLE Customers_cards (customer_id VARCHAR)

SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id


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

SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


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)

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


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

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


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

SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code


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

SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1


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

SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5


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)

SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code


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)

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"


Question: Show all card type codes.

Context: CREATE TABLE Customers_Cards (card_type_code VARCHAR)

SELECT DISTINCT card_type_code FROM Customers_Cards


Question: Show the number of card types.

SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards


Question: Show all transaction types.

Context: CREATE TABLE Financial_Transactions (transaction_type VARCHAR)

SELECT DISTINCT transaction_type FROM Financial_Transactions


Question: Show the number of transaction types.

SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions


Question: What is the average and total transaction amount?

Context: CREATE TABLE Financial_transactions (transaction_amount INTEGER)

SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions


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)

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


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

Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR)

SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type


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)

SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1


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

Context: CREATE TABLE Financial_transactions (account_id VARCHAR)

SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id


Question: How many tracks do we have?

Context: CREATE TABLE track (Id VARCHAR)


Question: Show the name and location for all tracks.

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


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)

SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating


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)

SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1


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

Context: CREATE TABLE track (seating INTEGER)

SELECT MIN(seating), MAX(seating), AVG(seating) FROM track


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)

SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)


Question: What are distinct locations where tracks are located?

Context: CREATE TABLE track (LOCATION VARCHAR)


Question: How many races are there?

Context: CREATE TABLE race (Id VARCHAR)


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

Context: CREATE TABLE race (CLASS VARCHAR)


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

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


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

Context: CREATE TABLE race (CLASS VARCHAR)

SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS


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

Context: CREATE TABLE race (CLASS VARCHAR)

SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1


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

Context: CREATE TABLE race (CLASS VARCHAR)

SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2


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)

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'


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)

SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)


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)

SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000


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)

SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id


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

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


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)

SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id


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)

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


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)

SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000


Question: How many members have the black membership card?

Context: CREATE TABLE member (Membership_card VARCHAR)

SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'


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

Context: CREATE TABLE member (address VARCHAR)

SELECT COUNT(*), address FROM member GROUP BY address


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

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

SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'


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)

SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30


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)

SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase


Question: Which membership card has more than 5 members?

SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5


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

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

SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40


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)

SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'


Question: How many members are not living in Hartford?

Context: CREATE TABLE member (address VARCHAR)

SELECT COUNT(*) FROM member WHERE address <> 'Hartford'


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

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

SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'


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

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

SELECT address FROM shop ORDER BY open_year


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

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

SELECT AVG(num_of_staff), AVG(score) FROM shop


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)

SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)


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)

SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)


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)

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'


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

Context: CREATE TABLE happy_hour (shop_id VARCHAR)

SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1


Question: Which month has the most happy hours?

Context: CREATE TABLE happy_hour (MONTH VARCHAR)

SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1


Question: Which months have more than 2 happy hours?

Context: CREATE TABLE happy_hour (MONTH VARCHAR)

SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2


Question: How many albums are there?

Context: CREATE TABLE ALBUM (Id VARCHAR)


Question: List the names of all music genres.

Context: CREATE TABLE GENRE (Name VARCHAR)


Question: Find all the customer information in state NY.

Context: CREATE TABLE CUSTOMER (State VARCHAR)

SELECT * FROM CUSTOMER WHERE State = "NY"


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)

SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "Calgary"


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

Context: CREATE TABLE INVOICE (BillingCountry VARCHAR)

SELECT DISTINCT (BillingCountry) FROM INVOICE


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

Context: CREATE TABLE ARTIST (Name VARCHAR)

SELECT Name FROM ARTIST WHERE Name LIKE "%a%"


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)

SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC"


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

SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica"


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)

SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall"


Question: Which artist has the most albums?

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

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


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

Context: CREATE TABLE TRACK (Name VARCHAR)

SELECT Name FROM TRACK WHERE Name LIKE '%you%'


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

Context: CREATE TABLE TRACK (UnitPrice INTEGER)


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

Context: CREATE TABLE TRACK (Milliseconds INTEGER)

SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK


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)

SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID


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)

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


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

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

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


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)

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


Question: How many tracks belong to rock genre?

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

SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"


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

SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz"


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)

SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"


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

Context: CREATE TABLE CUSTOMER (Email VARCHAR)

SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%"


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)

SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie"


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)

SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174"


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

Context: CREATE TABLE EMPLOYEE (city VARCHAR)

SELECT COUNT(DISTINCT city) FROM EMPLOYEE


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)

SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber"


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)

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


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)

SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil"


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)

SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany"


Question: List the phone numbers of all employees.

Context: CREATE TABLE EMPLOYEE (Phone VARCHAR)


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)

SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file"


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

SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop"


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)

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


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)

SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20


Question: Please list all album titles in alphabetical order.

Context: CREATE TABLE ALBUM (Title VARCHAR)


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)

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


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)

SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId


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)

SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"


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

SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop"


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

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

SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton"


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

Context: CREATE TABLE TRACK (UnitPrice VARCHAR)


Question: How many artists do not have any album?

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

SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)


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)

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'


Question: Find all the phone numbers.

Context: CREATE TABLE available_policies (customer_phone VARCHAR)

SELECT customer_phone FROM available_policies


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

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

SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance"


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

Context: CREATE TABLE available_policies (policy_type_code VARCHAR)

SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1


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

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)


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

SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4


Question: Find the total and average amount of settlements.

Context: CREATE TABLE settlements (settlement_amount INTEGER)

SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements


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)

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


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)

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


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)

SELECT COUNT(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Dayana Robel"


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)

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


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)

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"


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

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)


Question: List all the services in the alphabetical order.

Context: CREATE TABLE services (service_name VARCHAR)

SELECT service_name FROM services ORDER BY service_name


Question: How many services are there?

Context: CREATE TABLE services (Id VARCHAR)


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)

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


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)

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"


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

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"


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

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

SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"


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

SELECT MAX(settlement_amount), MIN(settlement_amount) FROM settlements


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

SELECT customer_id, customer_name FROM customers ORDER BY customer_id


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)

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%"


Question: How many kinds of enzymes are there?

Context: CREATE TABLE enzyme (Id VARCHAR)


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

Context: CREATE TABLE enzyme (name VARCHAR)

SELECT name FROM enzyme ORDER BY name DESC


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

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


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

Context: CREATE TABLE enzyme (OMIM INTEGER)


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)

SELECT product, chromosome, porphyria FROM enzyme WHERE LOCATION = 'Cytosol'


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

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

SELECT name FROM enzyme WHERE product <> 'Heme'


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)

SELECT name, trade_name FROM medicine WHERE FDA_approved = 'Yes'


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)

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'


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)

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


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)

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


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)

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


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)

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'


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)

SELECT interaction_type, COUNT(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY COUNT(*) DESC LIMIT 1


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

Context: CREATE TABLE medicine (FDA_approved VARCHAR)

SELECT COUNT(*) FROM medicine WHERE FDA_approved = 'No'


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)

SELECT COUNT(*) FROM enzyme WHERE NOT id IN (SELECT enzyme_id FROM medicine_enzyme_interaction)


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)

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


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)

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'


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)

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'


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)

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'


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

SELECT COUNT(DISTINCT FDA_approved) FROM medicine


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

Context: CREATE TABLE enzyme (name VARCHAR)

SELECT name FROM enzyme WHERE name LIKE "%ALA%"


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

Context: CREATE TABLE medicine (trade_name VARCHAR)

SELECT trade_name, COUNT(*) FROM medicine GROUP BY trade_name


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

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

SELECT school, nickname FROM university ORDER BY founded


Question: List all public schools and their locations.

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

SELECT school, LOCATION FROM university WHERE affiliation = 'Public'


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

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

SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1


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

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

SELECT founded FROM university WHERE affiliation <> 'Public' ORDER BY founded DESC LIMIT 1


Question: How many schools are in the basketball match?

Context: CREATE TABLE basketball_match (school_id VARCHAR)

SELECT COUNT(DISTINCT school_id) FROM basketball_match


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

Context: CREATE TABLE basketball_match (acc_percent VARCHAR)

SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1


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)

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


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)

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


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)

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'


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

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

SELECT AVG(enrollment) FROM university WHERE founded < 1850


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

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

SELECT enrollment, primary_conference FROM university ORDER BY founded LIMIT 1


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

Context: CREATE TABLE university (enrollment INTEGER)

SELECT SUM(enrollment), MIN(enrollment) FROM university


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

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

SELECT SUM(enrollment), affiliation FROM university GROUP BY affiliation


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)

SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match)


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

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

SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public'


Question: Find how many different affiliation types there are.

Context: CREATE TABLE university (affiliation VARCHAR)

SELECT COUNT(DISTINCT affiliation) FROM university


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

Context: CREATE TABLE university (LOCATION VARCHAR)

SELECT COUNT(*) FROM university WHERE LOCATION LIKE "%NY%"


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)

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)


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

SELECT COUNT(*), affiliation FROM university WHERE enrollment > 20000 GROUP BY affiliation


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)

SELECT SUM(Enrollment), affiliation FROM university WHERE founded > 1850 GROUP BY affiliation


Question: What is the maximum enrollment across all schools?

Context: CREATE TABLE university (Enrollment INTEGER)


Question: List all information regarding the basketball match.

Context: CREATE TABLE basketball_match (Id VARCHAR)


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)

SELECT team_name FROM basketball_match ORDER BY All_Home DESC


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

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

SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004


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)

SELECT Model_name, RAM_MiB FROM chip_model ORDER BY RAM_MiB LIMIT 1


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)

SELECT chip_model, screen_mode FROM phone WHERE Hardware_Model_name = "LG-P760"


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

Context: CREATE TABLE phone (Company_name VARCHAR)

SELECT COUNT(*) FROM phone WHERE Company_name = "Nokia Corporation"


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)

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"


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)

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"


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)

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


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)

SELECT Hardware_Model_name, Company_name FROM phone WHERE Accreditation_type LIKE 'Full'


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)

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"


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)

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"


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.

SELECT Company_name, COUNT(*) FROM phone GROUP BY Company_name ORDER BY COUNT(*) LIMIT 1


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

SELECT Company_name FROM phone GROUP BY Company_name HAVING COUNT(*) > 1


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

Context: CREATE TABLE screen_mode (used_kb INTEGER)

SELECT MAX(used_kb), MIN(used_kb), AVG(used_kb) FROM screen_mode


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)

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


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)

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"


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)

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


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)

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"


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

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"


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)

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


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

Context: CREATE TABLE phone (Accreditation_type VARCHAR)

SELECT Accreditation_type, COUNT(*) FROM phone GROUP BY Accreditation_type


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

Context: CREATE TABLE phone (Accreditation_level VARCHAR)

SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING COUNT(*) > 3


Question: Find the details for all chip models.

Context: CREATE TABLE chip_model (Id VARCHAR)


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

Context: CREATE TABLE chip_model (wifi VARCHAR)

SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'


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

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

SELECT model_name FROM chip_model ORDER BY launch_year


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)

SELECT AVG(RAM_MiB) FROM chip_model WHERE NOT model_name IN (SELECT chip_model FROM phone)


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)

SELECT model_name FROM chip_model EXCEPT SELECT chip_model FROM phone WHERE Accreditation_type = 'Full'


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)

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'


Question: How many countries are there in total?

Context: CREATE TABLE country (Id VARCHAR)


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

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

SELECT Country_name, Capital FROM country


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

Context: CREATE TABLE country (Official_native_language VARCHAR)

SELECT Official_native_language FROM country WHERE Official_native_language LIKE "%English%"


Question: Show all distinct positions of matches.

Context: CREATE TABLE match_season (POSITION VARCHAR)

SELECT DISTINCT POSITION FROM match_season


Question: Show the players from college UCLA.

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

SELECT Player FROM match_season WHERE College = "UCLA"


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

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

SELECT DISTINCT POSITION FROM match_season WHERE College = "UCLA" OR College = "Duke"


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)

SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE POSITION = "Defender"


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

Context: CREATE TABLE match_season (Team VARCHAR)

SELECT COUNT(DISTINCT Team) FROM match_season


Question: Show the players and the years played.

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


Question: Show all team names.

Context: CREATE TABLE Team (Name VARCHAR)


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)

SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country


Question: Which players are from Indonesia?

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

SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = "Indonesia"


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)

SELECT DISTINCT T2.Position FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Capital = "Dublin"


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)

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"


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)

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"


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)

SELECT T1.Season, T1.Player, T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id


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)

SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = "Ryley Goldner"


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)

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"


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)

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"


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

SELECT POSITION, COUNT(*) FROM match_season GROUP BY POSITION


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)

SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name


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

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

SELECT player FROM match_season ORDER BY College


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

Context: CREATE TABLE match_season (POSITION VARCHAR)

SELECT POSITION FROM match_season GROUP BY POSITION ORDER BY COUNT(*) DESC LIMIT 1


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

Context: CREATE TABLE match_season (College VARCHAR)

SELECT College FROM match_season GROUP BY College ORDER BY COUNT(*) DESC LIMIT 3


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

SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2


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

SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC


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)

SELECT Name FROM team WHERE NOT Team_id IN (SELECT Team FROM match_season)


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)

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"


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

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

SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender"


Question: How many climbers are there?

Context: CREATE TABLE climber (Id VARCHAR)


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

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

SELECT Name FROM climber ORDER BY Points DESC


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

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

SELECT Name FROM climber WHERE Country <> "Switzerland"


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

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

SELECT MAX(Points) FROM climber WHERE Country = "United Kingdom"


Question: How many distinct countries are the climbers from?

Context: CREATE TABLE climber (Country VARCHAR)

SELECT COUNT(DISTINCT Country) FROM climber


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

Context: CREATE TABLE mountain (Name VARCHAR)


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

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

SELECT Country FROM mountain WHERE Height > 5000


Question: What is the name of the highest mountain?

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

SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1


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

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

SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3


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)

SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


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)

SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


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)

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


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)

SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany"


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)

SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = "Uganda"


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

Context: CREATE TABLE climber (Country VARCHAR)

SELECT Country, COUNT(*) FROM climber GROUP BY Country


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

Context: CREATE TABLE mountain (Country VARCHAR)

SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1


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

SELECT Name FROM mountain WHERE NOT Mountain_ID IN (SELECT Mountain_ID FROM climber)


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

SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200


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

Context: CREATE TABLE mountain (Range VARCHAR)

SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1


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)

SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000


Question: How many body builders are there?

Context: CREATE TABLE body_builder (Id VARCHAR)


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

Context: CREATE TABLE body_builder (Total VARCHAR)

SELECT Total FROM body_builder ORDER BY Total


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)

SELECT Snatch, Clean_Jerk FROM body_builder ORDER BY Snatch


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

Context: CREATE TABLE body_builder (Snatch INTEGER)


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)

SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1


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

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

SELECT Birth_Date FROM People ORDER BY Height


Question: What are the names of body builders?

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

SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID


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)

SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300


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)

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


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)

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


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)

SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315


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)

SELECT AVG(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200


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)

SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC


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

Context: CREATE TABLE people (Birth_Place VARCHAR)

SELECT Birth_Place, COUNT(*) FROM people GROUP BY Birth_Place


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

SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1


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

SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2


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

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

SELECT Height, Weight FROM people ORDER BY Height DESC


Question: Show all information about each body builder.

Context: CREATE TABLE body_builder (Id VARCHAR)


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)

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


Question: How many distinct birth places are there?

SELECT COUNT(DISTINCT Birth_Place) FROM people


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)

SELECT COUNT(*) FROM people WHERE NOT people_id IN (SELECT People_ID FROM body_builder)


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)

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


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)

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%"


Question: What is the minimum snatch score?

Context: CREATE TABLE body_builder (snatch INTEGER)


Question: How many elections are there?

Context: CREATE TABLE election (Id VARCHAR)


Question: List the votes of elections in descending order.

Context: CREATE TABLE election (Votes VARCHAR)

SELECT Votes FROM election ORDER BY Votes DESC


Question: List the dates and vote percents of elections.

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


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

Context: CREATE TABLE election (Vote_Percent INTEGER)

SELECT MIN(Vote_Percent), MAX(Vote_Percent) FROM election


Question: What are the names and parties of representatives?

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


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

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

SELECT Name FROM Representative WHERE Party <> "Republican"


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

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

SELECT Lifespan FROM representative WHERE State = "New York" OR State = "Indiana"


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)

SELECT T2.Name, T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID


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)

SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000


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

SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC


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)

SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes LIMIT 1


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)

SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC


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)

SELECT AVG(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican"


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)

SELECT Party, COUNT(*) FROM representative GROUP BY Party


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

SELECT Party, COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1


Question: What parties have at least three representatives?

SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3


Question: What states have at least two representatives?

Context: CREATE TABLE representative (State VARCHAR)

SELECT State FROM representative GROUP BY State HAVING COUNT(*) >= 2


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)

SELECT Name FROM representative WHERE NOT Representative_ID IN (SELECT Representative_ID FROM election)


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)

SELECT Party FROM representative WHERE State = "New York" INTERSECT SELECT Party FROM representative WHERE State = "Pennsylvania"


Question: How many distinct parties are there for representatives?

SELECT COUNT(DISTINCT Party) FROM representative


Question: How many apartment bookings are there in total?

Context: CREATE TABLE Apartment_Bookings (Id VARCHAR)


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)

SELECT booking_start_date, booking_end_date FROM Apartment_Bookings


Question: Show all distinct building descriptions.

Context: CREATE TABLE Apartment_Buildings (building_description VARCHAR)

SELECT DISTINCT building_description FROM Apartment_Buildings


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

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

SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma"


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)

SELECT building_address, building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden"


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

Context: CREATE TABLE Apartment_Buildings (building_full_name VARCHAR)

SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"


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

Context: CREATE TABLE Apartments (bathroom_count INTEGER)

SELECT MIN(bathroom_count), MAX(bathroom_count) FROM Apartments


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

Context: CREATE TABLE Apartments (bedroom_count INTEGER)

SELECT AVG(bedroom_count) FROM Apartments


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

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

SELECT apt_number, room_count FROM Apartments


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)

SELECT AVG(room_count) FROM Apartments WHERE apt_type_code = "Studio"


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

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

SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat"


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

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

SELECT guest_first_name, guest_last_name FROM Guests


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)

SELECT date_of_birth FROM Guests WHERE gender_code = "Male"


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)

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


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)

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"


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)

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


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)

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"


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)

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"


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)

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"


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)

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


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)

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"


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)

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"


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)

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


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)

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"


Question: Show the total number of rooms of the apartments in the building with short name "Columbus Square".

Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_short_name VARCHAR); CREATE TABLE Apartments (room_count INTEGER, building_id VARCHAR)

SELECT SUM(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square"


Question: Show the addresses of the buildings that have apartments with more than 2 bathrooms.

Context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_id VARCHAR); CREATE TABLE Apartments (building_id VARCHAR, bathroom_count INTEGER)

SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2


Question: Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".

Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_manager VARCHAR); CREATE TABLE Apartments (apt_type_code VARCHAR, apt_number VARCHAR, building_id VARCHAR)

SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle"


Question: Show the booking status code and the corresponding number of bookings.

Context: CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR)

SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code


Question: Return all the apartment numbers sorted by the room count in ascending order.

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

SELECT apt_number FROM Apartments ORDER BY room_count


Question: Return the apartment number with the largest number of bedrooms.

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

SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1


Question: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.

Context: CREATE TABLE Apartments (apt_type_code VARCHAR)

SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)


Question: Show the top 3 apartment type codes sorted by the average number of rooms in descending order.

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

SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3


Question: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.

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

SELECT apt_type_code, bathroom_count, bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY SUM(room_count) DESC LIMIT 1


Question: Show the most common apartment type code.

SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question: Show the most common apartment type code among apartments with more than 1 bathroom.

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

SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question: Show each apartment type code, and the maximum and minimum number of rooms for each type.

SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM Apartments GROUP BY apt_type_code


Question: Show each gender code and the corresponding count of guests sorted by the count in descending order.

Context: CREATE TABLE Guests (gender_code VARCHAR)

SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC


Question: How many apartments do not have any facility?

Context: CREATE TABLE Apartment_Facilities (apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR)

SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)


Question: Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed"

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

SELECT 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" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"


Question: Show the apartment numbers of apartments with unit status availability of both 0 and 1.

Context: CREATE TABLE View_Unit_Status (apt_id VARCHAR, available_yn VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR)

SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1


Question: How many games are held after season 2007?

Context: CREATE TABLE game (season INTEGER)

SELECT COUNT(*) FROM game WHERE season > 2007


Question: List the dates of games by the home team name in descending order.

Context: CREATE TABLE game (Date VARCHAR, home_team VARCHAR)

SELECT Date FROM game ORDER BY home_team DESC


Question: List the season, home team, away team of all the games.

Context: CREATE TABLE game (season VARCHAR, home_team VARCHAR, away_team VARCHAR)

SELECT season, home_team, away_team FROM game


Question: What are the maximum, minimum and average home games each stadium held?

Context: CREATE TABLE stadium (home_games INTEGER)

SELECT MAX(home_games), MIN(home_games), AVG(home_games) FROM stadium


Question: What is the average attendance of stadiums with capacity percentage higher than 100%?

Context: CREATE TABLE stadium (average_attendance VARCHAR, capacity_percentage INTEGER)

SELECT average_attendance FROM stadium WHERE capacity_percentage > 100


Question: What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?

Context: CREATE TABLE injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury VARCHAR)

SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'


Question: What is the season of the game which causes the player 'Walter Samuel' to get injured?

Context: CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR); CREATE TABLE game (season VARCHAR, id VARCHAR)

SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'


Question: What are the ids, scores, and dates of the games which caused at least two injury accidents?

Context: CREATE TABLE game (id VARCHAR, score VARCHAR, date VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR)

SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2


Question: What are the id and name of the stadium where the most injury accidents happened?

Context: CREATE TABLE stadium (id VARCHAR, name VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR)

SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question: In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?

Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, injury VARCHAR); CREATE TABLE game (season VARCHAR, stadium_id VARCHAR, id VARCHAR)

SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'


Question: How many different kinds of information sources are there for injury accidents?

Context: CREATE TABLE injury_accident (SOURCE VARCHAR)

SELECT COUNT(DISTINCT SOURCE) FROM injury_accident


Question: How many games are free of injury accidents?

Context: CREATE TABLE injury_accident (id VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, game_id VARCHAR)

SELECT COUNT(*) FROM game WHERE NOT id IN (SELECT game_id FROM injury_accident)


Question: How many distinct kinds of injuries happened after season 2010?

Context: CREATE TABLE injury_accident (injury VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, season INTEGER)

SELECT COUNT(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010


Question: List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.

Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR)

SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'


Question: Show the name, average attendance, total attendance for stadiums where no accidents happened.

Context: CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR, id VARCHAR); CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR)

SELECT name, average_attendance, total_attendance FROM stadium EXCEPT SELECT T2.name, T2.average_attendance, T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id


Question: Which stadium name contains the substring "Bank"?

Context: CREATE TABLE stadium (name VARCHAR)

SELECT name FROM stadium WHERE name LIKE "%Bank%"


Question: How many games has each stadium held?

Context: CREATE TABLE stadium (id VARCHAR); CREATE TABLE game (stadium_id VARCHAR)

SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id


Question: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.

Context: CREATE TABLE game (date VARCHAR, id VARCHAR, season VARCHAR); CREATE TABLE injury_accident (player VARCHAR, game_id VARCHAR)

SELECT T1.date, T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC


Question: List all country and league names.

Context: CREATE TABLE League (name VARCHAR, country_id VARCHAR); CREATE TABLE Country (name VARCHAR, id VARCHAR)

SELECT T1.name, T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id


Question: How many leagues are there in England?

Context: CREATE TABLE League (country_id VARCHAR); CREATE TABLE Country (id VARCHAR, name VARCHAR)

SELECT COUNT(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England"


Question: What is the average weight of all players?

Context: CREATE TABLE Player (weight INTEGER)


Question: What is the maximum and minimum height of all players?

Context: CREATE TABLE Player (weight INTEGER)

SELECT MAX(weight), MIN(weight) FROM Player


Question: List all player names who have an overall rating higher than the average.

Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating INTEGER)

SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > (SELECT AVG(overall_rating) FROM Player_Attributes)


Question: What are the names of players who have the best dribbling?

Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, dribbling VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER)

SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(overall_rating) FROM Player_Attributes)


Question: List the names of all players who have a crossing score higher than 90 and prefer their right foot.

Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, crossing VARCHAR, preferred_foot VARCHAR)

SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = "right"


Question: List the names of all left-footed players who have overall rating between 85 and 90.

Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating VARCHAR, preferred_foot VARCHAR)

SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90


Question: What is the average rating for right-footed players and left-footed players?

Context: CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER)

SELECT preferred_foot, AVG(overall_rating) FROM Player_Attributes GROUP BY preferred_foot


Question: Of all players with an overall rating greater than 80, how many are right-footed and left-footed?

SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot


Question: List all of the player ids with a height of at least 180cm and an overall rating higher than 85.

Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER); CREATE TABLE Player (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER)

SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85


Question: List all of the ids for left-footed players with a height between 180cm and 190cm.

Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR); CREATE TABLE Player (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR)

SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left"


Question: Who are the top 3 players in terms of overall rating?

Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR)

SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3


Question: List the names and birthdays of the top five players in terms of potential.

Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR); CREATE TABLE Player (player_name VARCHAR, birthday VARCHAR, player_api_id VARCHAR)

SELECT DISTINCT T1.player_name, T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5


Question: How many performances are there?

Context: CREATE TABLE performance (Id VARCHAR)


Question: List the hosts of performances in ascending order of attendance.

Context: CREATE TABLE performance (HOST VARCHAR, Attendance VARCHAR)

SELECT HOST FROM performance ORDER BY Attendance


Question: What are the dates and locations of performances?

Context: CREATE TABLE performance (Date VARCHAR, LOCATION VARCHAR)


Question: Show the attendances of the performances at location "TD Garden" or "Bell Centre"

Context: CREATE TABLE performance (Attendance VARCHAR, LOCATION VARCHAR)

SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre"


Question: What is the average number of attendees for performances?

Context: CREATE TABLE performance (Attendance INTEGER)


Question: What is the date of the performance with the highest number of attendees?

Context: CREATE TABLE performance (Date VARCHAR, Attendance VARCHAR)

SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1


Question: Show different locations and the number of performances at each location.

Context: CREATE TABLE performance (LOCATION VARCHAR)

SELECT LOCATION, COUNT(*) FROM performance GROUP BY LOCATION


Question: Show the most common location of performances.

SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


Question: Show the locations that have at least two performances.

SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2