cnatale/presto-athena-txt-2-sql huggingface dataset:
Show the customer id and number of accounts with most accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
What is the customer id of the customer with the most accounts, and how many accounts does this person have?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
What is the customer first, last name and id with least number of accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Give the full name and customer id of the customer with the fewest accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Show the number of all customers without an account.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)
How many customers do not have an account?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)
Show the first names and last names of customers without any account.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
What are the full names of customers who do not have any accounts?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
Show distinct first and last names for all customers with an account.
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
What are the full names of customers who have accounts?
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
How many customers have an account?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT customer_id) FROM Accounts
Count the number of customers who hold an account.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT customer_id) FROM Accounts
How many customers do we have?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers
Count the number of customers.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers
Show ids, first names, last names, and phones for all customers.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers
What are the ids, full names, and phones of each customer?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers
What is the phone and email for customer with first name Aniyah and last name Feest?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest'
Return the phone and email of the customer with the first name Aniyah and last name Feest.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest'
Show the number of customer cards.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards
How many customer cards are there?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards
Show ids, customer ids, card type codes, card numbers for all cards.
Additional table information: table: customers_card_transactions
SQL: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards
What are card ids, customer ids, card types, and card numbers for each customer card?
Additional table information: table: customers_card_transactions
SQL: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards
Show the date valid from and the date valid to for the card with card number '4560596484842'.
Additional table information: table: customers_card_transactions
SQL: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = '4560596484842'
What are the valid from and valid to dates for the card with the number 4560596484842?
Additional table information: table: customers_card_transactions
SQL: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = '4560596484842'
What is the first name, last name, and phone of the customer with card 4560596484842.
Additional table information: table: customers_card_transactions
SQL: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'
Return the full name and phone of the customer who has card number 4560596484842.
Additional table information: table: customers_card_transactions
SQL: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'
How many cards does customer Art Turcotte have?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'
Count the number of cards the customer with the first name Art and last name Turcotte has.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'
How many debit cards do we have?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'
Count the number of customer cards of the type Debit.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'
How many credit cards does customer Blanche Huels have?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'
Show all customer ids and the number of cards owned by each customer.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id
What are the different customer ids, and how many cards does each one hold?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id
What is the customer id with most number of cards, and how many does he have?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
Return the id of the customer who has the most cards, as well as the number of cards.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
Show id, first and last names for all customers with at least two cards.
Additional table information: table: customers_card_transactions
SQL: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2
What are the ids and full names of customers who hold two or more cards?
Additional table information: table: customers_card_transactions
SQL: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2
What is the customer id, first and last name with least number of accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Return the id and full name of the customer who has the fewest accounts.
Additional table information: table: customers_card_transactions
SQL: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Show all card type codes and the number of cards in each type.
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code
What are the different card types, and how many cards are there of each?
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code
What is the card type code with most number of cards?
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1
Return the code of the card type that is most common.
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show card type codes with at least 5 cards.
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5
What are the codes of card types that have 5 or more cards?
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5
Show all card type codes and the number of customers holding cards in each type.
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
What are the different card type codes, and how many different customers hold each type?
Additional table information: table: customers_card_transactions
SQL: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
Show the customer ids and firstname without a credit card.
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'
What are the ids and first names of customers who do not hold a credit card?
Additional table information: table: customers_card_transactions
SQL: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'
Show all card type codes.
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT card_type_code FROM Customers_Cards
What are the different card type codes?
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT card_type_code FROM Customers_Cards
Show the number of card types.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards
How many different card types are there?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards
Show all transaction types.
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT transaction_type FROM Financial_Transactions
What are the different types of transactions?
Additional table information: table: customers_card_transactions
SQL: SELECT DISTINCT transaction_type FROM Financial_Transactions
Show the number of transaction types.
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions
How many different types of transactions are there?
Additional table information: table: customers_card_transactions
SQL: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions
What is the average and total transaction amount?
Additional table information: table: customers_card_transactions
SQL: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
Return the average transaction amount, as well as the total amount of all transactions.
Additional table information: table: customers_card_transactions
SQL: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
Show the card type codes and the number of transactions.
Additional table information: table: customers_card_transactions
SQL: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code
What are the different card types, and how many transactions have been made with each?
Additional table information: table: customers_card_transactions
SQL: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code
Show the transaction type and the number of transactions.
Additional table information: table: customers_card_transactions
SQL: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type
What are the different transaction types, and how many transactions of each have taken place?
Additional table information: table: customers_card_transactions
SQL: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type
What is the transaction type that has processed the greatest total amount in transactions?
Additional table information: table: customers_card_transactions
SQL: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1
Return the type of transaction with the highest total amount.
Additional table information: table: customers_card_transactions
SQL: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1
Show the account id and the number of transactions for each account
Additional table information: table: customers_card_transactions
SQL: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id
What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?
Additional table information: table: customers_card_transactions
SQL: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id
How many tracks do we have?
Additional table information: table: race_track
SQL: SELECT COUNT(*) FROM track
Count the number of tracks.
Additional table information: table: race_track
SQL: SELECT COUNT(*) FROM track
Show the name and location for all tracks.
Additional table information: table: race_track
SQL: SELECT name, LOCATION FROM track
What are the names and locations of all tracks?
Additional table information: table: race_track
SQL: SELECT name, LOCATION FROM track
Show names and seatings, ordered by seating for all tracks opened after 2000.
Additional table information: table: race_track
SQL: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating NULLS FIRST
What are the names and seatings for all tracks opened after 2000, ordered by seating?
Additional table information: table: race_track
SQL: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating NULLS FIRST
What is the name, location and seating for the most recently opened track?
Additional table information: table: race_track
SQL: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1
Return the name, location, and seating of the track that was opened in the most recent year.
Additional table information: table: race_track
SQL: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1
What is the minimum, maximum, and average seating for all tracks.
Additional table information: table: race_track
SQL: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track
Return the minimum, maximum, and average seating across all tracks.
Additional table information: table: race_track
SQL: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track
Show the name, location, open year for all tracks with a seating higher than the average.
Additional table information: table: race_track
SQL: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)
What are the names, locations, and years of opening for tracks with seating higher than average?
Additional table information: table: race_track
SQL: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)
What are distinct locations where tracks are located?
Additional table information: table: race_track
SQL: SELECT DISTINCT LOCATION FROM track
Give the different locations of tracks.
Additional table information: table: race_track
SQL: SELECT DISTINCT LOCATION FROM track
How many races are there?
Additional table information: table: race_track
SQL: SELECT COUNT(*) FROM race
Count the number of races.
Additional table information: table: race_track
SQL: SELECT COUNT(*) FROM race
What are the distinct classes that races can have?
Additional table information: table: race_track
SQL: SELECT DISTINCT CLASS FROM race
Return the different classes of races.
Additional table information: table: race_track
SQL: SELECT DISTINCT CLASS FROM race
Show name, class, and date for all races.
Additional table information: table: race_track
SQL: SELECT name, CLASS, date FROM race
What are the names, classes, and dates for all races?
Additional table information: table: race_track
SQL: SELECT name, CLASS, date FROM race
Show the race class and number of races in each class.
Additional table information: table: race_track
SQL: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS
What are the different classes of races, and how many races correspond to each?
Additional table information: table: race_track
SQL: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS
What is the race class with most number of races.
Additional table information: table: race_track
SQL: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1
Give the class of races that is most common.
Additional table information: table: race_track
SQL: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1
List the race class with at least two races.
Additional table information: table: race_track
SQL: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2
What are the classes of races that have two or more corresponding races?
Additional table information: table: race_track
SQL: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2
What are the names for tracks without a race in class 'GT'.
Additional table information: table: race_track
SQL: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'
Give the names of tracks that do not have a race in the class 'GT'.
Additional table information: table: race_track
SQL: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'
Show all track names that have had no races.
Additional table information: table: race_track
SQL: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)
Return the names of tracks that have no had any races.
Additional table information: table: race_track
SQL: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)
Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
Additional table information: table: race_track
SQL: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
What are the years of opening for tracks with seating between 4000 and 5000?
Additional table information: table: race_track
SQL: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
Show the name of track and the number of races in each track.
Additional table information: table: race_track
SQL: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
What are the names of different tracks, and how many races has each had?
Additional table information: table: race_track
SQL: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
Show the name of track with most number of races.
Additional table information: table: race_track
SQL: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1
What is the name of the track that has had the greatest number of races?
Additional table information: table: race_track
SQL: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1
Show the name and date for each race and its track name.
Additional table information: table: race_track
SQL: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
What are the names and dates of races, and the names of the tracks where they are held?
Additional table information: table: race_track
SQL: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
Show the name and location of track with 1 race.
Additional table information: table: race_track
SQL: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1
What are the names and locations of tracks that have had exactly 1 race?
Additional table information: table: race_track
SQL: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1
Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
Additional table information: table: race_track
SQL: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?
Additional table information: table: race_track
SQL: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
How many members have the black membership card?
Additional table information: table: coffee_shop
SQL: SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'
Find the number of members living in each address.
Additional table information: table: coffee_shop
SQL: SELECT COUNT(*), address FROM member GROUP BY address
Give me the names of members whose address is in Harford or Waterbury.
Additional table information: table: coffee_shop
SQL: SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'
Find the ids and names of members who are under age 30 or with black membership card.
Additional table information: table: coffee_shop
SQL: SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30
Find the purchase time, age and address of each member, and show the results in the order of purchase time.
Additional table information: table: coffee_shop
SQL: SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase NULLS FIRST
Which membership card has more than 5 members?
Additional table information: table: coffee_shop
SQL: SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5
Which address has both members younger than 30 and members older than 40?
Additional table information: table: coffee_shop
SQL: SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40
What is the membership card held by both members living in Hartford and ones living in Waterbury address?
Additional table information: table: coffee_shop
SQL: SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'
How many members are not living in Hartford?
Additional table information: table: coffee_shop
SQL: SELECT COUNT(*) FROM member WHERE address <> 'Hartford'
Which address do not have any member with the black membership card?
Additional table information: table: coffee_shop
SQL: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'
Show the shop addresses ordered by their opening year.
Additional table information: table: coffee_shop
SQL: SELECT address FROM shop ORDER BY open_year NULLS FIRST
What are the average score and average staff number of all shops?
Additional table information: table: coffee_shop
SQL: SELECT AVG(num_of_staff), AVG(score) FROM shop
Find the id and address of the shops whose score is below the average score.
Additional table information: table: coffee_shop
SQL: SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)
Find the address and staff number of the shops that do not have any happy hour.
Additional table information: table: coffee_shop
SQL: SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)
What are the id and address of the shops which have a happy hour in May?
Additional table information: table: coffee_shop
SQL: SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May'
which shop has happy hour most frequently? List its id and number of happy hours.
Additional table information: table: coffee_shop
SQL: SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1
Which month has the most happy hours?
Additional table information: table: coffee_shop
SQL: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1
Which months have more than 2 happy hours?
Additional table information: table: coffee_shop
SQL: SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2
How many albums are there?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ALBUM
Find the number of albums.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ALBUM
List the names of all music genres.
Additional table information: table: chinook_1
SQL: SELECT Name FROM GENRE
What are the names of different music genres?
Additional table information: table: chinook_1
SQL: SELECT Name FROM GENRE
Find all the customer information in state NY.
Additional table information: table: chinook_1
SQL: SELECT * FROM CUSTOMER WHERE State = 'NY'
What is all the customer information for customers in NY state?
Additional table information: table: chinook_1
SQL: SELECT * FROM CUSTOMER WHERE State = 'NY'
What are the first names and last names of the employees who live in Calgary city.
Additional table information: table: chinook_1
SQL: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = 'Calgary'
Find the full names of employees living in the city of Calgary.
Additional table information: table: chinook_1
SQL: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = 'Calgary'
What are the distinct billing countries of the invoices?
Additional table information: table: chinook_1
SQL: SELECT DISTINCT (BillingCountry) FROM INVOICE
Find the different billing countries for all invoices.
Additional table information: table: chinook_1
SQL: SELECT DISTINCT (BillingCountry) FROM INVOICE
Find the names of all artists that have 'a' in their names.
Additional table information: table: chinook_1
SQL: SELECT Name FROM ARTIST WHERE Name LIKE '%a%'
What are the names of artist who have the letter 'a' in their names?
Additional table information: table: chinook_1
SQL: SELECT Name FROM ARTIST WHERE Name LIKE '%a%'
Find the title of all the albums of the artist 'AC/DC'.
Additional table information: table: chinook_1
SQL: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'
What are the titles of albums by the artist 'AC/DC'?
Additional table information: table: chinook_1
SQL: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'
Hom many albums does the artist 'Metallica' have?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'
Find the number of albums by the artist 'Metallica'.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'
Which artist does the album 'Balls to the Wall' belong to?
Additional table information: table: chinook_1
SQL: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'
Find the name of the artist who made the album 'Balls to the Wall'.
Additional table information: table: chinook_1
SQL: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'
Which artist has the most albums?
Additional table information: table: chinook_1
SQL: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1
What is the name of the artist with the greatest number of albums?
Additional table information: table: chinook_1
SQL: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1
Find the names of all the tracks that contain the word 'you'.
Additional table information: table: chinook_1
SQL: SELECT Name FROM TRACK WHERE Name LIKE '%you%'
What are the names of tracks that contain the the word you in them?
Additional table information: table: chinook_1
SQL: SELECT Name FROM TRACK WHERE Name LIKE '%you%'
What is the average unit price of all the tracks?
Additional table information: table: chinook_1
SQL: SELECT AVG(UnitPrice) FROM TRACK
Find the average unit price for a track.
Additional table information: table: chinook_1
SQL: SELECT AVG(UnitPrice) FROM TRACK
What are the durations of the longest and the shortest tracks in milliseconds?
Additional table information: table: chinook_1
SQL: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK
Find the maximum and minimum durations of tracks in milliseconds.
Additional table information: table: chinook_1
SQL: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK
Show the album names, ids and the number of tracks for each album.
Additional table information: table: chinook_1
SQL: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID
What are the names and ids of the different albums, and how many tracks are on each?
Additional table information: table: chinook_1
SQL: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID
What is the name of the most common genre in all tracks?
Additional table information: table: chinook_1
SQL: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1
Find the name of the genre that is most frequent across all tracks.
Additional table information: table: chinook_1
SQL: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1
What is the least common media type in all tracks?
Additional table information: table: chinook_1
SQL: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the name of the media type that is least common across all tracks?
Additional table information: table: chinook_1
SQL: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Show the album names and ids for albums that contain tracks with unit price bigger than 1.
Additional table information: table: chinook_1
SQL: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
What are the titles and ids for albums containing tracks with unit price greater than 1?
Additional table information: table: chinook_1
SQL: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
How many tracks belong to rock genre?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'
Count the number of tracks that are part of the rock genre.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'
What is the average unit price of tracks that belong to Jazz genre?
Additional table information: table: chinook_1
SQL: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Jazz'
Find the average unit price of jazz tracks.
Additional table information: table: chinook_1
SQL: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Jazz'
What is the first name and last name of the customer that has email 'luisg@embraer.com.br'?
Additional table information: table: chinook_1
SQL: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = 'luisg@embraer.com.br'
Find the full name of the customer with the email 'luisg@embraer.com.br'.
Additional table information: table: chinook_1
SQL: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = 'luisg@embraer.com.br'
How many customers have email that contains 'gmail.com'?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE '%gmail.com%'
Count the number of customers that have an email containing 'gmail.com'.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE '%gmail.com%'
What is the first name and last name employee helps the customer with first name Leonie?
Additional table information: table: chinook_1
SQL: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'
Find the full names of employees who help customers with the first name Leonie.
Additional table information: table: chinook_1
SQL: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'
What city does the employee who helps the customer with postal code 70174 live in?
Additional table information: table: chinook_1
SQL: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'
Find the cities corresponding to employees who help customers with the postal code 70174.
Additional table information: table: chinook_1
SQL: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'
How many distinct cities does the employees live in?
Additional table information: table: chinook_1
SQL: SELECT COUNT(DISTINCT city) FROM EMPLOYEE
Find the number of different cities that employees live in.
Additional table information: table: chinook_1
SQL: SELECT COUNT(DISTINCT city) FROM EMPLOYEE
Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.
Additional table information: table: chinook_1
SQL: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'
What are the invoice dates for customers with the first name Astrid and the last name Gruber?
Additional table information: table: chinook_1
SQL: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'
Find all the customer last names that do not have invoice totals larger than 20.
Additional table information: table: chinook_1
SQL: SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20
What are the last names of customers without invoice totals exceeding 20?
Additional table information: table: chinook_1
SQL: SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20
Find the first names of all customers that live in Brazil and have an invoice.
Additional table information: table: chinook_1
SQL: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Brazil'
What are the different first names for customers from Brazil who have also had an invoice?
Additional table information: table: chinook_1
SQL: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Brazil'
Find the address of all customers that live in Germany and have invoice.
Additional table information: table: chinook_1
SQL: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Germany'
What are the addresses of customers living in Germany who have had an invoice?
Additional table information: table: chinook_1
SQL: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Germany'
List the phone numbers of all employees.
Additional table information: table: chinook_1
SQL: SELECT Phone FROM EMPLOYEE
What are the phone numbers for each employee?
Additional table information: table: chinook_1
SQL: SELECT Phone FROM EMPLOYEE
How many tracks are in the AAC audio file media type?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = 'AAC audio file'
Count the number of tracks that are of the media type 'AAC audio file'.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = 'AAC audio file'
What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?
Additional table information: table: chinook_1
SQL: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Latin' OR T1.Name = 'Pop'
Find the average millisecond length of Latin and Pop tracks.
Additional table information: table: chinook_1
SQL: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Latin' OR T1.Name = 'Pop'
Please show the employee first names and ids of employees who serve at least 10 customers.
Additional table information: table: chinook_1
SQL: SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10
What are the first names and support rep ids for employees serving 10 or more customers?
Additional table information: table: chinook_1
SQL: SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10
Please show the employee last names that serves no more than 20 customers.
Additional table information: table: chinook_1
SQL: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
What are the last names of employees who serve at most 20 customers?
Additional table information: table: chinook_1
SQL: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
Please list all album titles in alphabetical order.
Additional table information: table: chinook_1
SQL: SELECT Title FROM ALBUM ORDER BY Title NULLS FIRST
What are all the album titles, in alphabetical order?
Additional table information: table: chinook_1
SQL: SELECT Title FROM ALBUM ORDER BY Title NULLS FIRST
Please list the name and id of all artists that have at least 3 albums in alphabetical order.
Additional table information: table: chinook_1
SQL: SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name NULLS FIRST
What are the names and ids of artists with 3 or more albums, listed in alphabetical order?
Additional table information: table: chinook_1
SQL: SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name NULLS FIRST
Find the names of artists that do not have any albums.
Additional table information: table: chinook_1
SQL: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId
What are the names of artists who have not released any albums?
Additional table information: table: chinook_1
SQL: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId
What is the average unit price of rock tracks?
Additional table information: table: chinook_1
SQL: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'
Find the average unit price of tracks from the Rock genre.
Additional table information: table: chinook_1
SQL: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'
What are the duration of the longest and shortest pop tracks in milliseconds?
Additional table information: table: chinook_1
SQL: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'
Find the maximum and minimum millisecond lengths of pop tracks.
Additional table information: table: chinook_1
SQL: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'
What are the birth dates of employees living in Edmonton?
Additional table information: table: chinook_1
SQL: SELECT BirthDate FROM EMPLOYEE WHERE City = 'Edmonton'
Find the birth dates corresponding to employees who live in the city of Edmonton.
Additional table information: table: chinook_1
SQL: SELECT BirthDate FROM EMPLOYEE WHERE City = 'Edmonton'
What are the distinct unit prices of all tracks?
Additional table information: table: chinook_1
SQL: SELECT DISTINCT (UnitPrice) FROM TRACK
Find the distinct unit prices for tracks.
Additional table information: table: chinook_1
SQL: SELECT DISTINCT (UnitPrice) FROM TRACK
How many artists do not have any album?
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
Cound the number of artists who have not released an album.
Additional table information: table: chinook_1
SQL: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?
Additional table information: table: chinook_1
SQL: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'
Find the titles of albums that contain tracks of both the Reggae and Rock genres.
Additional table information: table: chinook_1
SQL: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'
Find all the phone numbers.
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies
What are all the phone numbers?
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies
What are the customer phone numbers under the policy 'Life Insurance'?
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code = 'Life Insurance'
What are the phone numbers of customers using the policy with the code 'Life Insurance'?
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code = 'Life Insurance'
Which policy type has the most records in the database?
Additional table information: table: insurance_fnol
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
Which policy type appears most frequently in the available policies?
Additional table information: table: insurance_fnol
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
What are all the customer phone numbers under the most popular policy type?
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
Find the phone numbers of customers using the most common policy type among the available policies.
Additional table information: table: insurance_fnol
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
Find the policy type used by more than 4 customers.
Additional table information: table: insurance_fnol
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4
Find the policy types more than 4 customers use. Show their type code.
Additional table information: table: insurance_fnol
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4
Find the total and average amount of settlements.
Additional table information: table: insurance_fnol
SQL: SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements