input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY count(*) DESC LIMIT 1;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY count(*) DESC LIMIT 1;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT count(*) FROM Invoices;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT count(*) FROM Invoices;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T1.invoice_date , T1.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T1.invoice_date , T1.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(*) FROM Invoices GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(*) FROM Invoices GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING count(*) > 2;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING count(*) > 2;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.customer_last_name , T1.customer_id , T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.customer_last_name , T1.customer_id , T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.product_name , sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.product_name , sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(*) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(*) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.product_name , count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT T2.product_name , count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id;
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items );
Tables: Customers, Orders, Invoices, Accounts, Product_Categories, Products, Financial_Transactions, Order_Items, Invoice_Line_Items Columns: Customers.customer_id, Customers.customer_first_name, Customers.customer_middle_initial, Customers.customer_last_name, Customers.gender, Customers.email_address, Customers.login_...
SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items );
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: How many churches opened before ...
SELECT count(*) FROM Church WHERE Open_Date < 1850;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the name, open date, and or...
SELECT name , open_date , organized_by FROM Church;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: List all church names in descend...
SELECT name FROM church ORDER BY open_date DESC;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the opening year in whcih a...
SELECT open_date FROM church GROUP BY open_date HAVING count(*) >= 2;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the organizer and name for ...
SELECT organized_by , name FROM church WHERE open_date BETWEEN 1830 AND 1840;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show all opening years and the n...
SELECT open_date , count(*) FROM church GROUP BY open_date;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the name and opening year f...
SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: How many female people are older...
SELECT count(*) FROM people WHERE is_male = 'F' AND age > 30;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the country where people ol...
SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the minimum, maximum, and a...
SELECT min(age) , max(age) , avg(age) FROM people;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the name and country for al...
SELECT name , country FROM people WHERE age < (SELECT avg(age) FROM people);
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the pair of male and female...
SELECT T2.name , T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the name and age for all ma...
SELECT name , age FROM people WHERE is_male = 'T' AND people_id NOT IN (SELECT male_id FROM wedding);
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show all church names except for...
SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id WHERE T2.year = 2015;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show all church names that have ...
SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING count(*) >= 2;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the names for all females f...
SELECT T2.name FROM wedding AS T1 JOIN people AS T2 ON T1.female_id = T2.people_id WHERE T1.year = 2016 AND T2.is_male = 'F' AND T2.country = 'Canada';
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: How many weddings are there in y...
SELECT count(*) FROM wedding WHERE YEAR = 2016;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show the church names for the we...
SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: Show all countries and the numbe...
SELECT country , count(*) FROM people GROUP BY country;
Tables: people, church, wedding Columns: people.People_ID, people.Name, people.Country, people.Is_Male, people.Age, church.Church_ID, church.Name, church.Organized_by, church.Open_Date, church.Continuation_of, wedding.Church_ID, wedding.Male_ID, wedding.Female_ID, wedding.Year Question: How many churches have a wedding...
SELECT COUNT (DISTINCT church_id) FROM wedding WHERE YEAR = 2016;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM artist;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM artist;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name , age , country FROM artist ORDER BY Year_Join;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name , age , country FROM artist ORDER BY Year_Join;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT DISTINCT country FROM artist;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT DISTINCT country FROM artist;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name , year_join FROM artist WHERE country != 'United States';
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name , year_join FROM artist WHERE country != 'United States';
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT avg(age) , min(age) FROM artist WHERE country = 'United States';
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT avg(age) , min(age) FROM artist WHERE country = 'United States';
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist ORDER BY year_join DESC LIMIT 1;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist ORDER BY year_join DESC LIMIT 1;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM exhibition WHERE YEAR >= 2005;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM exhibition WHERE YEAR >= 2005;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition);
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition);
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T1.theme , T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT avg(ticket_price) FROM exhibition);
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T1.theme , T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT avg(ticket_price) FROM exhibition);
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.theme , T1.date , T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.theme , T1.date , T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance) > 200;
Tables: artist, exhibition, exhibition_record Columns: artist.Artist_ID, artist.Name, artist.Country, artist.Year_Join, artist.Age, exhibition.Exhibition_ID, exhibition.Year, exhibition.Theme, exhibition.Artist_ID, exhibition.Ticket_Price, exhibition_record.Exhibition_ID, exhibition_record.Date, exhibition_record.Atten...
SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance) > 200;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the id of the item whose title is "orange". [/INST]
SELECT i_id FROM item WHERE title = "orange";
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: List all information in the item table. [/INST]
SELECT * FROM item;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the number of reviews. [/INST]
SELECT count(*) FROM review;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: How many users are there? [/INST]
SELECT count(*) FROM useracct;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the average and maximum rating of all reviews. [/INST]
SELECT avg(rating) , max(rating) FROM review;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the highest rank of all reviews. [/INST]
SELECT min(rank) FROM review;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: How many different users wrote some reviews? [/INST]
SELECT count(DISTINCT u_id) FROM review;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: How many different items were reviewed by some users? [/INST]
SELECT count(DISTINCT i_id) FROM review;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the number of items that did not receive any review. [/INST]
SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the names of users who did not leave any review. [/INST]
SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the names of goods that receive a rating of 10. [/INST]
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10;