training_input
stringlengths 118
1.06k
|
---|
###context:CREATE TABLE Customers_cards (card_type_code VARCHAR)
###human: What is the card type code with most number of cards?
###assistant: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE Customers_cards (card_type_code VARCHAR)
###human: Show card type codes with at least 5 cards.
###assistant: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5 |
###context:CREATE TABLE Customers_cards (card_type_code VARCHAR, customer_id VARCHAR)
###human: Show all card type codes and the number of customers holding cards in each type.
###assistant: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code |
###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)
###human: Show the customer ids and firstname without a credit card.
###assistant: 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" |
###context:CREATE TABLE Customers_Cards (card_type_code VARCHAR)
###human: Show all card type codes.
###assistant: SELECT DISTINCT card_type_code FROM Customers_Cards |
###context:CREATE TABLE Customers_Cards (card_type_code VARCHAR)
###human: Show the number of card types.
###assistant: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards |
###context:CREATE TABLE Financial_Transactions (transaction_type VARCHAR)
###human: Show all transaction types.
###assistant: SELECT DISTINCT transaction_type FROM Financial_Transactions |
###context:CREATE TABLE Financial_Transactions (transaction_type VARCHAR)
###human: Show the number of transaction types.
###assistant: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions |
###context:CREATE TABLE Financial_transactions (transaction_amount INTEGER)
###human: What is the average and total transaction amount?
###assistant: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions |
###context:CREATE TABLE Financial_transactions (card_id VARCHAR); CREATE TABLE Customers_cards (card_type_code VARCHAR, card_id VARCHAR)
###human: Show the card type codes and the number of transactions.
###assistant: 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 |
###context:CREATE TABLE Financial_transactions (transaction_type VARCHAR)
###human: Show the transaction type and the number of transactions.
###assistant: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type |
###context:CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER)
###human: What is the transaction type that has processed the greatest total amount in transactions?
###assistant: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1 |
###context:CREATE TABLE Financial_transactions (account_id VARCHAR)
###human: Show the account id and the number of transactions for each account
###assistant: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id |
###context:CREATE TABLE track (Id VARCHAR)
###human: How many tracks do we have?
###assistant: SELECT COUNT(*) FROM track |
###context:CREATE TABLE track (name VARCHAR, LOCATION VARCHAR)
###human: Show the name and location for all tracks.
###assistant: SELECT name, LOCATION FROM track |
###context:CREATE TABLE track (name VARCHAR, seating VARCHAR, year_opened INTEGER)
###human: Show names and seatings, ordered by seating for all tracks opened after 2000.
###assistant: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating |
###context:CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, seating VARCHAR, year_opened VARCHAR)
###human: What is the name, location and seating for the most recently opened track?
###assistant: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1 |
###context:CREATE TABLE track (seating INTEGER)
###human: What is the minimum, maximum, and average seating for all tracks.
###assistant: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track |
###context:CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, year_opened VARCHAR, seating INTEGER)
###human: Show the name, location, open year for all tracks with a seating higher than the average.
###assistant: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track) |
###context:CREATE TABLE track (LOCATION VARCHAR)
###human: What are distinct locations where tracks are located?
###assistant: SELECT DISTINCT LOCATION FROM track |
###context:CREATE TABLE race (Id VARCHAR)
###human: How many races are there?
###assistant: SELECT COUNT(*) FROM race |
###context:CREATE TABLE race (CLASS VARCHAR)
###human: What are the distinct classes that races can have?
###assistant: SELECT DISTINCT CLASS FROM race |
###context:CREATE TABLE race (name VARCHAR, CLASS VARCHAR, date VARCHAR)
###human: Show name, class, and date for all races.
###assistant: SELECT name, CLASS, date FROM race |
###context:CREATE TABLE race (CLASS VARCHAR)
###human: Show the race class and number of races in each class.
###assistant: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS |
###context:CREATE TABLE race (CLASS VARCHAR)
###human: What is the race class with most number of races.
###assistant: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE race (CLASS VARCHAR)
###human: List the race class with at least two races.
###assistant: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2 |
###context:CREATE TABLE race (track_id VARCHAR, class VARCHAR); CREATE TABLE track (name VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)
###human: What are the names for tracks without a race in class 'GT'.
###assistant: 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' |
###context:CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (name VARCHAR, track_id VARCHAR)
###human: Show all track names that have had no races.
###assistant: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race) |
###context:CREATE TABLE track (year_opened VARCHAR, seating INTEGER)
###human: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
###assistant: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000 |
###context:CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR)
###human: Show the name of track and the number of races in each track.
###assistant: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id |
###context:CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR)
###human: Show the name of track with most number of races.
###assistant: 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 |
###context:CREATE TABLE race (name VARCHAR, date VARCHAR, track_id VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)
###human: Show the name and date for each race and its track name.
###assistant: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id |
###context:CREATE TABLE race (track_id VARCHAR); CREATE TABLE track (name VARCHAR, location VARCHAR, track_id VARCHAR)
###human: Show the name and location of track with 1 race.
###assistant: 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 |
###context:CREATE TABLE track (LOCATION VARCHAR, seating INTEGER)
###human: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
###assistant: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000 |
###context:CREATE TABLE member (Membership_card VARCHAR)
###human: How many members have the black membership card?
###assistant: SELECT COUNT(*) FROM member WHERE Membership_card = 'Black' |
###context:CREATE TABLE member (address VARCHAR)
###human: Find the number of members living in each address.
###assistant: SELECT COUNT(*), address FROM member GROUP BY address |
###context:CREATE TABLE member (name VARCHAR, address VARCHAR)
###human: Give me the names of members whose address is in Harford or Waterbury.
###assistant: SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury' |
###context:CREATE TABLE member (name VARCHAR, member_id VARCHAR, Membership_card VARCHAR, age VARCHAR)
###human: Find the ids and names of members who are under age 30 or with black membership card.
###assistant: SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30 |
###context:CREATE TABLE member (Time_of_purchase VARCHAR, age VARCHAR, address VARCHAR)
###human: Find the purchase time, age and address of each member, and show the results in the order of purchase time.
###assistant: SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase |
###context:CREATE TABLE member (Membership_card VARCHAR)
###human: Which membership card has more than 5 members?
###assistant: SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5 |
###context:CREATE TABLE member (address VARCHAR, age INTEGER)
###human: Which address has both members younger than 30 and members older than 40?
###assistant: SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40 |
###context:CREATE TABLE member (membership_card VARCHAR, address VARCHAR)
###human: What is the membership card held by both members living in Hartford and ones living in Waterbury address?
###assistant: SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury' |
###context:CREATE TABLE member (address VARCHAR)
###human: How many members are not living in Hartford?
###assistant: SELECT COUNT(*) FROM member WHERE address <> 'Hartford' |
###context:CREATE TABLE member (address VARCHAR, Membership_card VARCHAR)
###human: Which address do not have any member with the black membership card?
###assistant: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black' |
###context:CREATE TABLE shop (address VARCHAR, open_year VARCHAR)
###human: Show the shop addresses ordered by their opening year.
###assistant: SELECT address FROM shop ORDER BY open_year |
###context:CREATE TABLE shop (num_of_staff INTEGER, score INTEGER)
###human: What are the average score and average staff number of all shops?
###assistant: SELECT AVG(num_of_staff), AVG(score) FROM shop |
###context:CREATE TABLE shop (shop_id VARCHAR, address VARCHAR, score INTEGER)
###human: Find the id and address of the shops whose score is below the average score.
###assistant: SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop) |
###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)
###human: Find the address and staff number of the shops that do not have any happy hour.
###assistant: SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour) |
###context:CREATE TABLE shop (address VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (shop_id VARCHAR)
###human: What are the id and address of the shops which have a happy hour in May?
###assistant: 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' |
###context:CREATE TABLE happy_hour (shop_id VARCHAR)
###human: which shop has happy hour most frequently? List its id and number of happy hours.
###assistant: SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE happy_hour (MONTH VARCHAR)
###human: Which month has the most happy hours?
###assistant: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE happy_hour (MONTH VARCHAR)
###human: Which months have more than 2 happy hours?
###assistant: SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2 |
###context:CREATE TABLE ALBUM (Id VARCHAR)
###human: How many albums are there?
###assistant: SELECT COUNT(*) FROM ALBUM |
###context:CREATE TABLE GENRE (Name VARCHAR)
###human: List the names of all music genres.
###assistant: SELECT Name FROM GENRE |
###context:CREATE TABLE CUSTOMER (State VARCHAR)
###human: Find all the customer information in state NY.
###assistant: SELECT * FROM CUSTOMER WHERE State = "NY" |
###context:CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, City VARCHAR)
###human: What are the first names and last names of the employees who live in Calgary city.
###assistant: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "Calgary" |
###context:CREATE TABLE INVOICE (BillingCountry VARCHAR)
###human: What are the distinct billing countries of the invoices?
###assistant: SELECT DISTINCT (BillingCountry) FROM INVOICE |
###context:CREATE TABLE ARTIST (Name VARCHAR)
###human: Find the names of all artists that have "a" in their names.
###assistant: SELECT Name FROM ARTIST WHERE Name LIKE "%a%" |
###context:CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
###human: Find the title of all the albums of the artist "AC/DC".
###assistant: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC" |
###context:CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
###human: Hom many albums does the artist "Metallica" have?
###assistant: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica" |
###context:CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
###human: Which artist does the album "Balls to the Wall" belong to?
###assistant: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall" |
###context:CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
###human: Which artist has the most albums?
###assistant: 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 |
###context:CREATE TABLE TRACK (Name VARCHAR)
###human: Find the names of all the tracks that contain the word "you".
###assistant: SELECT Name FROM TRACK WHERE Name LIKE '%you%' |
###context:CREATE TABLE TRACK (UnitPrice INTEGER)
###human: What is the average unit price of all the tracks?
###assistant: SELECT AVG(UnitPrice) FROM TRACK |
###context:CREATE TABLE TRACK (Milliseconds INTEGER)
###human: What are the durations of the longest and the shortest tracks in milliseconds?
###assistant: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK |
###context:CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR)
###human: Show the album names, ids and the number of tracks for each album.
###assistant: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID |
###context:CREATE TABLE GENRE (Name VARCHAR, GenreId VARCHAR); CREATE TABLE TRACK (GenreId VARCHAR)
###human: What is the name of the most common genre in all tracks?
###assistant: 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 |
###context:CREATE TABLE MEDIATYPE (Name VARCHAR, MediaTypeId VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)
###human: What is the least common media type in all tracks?
###assistant: 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 |
###context:CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR, UnitPrice INTEGER)
###human: Show the album names and ids for albums that contain tracks with unit price bigger than 1.
###assistant: 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 |
###context:CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
###human: How many tracks belong to rock genre?
###assistant: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" |
###context:CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
###human: What is the average unit price of tracks that belong to Jazz genre?
###assistant: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz" |
###context:CREATE TABLE CUSTOMER (FirstName VARCHAR, LastName VARCHAR, Email VARCHAR)
###human: What is the first name and last name of the customer that has email "[email protected]"?
###assistant: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "[email protected]" |
###context:CREATE TABLE CUSTOMER (Email VARCHAR)
###human: How many customers have email that contains "gmail.com"?
###assistant: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%" |
###context:CREATE TABLE CUSTOMER (SupportRepId VARCHAR, FirstName VARCHAR); CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, EmployeeId VARCHAR)
###human: What is the first name and last name employee helps the customer with first name Leonie?
###assistant: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie" |
###context:CREATE TABLE EMPLOYEE (City VARCHAR, EmployeeId VARCHAR); CREATE TABLE CUSTOMER (SupportRepId VARCHAR, PostalCode VARCHAR)
###human: What city does the employee who helps the customer with postal code 70174 live in?
###assistant: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174" |
###context:CREATE TABLE EMPLOYEE (city VARCHAR)
###human: How many distinct cities does the employees live in?
###assistant: SELECT COUNT(DISTINCT city) FROM EMPLOYEE |
###context:CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR); CREATE TABLE INVOICE (InvoiceDate VARCHAR, CustomerId VARCHAR)
###human: Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.
###assistant: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" |
###context:CREATE TABLE CUSTOMER (LastName VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, CustomerId VARCHAR); CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER)
###human: Find all the customer last names that do not have invoice totals larger than 20.
###assistant: 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 |
###context:CREATE TABLE CUSTOMER (FirstName VARCHAR, CustomerId VARCHAR, country VARCHAR); CREATE TABLE INVOICE (CustomerId VARCHAR)
###human: Find the first names of all customers that live in Brazil and have an invoice.
###assistant: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil" |
###context:CREATE TABLE INVOICE (CustomerId VARCHAR); CREATE TABLE CUSTOMER (Address VARCHAR, CustomerId VARCHAR, country VARCHAR)
###human: Find the address of all customers that live in Germany and have invoice.
###assistant: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany" |
###context:CREATE TABLE EMPLOYEE (Phone VARCHAR)
###human: List the phone numbers of all employees.
###assistant: SELECT Phone FROM EMPLOYEE |
###context:CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)
###human: How many tracks are in the AAC audio file media type?
###assistant: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file" |
###context:CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
###human: What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?
###assistant: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop" |
###context:CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR); CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
###human: Please show the employee first names and ids of employees who serve at least 10 customers.
###assistant: 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 |
###context:CREATE TABLE EMPLOYEE (EmployeeId VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, SupportRepId VARCHAR)
###human: Please show the employee last names that serves no more than 20 customers.
###assistant: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20 |
###context:CREATE TABLE ALBUM (Title VARCHAR)
###human: Please list all album titles in alphabetical order.
###assistant: SELECT Title FROM ALBUM ORDER BY Title |
###context:CREATE TABLE ARTIST (Name VARCHAR, ArtistID VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
###human: Please list the name and id of all artists that have at least 3 albums in alphabetical order.
###assistant: 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 |
###context:CREATE TABLE ARTIST (Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
###human: Find the names of artists that do not have any albums.
###assistant: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId |
###context:CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR)
###human: What is the average unit price of rock tracks?
###assistant: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" |
###context:CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
###human: What are the duration of the longest and shortest pop tracks in milliseconds?
###assistant: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop" |
###context:CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR)
###human: What are the birth dates of employees living in Edmonton?
###assistant: SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton" |
###context:CREATE TABLE TRACK (UnitPrice VARCHAR)
###human: What are the distinct unit prices of all tracks?
###assistant: SELECT DISTINCT (UnitPrice) FROM TRACK |
###context:CREATE TABLE ARTIST (artistid VARCHAR); CREATE TABLE ALBUM (artistid VARCHAR)
###human: How many artists do not have any album?
###assistant: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM) |
###context:CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR); CREATE TABLE Track (AlbumId VARCHAR, GenreID VARCHAR); CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR)
###human: What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?
###assistant: 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' |
###context:CREATE TABLE available_policies (customer_phone VARCHAR)
###human: Find all the phone numbers.
###assistant: SELECT customer_phone FROM available_policies |
###context:CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR)
###human: What are the customer phone numbers under the policy "Life Insurance"?
###assistant: SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance" |
###context:CREATE TABLE available_policies (policy_type_code VARCHAR)
###human: Which policy type has the most records in the database?
###assistant: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR)
###human: What are all the customer phone numbers under the most popular policy type?
###assistant: 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) |
###context:CREATE TABLE available_policies (policy_type_code VARCHAR)
###human: Find the policy type used by more than 4 customers.
###assistant: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4 |
###context:CREATE TABLE settlements (settlement_amount INTEGER)
###human: Find the total and average amount of settlements.
###assistant: SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements |