db_id
stringlengths 3
31
| query
stringlengths 18
577
| question
stringlengths 3
224
| schema
stringlengths 177
6.14k
| primary_keys
stringlengths 16
545
| foreign_keys
stringlengths 16
1.48k
|
---|---|---|---|---|---|
customers_and_invoices | SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number | How many transactions correspond to each invoice number? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What is the invoice number and invoice date for the invoice with most number of transactions? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What is the invoice number and invoice date corresponding to the invoice with the greatest number of transactions? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT count(*) FROM Invoices | How many invoices do we have? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT count(*) FROM Invoices | Count the number of invoices. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Show invoice dates and order id and details for all invoices. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What are the invoice dates, order ids, and order details for all invoices? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(*) FROM Invoices GROUP BY order_id | Show the order ids and the number of invoices for each order. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(*) FROM Invoices GROUP BY order_id | How many invoices correspond to each order id? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What is the order id and order details for the order more than two invoices. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Return the order ids and details for orderes with two or more invoices. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What is the customer last name, id and phone number with most number of orders? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Return the last name, id and phone number of the customer who has made the greatest number of orders. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Show all product names without an order. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What are the names of products that have never been ordered? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Show all product names and the total quantity ordered for each product name. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What are the different product names, and what is the sum of quantity ordered for each product? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(*) FROM Order_items GROUP BY order_id | Show the order ids and the number of items in each order. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(*) FROM Order_items GROUP BY order_id | How many order items correspond to each order id? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id | Show the product ids and the number of unique orders containing each product. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id | How many distinct order ids correspond to each product? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | Show all product names and the number of customers having an order on each product. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | 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 | What are teh names of the different products, as well as the number of customers who have ordered each product. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id | Show order ids and the number of products in each order. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id | How many different products correspond to each order id? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id | Show order ids and the total quantity in each order. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id | Give the order ids for all orders, as well as the total product quantity in each. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items ) | How many products were not included in any order? | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
customers_and_invoices | SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items ) | Count the number of products that were never ordered. | [Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , customer_middle_initial (text) , customer_last_name (text) , gender (text) , email_address (text) , login_name (text) , login_password (text) , phone_number (text) , town_city (text) , state_county_province (text) , country (text) | Orders : order_id (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text); | [Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id | [Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id |
wedding | SELECT count(*) FROM Church WHERE Open_Date < 1850 | How many churches opened before 1850 are there? | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT name , open_date , organized_by FROM Church | Show the name, open date, and organizer for all churches. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT name FROM church ORDER BY open_date DESC | List all church names in descending order of opening date. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT open_date FROM church GROUP BY open_date HAVING count(*) >= 2 | Show the opening year in whcih at least two churches opened. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT organized_by , name FROM church WHERE open_date BETWEEN 1830 AND 1840 | Show the organizer and name for churches that opened between 1830 and 1840. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT open_date , count(*) FROM church GROUP BY open_date | Show all opening years and the number of churches that opened in that year. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3 | Show the name and opening year for three churches that opened most recently. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT count(*) FROM people WHERE is_male = 'F' AND age > 30 | How many female people are older than 30 in our record? | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30 | Show the country where people older than 30 and younger than 25 are from. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT min(age) , max(age) , avg(age) FROM people | Show the minimum, maximum, and average age for all people. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT name , country FROM people WHERE age < (SELECT avg(age) FROM people) | Show the name and country for all people whose age is smaller than the average. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | 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 | Show the pair of male and female names in all weddings after year 2014 | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT name , age FROM people WHERE is_male = 'T' AND people_id NOT IN (SELECT male_id FROM wedding) | Show the name and age for all male people who don't have a wedding. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | 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 | Show all church names except for those that had a wedding in year 2015. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | 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 | Show all church names that have hosted least two weddings. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | 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' | Show the names for all females from Canada having a wedding in year 2016. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT count(*) FROM wedding WHERE YEAR = 2016 | How many weddings are there in year 2016? | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | 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 | Show the church names for the weddings of all people older than 30. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT country , count(*) FROM people GROUP BY country | Show all countries and the number of people from each country. | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
wedding | SELECT COUNT (DISTINCT church_id) FROM wedding WHERE YEAR = 2016 | How many churches have a wedding in year 2016? | [Schema (values) (types)]: | wedding | people : people_id (text) , name (number) , country (text) , is_male (text) , age (text) | church : church_id (text) , name (number) , organized_by (text) , open_date (text) , continuation_of (text) | wedding : church_id (text) , male_id (number) , female_id (text) , year (text); | [Primary Keys]: people : people_id, church : church_id, wedding : church_id | [Foreign Keys]: wedding : female_id = people : people_id | wedding : male_id = people : people_id | wedding : church_id = church : church_id |
theme_gallery | SELECT count(*) FROM artist | How many artists do we have? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT count(*) FROM artist | Count the number of artists. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name , age , country FROM artist ORDER BY Year_Join | Show all artist name, age, and country ordered by the yeared they joined. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name , age , country FROM artist ORDER BY Year_Join | What are the names, ages, and countries of artists, sorted by the year they joined? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT DISTINCT country FROM artist | What are all distinct country for artists? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT DISTINCT country FROM artist | Return the different countries for artists. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name , year_join FROM artist WHERE country != 'United States' | Show all artist names and the year joined who are not from United States. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name , year_join FROM artist WHERE country != 'United States' | What are the names and year of joining for artists that do not have the country "United States"? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990 | How many artists are above age 46 and joined after 1990? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990 | Count the number of artists who are older than 46 and joined after 1990. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT avg(age) , min(age) FROM artist WHERE country = 'United States' | What is the average and minimum age of all artists from United States. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT avg(age) , min(age) FROM artist WHERE country = 'United States' | Return the average and minimum ages across artists from the United States. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name FROM artist ORDER BY year_join DESC LIMIT 1 | What is the name of the artist who joined latest? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name FROM artist ORDER BY year_join DESC LIMIT 1 | Return the name of the artist who has the latest join year. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT count(*) FROM exhibition WHERE YEAR >= 2005 | How many exhibition are there in year 2005 or after? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT count(*) FROM exhibition WHERE YEAR >= 2005 | Count the number of exhibitions that happened in or after 2005. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15 | Show theme and year for all exhibitions with ticket prices lower than 15. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15 | What are the theme and year for all exhibitions that have a ticket price under 15? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id | Show all artist names and the number of exhibitions for each artist. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id | How many exhibitions has each artist had? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | What is the name and country for the artist with most number of exhibitions? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Return the name and country corresponding to the artist who has had the most exhibitions. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition) | Show names for artists without any exhibition. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition) | What are the names of artists that have not had any exhibitions? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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) | What is the theme and artist name for the exhibition with a ticket price higher than the average? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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) | Return the names of artists and the themes of their exhibitions that had a ticket price higher than average. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009 | Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009 | What are the average, minimum, and maximum ticket prices for exhibitions that happened prior to 2009? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC | Show theme and year for all exhibitions in an descending order of ticket price. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC | What are the themes and years for exhibitions, sorted by ticket price descending? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | What is the theme, date, and attendance for the exhibition in year 2004? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Return the themes, dates, and attendance for exhibitions that happened in 2004. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Show all artist names who didn't have an exhibition in 2004. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | What are the names of artists who did not have an exhibition in 2004? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Show the theme for exhibitions with both records of an attendance below 100 and above 500. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Which themes have had corresponding exhibitions that have had attendance both below 100 and above 500? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | How many exhibitions have a attendance more than 100 or have a ticket price below 10? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Count the number of exhibitions that have had an attendnance of over 100 or a ticket prices under 10. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | Show all artist names with an average exhibition attendance over 200. | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
theme_gallery | 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 | What are the names of artist whose exhibitions draw over 200 attendees on average? | [Schema (values) (types)]: | theme_gallery | artist : artist_id (text) , name (number) , country (text) , year_join (text) , age (number) | exhibition : exhibition_id (text) , year (number) , theme (text) , artist_id (text) , ticket_price (number) | exhibition_record : exhibition_id (text) , date (number) , attendance (text); | [Primary Keys]: artist : artist_id, exhibition : exhibition_id, exhibition_record : exhibition_id | [Foreign Keys]: exhibition : artist_id = artist : artist_id | exhibition_record : exhibition_id = exhibition : exhibition_id |
epinions_1 | SELECT i_id FROM item WHERE title = "orange" | Find the id of the item whose title is "orange". | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT * FROM item | List all information in the item table. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT count(*) FROM review | Find the number of reviews. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT count(*) FROM useracct | How many users are there? | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT avg(rating) , max(rating) FROM review | Find the average and maximum rating of all reviews. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT min(rank) FROM review | Find the highest rank of all reviews. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT count(DISTINCT u_id) FROM review | How many different users wrote some reviews? | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT count(DISTINCT i_id) FROM review | How many different items were reviewed by some users? | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review) | Find the number of items that did not receive any review. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review) | Find the names of users who did not leave any review. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
epinions_1 | SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10 | Find the names of goods that receive a rating of 10. | [Schema (values) (types)]: | epinions_1 | item : i_id (text) , title (number) | review : a_id (text) , u_id (number) , i_id (text) , rating (number) , rank (number) | useracct : u_id (text) , name (number) | trust : source_u_id (text) , target_u_id (number) , trust (text); | [Primary Keys]: item : i_id, review : a_id, useracct : u_id | [Foreign Keys]: review : i_id = item : i_id | review : u_id = useracct : u_id | trust : target_u_id = useracct : u_id | trust : source_u_id = useracct : u_id |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.