cnatale/presto-athena-txt-2-sql huggingface dataset:
Show all the locations with at least two cinemas with capacity above 300.
Additional table information: table: cinema
SQL: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2
Which locations have 2 or more cinemas with capacity over 300?
Additional table information: table: cinema
SQL: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2
Show the title and director for all films.
Additional table information: table: cinema
SQL: SELECT title, directed_by FROM film
What are the title and director of each film?
Additional table information: table: cinema
SQL: SELECT title, directed_by FROM film
Show all directors.
Additional table information: table: cinema
SQL: SELECT DISTINCT directed_by FROM film
Who are all the directors?
Additional table information: table: cinema
SQL: SELECT DISTINCT directed_by FROM film
List all directors along with the number of films directed by each director.
Additional table information: table: cinema
SQL: SELECT directed_by, COUNT(*) FROM film GROUP BY directed_by
What is total number of show times per dat for each cinema?
Additional table information: table: cinema
SQL: SELECT T2.name, SUM(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id
What are the title and maximum price of each film?
Additional table information: table: cinema
SQL: SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
Give me the title and highest price for each film.
Additional table information: table: cinema
SQL: SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
Show cinema name, film title, date, and price for each record in schedule.
Additional table information: table: cinema
SQL: SELECT T3.name, T2.title, T1.date, T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id
What are the title and director of the films without any schedule?
Additional table information: table: cinema
SQL: SELECT title, directed_by FROM film WHERE NOT film_id IN (SELECT film_id FROM schedule)
Show director with the largest number of show times in total.
Additional table information: table: cinema
SQL: SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY SUM(T1.show_times_per_day) DESC LIMIT 1
Find the locations that have more than one movie theater with capacity above 300.
Additional table information: table: cinema
SQL: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) > 1
In which locations are there more than one movie theater with capacity above 300?
Additional table information: table: cinema
SQL: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) > 1
How many films have the word 'Dummy' in their titles?
Additional table information: table: cinema
SQL: SELECT COUNT(*) FROM film WHERE title LIKE '%Dummy%'
Count the number of films whose title contains the word 'Dummy'.
Additional table information: table: cinema
SQL: SELECT COUNT(*) FROM film WHERE title LIKE '%Dummy%'
Are the customers holding coupons with amount 500 bad or good?
Additional table information: table: products_for_hire
SQL: SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = 500
How many bookings did each customer make? List the customer id, first name, and the count.
Additional table information: table: products_for_hire
SQL: SELECT T1.customer_id, T1.first_name, COUNT(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
What is the maximum total amount paid by a customer? List the customer id and amount.
Additional table information: table: products_for_hire
SQL: SELECT customer_id, SUM(amount_paid) FROM Payments GROUP BY customer_id ORDER BY SUM(amount_paid) DESC LIMIT 1
What are the id and the amount of refund of the booking that incurred the most times of payments?
Additional table information: table: products_for_hire
SQL: SELECT T1.booking_id, T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T1.booking_id ORDER BY COUNT(*) DESC LIMIT 1
What is the id of the product that is booked for 3 times?
Additional table information: table: products_for_hire
SQL: SELECT product_id FROM products_booked GROUP BY product_id HAVING COUNT(*) = 3
What is the product description of the product booked with an amount of 102.76?
Additional table information: table: products_for_hire
SQL: SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76
What are the start date and end date of the booking that has booked the product named 'Book collection A'?
Additional table information: table: products_for_hire
SQL: SELECT T3.booking_start_date, T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id WHERE T1.product_name = 'Book collection A'
What are the names of products whose availability equals to 1?
Additional table information: table: products_for_hire
SQL: SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = 1
How many different product types are there?
Additional table information: table: products_for_hire
SQL: SELECT COUNT(DISTINCT product_type_code) FROM products_for_hire
What are the first name, last name, and gender of all the good customers? Order by their last name.
Additional table information: table: products_for_hire
SQL: SELECT first_name, last_name, gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name NULLS FIRST
What is the average amount due for all the payments?
Additional table information: table: products_for_hire
SQL: SELECT AVG(amount_due) FROM payments
What are the maximum, minimum, and average booked count for the products booked?
Additional table information: table: products_for_hire
SQL: SELECT MAX(booked_count), MIN(booked_count), AVG(booked_count) FROM products_booked
What are all the distinct payment types?
Additional table information: table: products_for_hire
SQL: SELECT DISTINCT payment_type_code FROM payments
What are the daily hire costs for the products with substring 'Book' in its name?
Additional table information: table: products_for_hire
SQL: SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'
How many products are never booked with amount higher than 200?
Additional table information: table: products_for_hire
SQL: SELECT COUNT(*) FROM Products_for_hire WHERE NOT product_id IN (SELECT product_id FROM products_booked WHERE booked_amount > 200)
What are the coupon amount of the coupons owned by both good and bad customers?
Additional table information: table: products_for_hire
SQL: SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check'
Additional table information: table: products_for_hire
SQL: SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'
What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20?
Additional table information: table: products_for_hire
SQL: SELECT product_name, product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND daily_hire_cost < 20
How many phones are there?
Additional table information: table: phone_market
SQL: SELECT COUNT(*) FROM phone
List the names of phones in ascending order of price.
Additional table information: table: phone_market
SQL: SELECT Name FROM phone ORDER BY Price ASC NULLS FIRST
What are the memories and carriers of phones?
Additional table information: table: phone_market
SQL: SELECT Memory_in_G, Carrier FROM phone
List the distinct carriers of phones with memories bigger than 32.
Additional table information: table: phone_market
SQL: SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32
Show the names of phones with carrier either 'Sprint' or 'TMobile'.
Additional table information: table: phone_market
SQL: SELECT Name FROM phone WHERE Carrier = 'Sprint' OR Carrier = 'TMobile'
What is the carrier of the most expensive phone?
Additional table information: table: phone_market
SQL: SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1
Show different carriers of phones together with the number of phones with each carrier.
Additional table information: table: phone_market
SQL: SELECT Carrier, COUNT(*) FROM phone GROUP BY Carrier
Show the most frequently used carrier of the phones.
Additional table information: table: phone_market
SQL: SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1
Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64.
Additional table information: table: phone_market
SQL: SELECT Carrier FROM phone WHERE Memory_in_G < 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G > 64
Show the names of phones and the districts of markets they are on.
Additional table information: table: phone_market
SQL: SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID
Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market.
Additional table information: table: phone_market
SQL: SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY T2.Ranking NULLS FIRST
Show the names of phones that are on market with number of shops greater than 50.
Additional table information: table: phone_market
SQL: SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50
For each phone, show its names and total number of stocks.
Additional table information: table: phone_market
SQL: SELECT T2.Name, SUM(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name
Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.
Additional table information: table: phone_market
SQL: SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING SUM(T1.Num_of_stock) >= 2000 ORDER BY SUM(T1.Num_of_stock) DESC
List the names of phones that are not on any market.
Additional table information: table: phone_market
SQL: SELECT Name FROM phone WHERE NOT Phone_id IN (SELECT Phone_ID FROM phone_market)
How many gas companies are there?
Additional table information: table: gas_company
SQL: SELECT COUNT(*) FROM company
What is the total number of companies?
Additional table information: table: gas_company
SQL: SELECT COUNT(*) FROM company
List the company name and rank for all companies in the decreasing order of their sales.
Additional table information: table: gas_company
SQL: SELECT company, rank FROM company ORDER BY Sales_billion DESC
What is the name and rank of every company ordered by descending number of sales?
Additional table information: table: gas_company
SQL: SELECT company, rank FROM company ORDER BY Sales_billion DESC
Show the company name and the main industry for all companies whose headquarters are not from USA.
Additional table information: table: gas_company
SQL: SELECT company, main_industry FROM company WHERE headquarters <> 'USA'
What are the companies and main industries of all companies that are not headquartered in the United States?
Additional table information: table: gas_company
SQL: SELECT company, main_industry FROM company WHERE headquarters <> 'USA'
Show all company names and headquarters in the descending order of market value.
Additional table information: table: gas_company
SQL: SELECT company, headquarters FROM company ORDER BY market_value DESC
What are the names and headquarters of all companies ordered by descending market value?
Additional table information: table: gas_company
SQL: SELECT company, headquarters FROM company ORDER BY market_value DESC
Show minimum, maximum, and average market value for all companies.
Additional table information: table: gas_company
SQL: SELECT MIN(market_value), MAX(market_value), AVG(market_value) FROM company
What is the minimum, maximum, and average market value for every company?
Additional table information: table: gas_company
SQL: SELECT MIN(market_value), MAX(market_value), AVG(market_value) FROM company
Show all main industry for all companies.
Additional table information: table: gas_company
SQL: SELECT DISTINCT main_industry FROM company
What are the different main industries for all companies?
Additional table information: table: gas_company
SQL: SELECT DISTINCT main_industry FROM company
List all headquarters and the number of companies in each headquarter.
Additional table information: table: gas_company
SQL: SELECT headquarters, COUNT(*) FROM company GROUP BY headquarters
For each headquarter, what are the headquarter and how many companies are centered there?
Additional table information: table: gas_company
SQL: SELECT headquarters, COUNT(*) FROM company GROUP BY headquarters
Show all main industry and total market value in each industry.
Additional table information: table: gas_company
SQL: SELECT main_industry, SUM(market_value) FROM company GROUP BY main_industry
What are the main indstries and total market value for each industry?
Additional table information: table: gas_company
SQL: SELECT main_industry, SUM(market_value) FROM company GROUP BY main_industry
List the main industry with highest total market value and its number of companies.
Additional table information: table: gas_company
SQL: SELECT main_industry, COUNT(*) FROM company GROUP BY main_industry ORDER BY SUM(market_value) DESC LIMIT 1
For each main industry, what is the total number of companies for the industry with the highest total market value?
Additional table information: table: gas_company
SQL: SELECT main_industry, COUNT(*) FROM company GROUP BY main_industry ORDER BY SUM(market_value) DESC LIMIT 1
Show headquarters with at least two companies in the banking industry.
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2
What are the headquarters with at least two companies in the banking industry?
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2
Show gas station id, location, and manager_name for all gas stations ordered by open year.
Additional table information: table: gas_company
SQL: SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year NULLS FIRST
What are the gas station ids, locations, and manager names for the gas stations ordered by opening year?
Additional table information: table: gas_company
SQL: SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year NULLS FIRST
How many gas station are opened between 2000 and 2005?
Additional table information: table: gas_company
SQL: SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
What is the total number of gas stations that opened between 2000 and 2005?
Additional table information: table: gas_company
SQL: SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
Show all locations and the number of gas stations in each location ordered by the count.
Additional table information: table: gas_company
SQL: SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) NULLS FIRST
For each location, how many gas stations are there in order?
Additional table information: table: gas_company
SQL: SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) NULLS FIRST
Show all headquarters with both a company in banking industry and a company in Oil and gas.
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
What are the headquarters that have both a company in the banking and 'oil and gas' industries?
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'
Show all headquarters without a company in banking industry.
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
What are the headquarters without companies that are in the banking industry?
Additional table information: table: gas_company
SQL: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'
Show the company name with the number of gas station.
Additional table information: table: gas_company
SQL: SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id
For each company id, what are the companies and how many gas stations does each one operate?
Additional table information: table: gas_company
SQL: SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id
Show company name and main industry without a gas station.
Additional table information: table: gas_company
SQL: SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company)
What are the main industries of the companies without gas stations and what are the companies?
Additional table information: table: gas_company
SQL: SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company)
Show the manager name for gas stations belonging to the ExxonMobil company.
Additional table information: table: gas_company
SQL: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'
What are the names of the managers for gas stations that are operated by the ExxonMobil company?
Additional table information: table: gas_company
SQL: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'
Show all locations where a gas station for company with market value greater than 100 is located.
Additional table information: table: gas_company
SQL: SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100
What are the locations that have gas stations owned by a company with a market value greater than 100?
Additional table information: table: gas_company
SQL: SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100
Show the manager name with most number of gas stations opened after 2000.
Additional table information: table: gas_company
SQL: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1
What is the name of the manager with the most gas stations that opened after 2000?
Additional table information: table: gas_company
SQL: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1
order all gas station locations by the opening year.
Additional table information: table: gas_company
SQL: SELECT LOCATION FROM gas_station ORDER BY open_year NULLS FIRST
What are the locations of all the gas stations ordered by opening year?
Additional table information: table: gas_company
SQL: SELECT LOCATION FROM gas_station ORDER BY open_year NULLS FIRST
find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion.
Additional table information: table: gas_company
SQL: SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion NULLS FIRST, profits_billion NULLS FIRST
What is the rank, company, and market value of every comapny in the banking industry ordered by sales and profits?
Additional table information: table: gas_company
SQL: SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion NULLS FIRST, profits_billion NULLS FIRST
find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.
Additional table information: table: gas_company
SQL: SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3
What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets?
Additional table information: table: gas_company
SQL: SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3
How many regions do we have?
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM region
Count the number of regions.
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM region
Show all distinct region names ordered by their labels.
Additional table information: table: party_people
SQL: SELECT DISTINCT region_name FROM region ORDER BY Label NULLS FIRST
What are the different region names, ordered by labels?
Additional table information: table: party_people
SQL: SELECT DISTINCT region_name FROM region ORDER BY Label NULLS FIRST
How many parties do we have?
Additional table information: table: party_people
SQL: SELECT COUNT(DISTINCT party_name) FROM party
Count the number of different parties.
Additional table information: table: party_people
SQL: SELECT COUNT(DISTINCT party_name) FROM party
Show the ministers and the time they took and left office, listed by the time they left office.
Additional table information: table: party_people
SQL: SELECT minister, took_office, left_office FROM party ORDER BY left_office NULLS FIRST
Who are the ministers, when did they take office, and when did they leave office, ordered by when they left office?
Additional table information: table: party_people
SQL: SELECT minister, took_office, left_office FROM party ORDER BY left_office NULLS FIRST
Show the minister who took office after 1961 or before 1959.
Additional table information: table: party_people
SQL: SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
Who are the ministers who took office after 1961 or before 1959?
Additional table information: table: party_people
SQL: SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
Show all ministers who do not belong to Progress Party.
Additional table information: table: party_people
SQL: SELECT minister FROM party WHERE party_name <> 'Progress Party'
Which ministers are not a part of the Progress Party?
Additional table information: table: party_people
SQL: SELECT minister FROM party WHERE party_name <> 'Progress Party'
Show all ministers and parties they belong to in descending order of the time they took office.
Additional table information: table: party_people
SQL: SELECT minister, party_name FROM party ORDER BY took_office DESC
Who are the ministers and what parties do they belong to, listed descending by the times they took office?
Additional table information: table: party_people
SQL: SELECT minister, party_name FROM party ORDER BY took_office DESC
Return the minister who left office at the latest time.
Additional table information: table: party_people
SQL: SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
Which minister left office the latest?
Additional table information: table: party_people
SQL: SELECT minister FROM party ORDER BY left_office DESC LIMIT 1
List member names and their party names.
Additional table information: table: party_people
SQL: SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
What are the names of members and their corresponding parties?
Additional table information: table: party_people
SQL: SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id
Show all party names and the number of members in each party.
Additional table information: table: party_people
SQL: SELECT T2.party_name, COUNT(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
How many members are in each party?
Additional table information: table: party_people
SQL: SELECT T2.party_name, COUNT(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
What is the name of party with most number of members?
Additional table information: table: party_people
SQL: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1
Return the name of the party with the most members.
Additional table information: table: party_people
SQL: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1
Show all party names and their region names.
Additional table information: table: party_people
SQL: SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
What are the names of parties and their respective regions?
Additional table information: table: party_people
SQL: SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id
Show names of parties that does not have any members.
Additional table information: table: party_people
SQL: SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member)
What are the names of parties that have no members?
Additional table information: table: party_people
SQL: SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member)
Show the member names which are in both the party with id 3 and the party with id 1.
Additional table information: table: party_people
SQL: SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
Which member names are shared among members in the party with the id 3 and the party with the id 1?
Additional table information: table: party_people
SQL: SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1
Show member names that are not in the Progress Party.
Additional table information: table: party_people
SQL: SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> 'Progress Party'
Which member names corresponding to members who are not in the Progress Party?
Additional table information: table: party_people
SQL: SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> 'Progress Party'
How many party events do we have?
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM party_events
Count the number of party events.
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM party_events
Show party names and the number of events for each party.
Additional table information: table: party_people
SQL: SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
How many events are there for each party?
Additional table information: table: party_people
SQL: SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
Show all member names who are not in charge of any event.
Additional table information: table: party_people
SQL: SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id
What are the names of members who are not in charge of any events?
Additional table information: table: party_people
SQL: SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id
What are the names of parties with at least 2 events?
Additional table information: table: party_people
SQL: SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2
Return the names of parties that have two or more events.
Additional table information: table: party_people
SQL: SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2
What is the name of member in charge of greatest number of events?
Additional table information: table: party_people
SQL: SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1
Return the name of the member who is in charge of the most events.
Additional table information: table: party_people
SQL: SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1
find the event names that have more than 2 records.
Additional table information: table: party_people
SQL: SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2
Which event names were used more than twice for party events?
Additional table information: table: party_people
SQL: SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2
How many Annual Meeting events happened in the United Kingdom region?
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = 'United Kingdom' AND t3.Event_Name = 'Annaual Meeting'
Count the number of Annual Meeting events that took place in the region of the United Kingdom.
Additional table information: table: party_people
SQL: SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = 'United Kingdom' AND t3.Event_Name = 'Annaual Meeting'
How many pilots are there?
Additional table information: table: pilot_record
SQL: SELECT COUNT(*) FROM pilot
List the names of pilots in ascending order of rank.
Additional table information: table: pilot_record
SQL: SELECT Pilot_name FROM pilot ORDER BY Rank ASC NULLS FIRST
What are the positions and teams of pilots?
Additional table information: table: pilot_record
SQL: SELECT POSITION, Team FROM pilot
List the distinct positions of pilots older than 30.
Additional table information: table: pilot_record
SQL: SELECT DISTINCT POSITION FROM pilot WHERE Age > 30
Show the names of pilots from team 'Bradley' or 'Fordham'.
Additional table information: table: pilot_record
SQL: SELECT Pilot_name FROM pilot WHERE Team = 'Bradley' OR Team = 'Fordham'
What is the joined year of the pilot of the highest rank?
Additional table information: table: pilot_record
SQL: SELECT Join_Year FROM pilot ORDER BY Rank ASC NULLS FIRST LIMIT 1
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.
Additional table information: table: pilot_record
SQL: SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality
Show the most common nationality of pilots.
Additional table information: table: pilot_record
SQL: SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.
Additional table information: table: pilot_record
SQL: SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005
Show the names of pilots and models of aircrafts they have flied with.
Additional table information: table: pilot_record
SQL: SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
Additional table information: table: pilot_record
SQL: SELECT T3.Pilot_name, T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank NULLS FIRST
Show the fleet series of the aircrafts flied by pilots younger than 34
Additional table information: table: pilot_record
SQL: SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34
Show the names of pilots and the number of records they have.
Additional table information: table: pilot_record
SQL: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name
Show names of pilots that have more than one record.
Additional table information: table: pilot_record
SQL: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1
List the names of pilots that do not have any record.
Additional table information: table: pilot_record
SQL: SELECT Pilot_name FROM pilot WHERE NOT Pilot_ID IN (SELECT Pilot_ID FROM pilot_record)
What document status codes do we have?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_status_code FROM Ref_Document_Status
What is the description of document status code 'working'?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = 'working'
What document type codes do we have?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_type_code FROM Ref_Document_Types
What is the description of document type 'Paper'?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = 'Paper'
What are the shipping agent names?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT shipping_agent_name FROM Ref_Shipping_Agents
What is the shipping agent code of shipping agent UPS?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = 'UPS'
What are all role codes?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT role_code FROM ROLES
What is the description of role code ED?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT role_description FROM ROLES WHERE role_code = 'ED'
How many employees do we have?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT COUNT(*) FROM Employees
What is the role of the employee named Koby?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = 'Koby'
List all document ids and receipt dates of documents.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id, receipt_date FROM Documents
How many employees does each role have? List role description, id and number of employees.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT T1.role_description, T2.role_code, COUNT(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code
List roles that have more than one employee. List the role description and number of employees.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Roles.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1
What is the document status description of the document with id 1?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1
How many documents have the status code done?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT COUNT(*) FROM Documents WHERE document_status_code = 'done'
List the document type code for the document with the id 2.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_type_code FROM Documents WHERE document_id = 2
List the document ids for any documents with the status code done and the type code paper.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper'
What is the name of the shipping agent of the document with id 2?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2
How many documents were shipped by USPS?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT COUNT(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'
Which shipping agent shipped the most documents? List the shipping agent name and the number of documents.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Ref_Shipping_Agents.shipping_agent_name, COUNT(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY COUNT(Documents.document_id) DESC LIMIT 1
What is the receipt date of the document with id 3?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT receipt_date FROM Documents WHERE document_id = 3
What address was the document with id 4 mailed to?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4
What is the mail date of the document with id 7?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7
List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper' EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'
List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper' INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'
What is draft detail of the document with id 7?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT draft_details FROM Document_Drafts WHERE document_id = 7
How many draft copies does the document with id 2 have?
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT COUNT(*) FROM Draft_Copies WHERE document_id = 2
Which document has the most draft copies? List its document id and number of draft copies.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id, COUNT(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY COUNT(copy_number) DESC LIMIT 1
Which documents have more than 1 draft copies? List document id and number of draft copies.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id, COUNT(*) FROM Draft_Copies GROUP BY document_id HAVING COUNT(*) > 1
List all employees in the circulation history of the document with id 1. List the employee's name.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1
List the employees who have not showed up in any circulation history of documents. List the employee's name.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id
Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT Employees.employee_name, COUNT(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id, Circulation_History.draft_number, Circulation_History.copy_number ORDER BY COUNT(*) DESC LIMIT 1
For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees.
Additional table information: table: cre_Doc_Control_Systems
SQL: SELECT document_id, COUNT(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id
List all department names ordered by their starting date.
Additional table information: table: company_1
SQL: SELECT dname FROM department ORDER BY mgr_start_date NULLS FIRST
find all dependent names who have a spouse relation with some employee.
Additional table information: table: company_1
SQL: SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse'
how many female dependents are there?
Additional table information: table: company_1
SQL: SELECT COUNT(*) FROM dependent WHERE sex = 'F'
Find the names of departments that are located in Houston.
Additional table information: table: company_1
SQL: SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'
Return the first names and last names of employees who earn more than 30000 in salary.
Additional table information: table: company_1
SQL: SELECT fname, lname FROM employee WHERE salary > 30000
Find the number of employees of each gender whose salary is lower than 50000.
Additional table information: table: company_1
SQL: SELECT COUNT(*), sex FROM employee WHERE salary < 50000 GROUP BY sex
list the first and last names, and the addresses of all employees in the ascending order of their birth date.
Additional table information: table: company_1
SQL: SELECT fname, lname, address FROM employee ORDER BY Bdate NULLS FIRST
what are the event details of the services that have the type code 'Marriage'?
Additional table information: table: local_govt_in_alabama
SQL: SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage'
What are the ids and details of events that have more than one participants?
Additional table information: table: local_govt_in_alabama
SQL: SELECT T1.event_id, T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING COUNT(*) > 1
How many events have each participants attended? List the participant id, type and the number.
Additional table information: table: local_govt_in_alabama
SQL: SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID
What are all the the participant ids, type code and details?
Additional table information: table: local_govt_in_alabama
SQL: SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants
How many participants belong to the type 'Organizer'?
Additional table information: table: local_govt_in_alabama
SQL: SELECT COUNT(*) FROM participants WHERE participant_type_code = 'Organizer'
List the type of the services in alphabetical order.
Additional table information: table: local_govt_in_alabama
SQL: SELECT service_type_code FROM services ORDER BY service_type_code NULLS FIRST
List the service id and details for the events.
Additional table information: table: local_govt_in_alabama
SQL: SELECT service_id, event_details FROM EVENTS
How many events had participants whose details had the substring 'Dr.'
Additional table information: table: local_govt_in_alabama
SQL: SELECT COUNT(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%'
What is the most common participant type?
Additional table information: table: local_govt_in_alabama
SQL: SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY COUNT(*) DESC LIMIT 1
Which service id and type has the least number of participants?
Additional table information: table: local_govt_in_alabama
SQL: SELECT T3.service_id, T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID = T3.Event_ID JOIN services AS T4 ON T3.service_id = T4.service_id GROUP BY T3.service_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the id of the event with the most participants?
Additional table information: table: local_govt_in_alabama
SQL: SELECT Event_ID FROM Participants_in_Events GROUP BY Event_ID ORDER BY COUNT(*) DESC LIMIT 1
Which events id does not have any participant with detail 'Kenyatta Kuhn'?
Additional table information: table: local_govt_in_alabama
SQL: SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE Participant_Details = 'Kenyatta Kuhn'
Which services type had both successful and failure event details?
Additional table information: table: local_govt_in_alabama
SQL: SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Fail'
How many events did not have any participants?
Additional table information: table: local_govt_in_alabama
SQL: SELECT COUNT(*) FROM EVENTS WHERE NOT event_id IN (SELECT event_id FROM Participants_in_Events)
What are all the distinct participant ids who attended any events?
Additional table information: table: local_govt_in_alabama
SQL: SELECT COUNT(DISTINCT participant_id) FROM participants_in_Events
What is the name of the race held most recently?
Additional table information: table: formula_1
SQL: SELECT name FROM races ORDER BY date DESC LIMIT 1