schema
stringlengths
144
5.45k
question
stringlengths
16
224
query
stringlengths
18
577
hardness
stringclasses
5 values
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show all the Store_Name of drama workshop groups.
SELECT Store_Name FROM Drama_Workshop_Groups
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the store names of drama workshop groups?
SELECT Store_Name FROM Drama_Workshop_Groups
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show the minimum, average, maximum order quantity of all invoices.
SELECT min(Order_Quantity) , avg(Order_Quantity) , max(Order_Quantity) FROM INVOICES
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the minimum, average, and maximum quantities ordered? Check all the invoices.
SELECT min(Order_Quantity) , avg(Order_Quantity) , max(Order_Quantity) FROM INVOICES
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the distinct payment method codes in all the invoices?
SELECT DISTINCT payment_method_code FROM INVOICES
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show me the distinct payment method codes from the invoice record.
SELECT DISTINCT payment_method_code FROM INVOICES
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the description of the marketing region China?
SELECT Marketing_Region_Descriptrion FROM Marketing_Regions WHERE Marketing_Region_Name = "China"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the marketing region description of China?
SELECT Marketing_Region_Descriptrion FROM Marketing_Regions WHERE Marketing_Region_Name = "China"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show all the distinct product names with price higher than the average.
SELECT DISTINCT Product_Name FROM PRODUCTS WHERE Product_Price > (SELECT avg(Product_Price) FROM PRODUCTS)
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the distinct names of the products that cost more than the average?
SELECT DISTINCT Product_Name FROM PRODUCTS WHERE Product_Price > (SELECT avg(Product_Price) FROM PRODUCTS)
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the name of the most expensive product?
SELECT Product_Name FROM PRODUCTS ORDER BY Product_Price DESC LIMIT 1
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Tell me the name of the most pricy product.
SELECT Product_Name FROM PRODUCTS ORDER BY Product_Price DESC LIMIT 1
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
List all product names in ascending order of price.
SELECT Product_Name FROM Products ORDER BY Product_Price ASC
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Sort the names of products in ascending order of their price.
SELECT Product_Name FROM Products ORDER BY Product_Price ASC
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the phone number of the performer Ashley?
SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = "Ashley"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the phone number of performer "Ashley".
SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = "Ashley"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show all payment method codes and the number of orders for each code.
SELECT payment_method_code , count(*) FROM INVOICES GROUP BY payment_method_code
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
List the distinct payment method codes with the number of orders made
SELECT payment_method_code , count(*) FROM INVOICES GROUP BY payment_method_code
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the payment method code used by the most orders?
SELECT payment_method_code FROM INVOICES GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the payment method that is used the most often in all the invoices. Give me its code.
SELECT payment_method_code FROM INVOICES GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Which city is the address of the store named "FJA Filming" located in?
SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = "FJA Filming"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the city the store named "FJA Filming" is in.
SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = "FJA Filming"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the states or counties of the address of the stores with marketing region code "CA"?
SELECT T1.State_County FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Marketing_Region_Code = "CA"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the states or counties where the stores with marketing region code "CA" are located.
SELECT T1.State_County FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Marketing_Region_Code = "CA"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the name of the marketing region that the store Rob Dinning belongs to?
SELECT T1.Marketing_Region_Name FROM Marketing_Regions AS T1 JOIN Stores AS T2 ON T1.Marketing_Region_Code = T2.Marketing_Region_Code WHERE T2.Store_Name = "Rob Dinning"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Return the name of the marketing region the store Rob Dinning is located in.
SELECT T1.Marketing_Region_Name FROM Marketing_Regions AS T1 JOIN Stores AS T2 ON T1.Marketing_Region_Code = T2.Marketing_Region_Code WHERE T2.Store_Name = "Rob Dinning"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the descriptions of the service types with product price above 100?
SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Give me the descriptions of the service types that cost more than 100.
SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the description, code and the corresponding count of each service type?
SELECT T1.Service_Type_Description , T2.Service_Type_Code , COUNT(*) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T2.Service_Type_Code
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
List the description, code and the number of services for each service type.
SELECT T1.Service_Type_Description , T2.Service_Type_Code , COUNT(*) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T2.Service_Type_Code
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the description and code of the type of service that is performed the most often?
SELECT T1.Service_Type_Description , T1.Service_Type_Code FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T1.Service_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
extra
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the description and code of the service type that is performed the most times.
SELECT T1.Service_Type_Description , T1.Service_Type_Code FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T1.Service_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
extra
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the phones and emails of workshop groups in which services are performed?
SELECT T1.Store_Phone , T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Give me all the phone numbers and email addresses of the workshop groups where services are performed.
SELECT T1.Store_Phone , T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the names of workshop groups in which services with product name "film" are performed?
SELECT T1.Store_Phone , T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T2.Product_Name = "film"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the names of the workshop groups where services with product name "film" are performed.
SELECT T1.Store_Phone , T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T2.Product_Name = "film"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the different product names? What is the average product price for each of them?
SELECT Product_Name , avg(Product_Price) FROM PRODUCTS GROUP BY Product_Name
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
For each distinct product name, show its average product price.
SELECT Product_Name , avg(Product_Price) FROM PRODUCTS GROUP BY Product_Name
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the product names with average product price smaller than 1000000?
SELECT Product_Name FROM PRODUCTS GROUP BY Product_Name HAVING avg(Product_Price) < 1000000
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the product names whose average product price is below 1000000.
SELECT Product_Name FROM PRODUCTS GROUP BY Product_Name HAVING avg(Product_Price) < 1000000
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the total order quantities of photo products?
SELECT sum(T1.Order_Quantity) FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_Name = "photo"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Compute the total order quantities of the product "photo".
SELECT sum(T1.Order_Quantity) FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_Name = "photo"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the order details of the products with price higher than 2000?
SELECT T1.Other_Item_Details FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_price > 2000
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the order detail for the products with price above 2000.
SELECT T1.Other_Item_Details FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_price > 2000
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the actual delivery dates of orders with quantity 1?
SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
List the actual delivery date for all the orders with quantity 1
SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the order dates of orders with price higher than 1000?
SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the order dates of the orders with price above 1000.
SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
How many distinct currency codes are there for all drama workshop groups?
SELECT count(DISTINCT Currency_Code) FROM Drama_Workshop_Groups
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the number of distinct currency codes used in drama workshop groups.
SELECT count(DISTINCT Currency_Code) FROM Drama_Workshop_Groups
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the names of the drama workshop groups with address in Feliciaberg city?
SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.City_Town = "Feliciaberg"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Return the the names of the drama workshop groups that are located in Feliciaberg city.
SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.City_Town = "Feliciaberg"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the email addresses of the drama workshop groups with address in Alaska state?
SELECT T2.Store_Email_Address FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.State_County = "Alaska"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
List the email addresses of the drama workshop groups located in Alaska state.
SELECT T2.Store_Email_Address FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.State_County = "Alaska"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show all cities along with the number of drama workshop groups in each city.
SELECT T1.City_Town , count(*) FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID GROUP BY T1.City_Town
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
How many drama workshop groups are there in each city? Return both the city and the count.
SELECT T1.City_Town , count(*) FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID GROUP BY T1.City_Town
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the marketing region code that has the most drama workshop groups?
SELECT Marketing_Region_Code FROM Drama_Workshop_Groups GROUP BY Marketing_Region_Code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Which marketing region has the most drama workshop groups? Give me the region code.
SELECT Marketing_Region_Code FROM Drama_Workshop_Groups GROUP BY Marketing_Region_Code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show all cities where at least one customer lives in but no performer lives in.
SELECT T1.City_Town FROM Addresses AS T1 JOIN Customers AS T2 ON T1.Address_ID = T2.Address_ID EXCEPT SELECT T1.City_Town FROM Addresses AS T1 JOIN Performers AS T2 ON T1.Address_ID = T2.Address_ID
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Which cities have at least one customer but no performer?
SELECT T1.City_Town FROM Addresses AS T1 JOIN Customers AS T2 ON T1.Address_ID = T2.Address_ID EXCEPT SELECT T1.City_Town FROM Addresses AS T1 JOIN Performers AS T2 ON T1.Address_ID = T2.Address_ID
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the most frequent status of bookings?
SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Which status code is the most common of all the bookings?
SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the names of the workshop groups that have bookings with status code "stop"?
SELECT T2.Store_Name FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T1.Status_Code = "stop"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Which workshop groups have bookings with status code "stop"? Give me the names.
SELECT T2.Store_Name FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T1.Status_Code = "stop"
medium
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Show the names of all the clients with no booking.
SELECT Customer_Name FROM Clients EXCEPT SELECT T2.Customer_Name FROM Bookings AS T1 JOIN Clients AS T2 ON T1.Customer_ID = T2.Client_ID
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What are the names of the clients who do not have any booking?
SELECT Customer_Name FROM Clients EXCEPT SELECT T2.Customer_Name FROM Bookings AS T1 JOIN Clients AS T2 ON T1.Customer_ID = T2.Client_ID
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the average quantities ordered with payment method code "MasterCard" on invoices?
SELECT avg(Order_Quantity) FROM Invoices WHERE payment_method_code = "MasterCard"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Check the invoices record and compute the average quantities ordered with the payment method "MasterCard".
SELECT avg(Order_Quantity) FROM Invoices WHERE payment_method_code = "MasterCard"
easy
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the product ID of the most frequently ordered item on invoices?
SELECT Product_ID FROM INVOICES GROUP BY Product_ID ORDER BY COUNT(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Find the id of the product ordered the most often on invoices.
SELECT Product_ID FROM INVOICES GROUP BY Product_ID ORDER BY COUNT(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
What is the description of the service type which offers both the photo product and the film product?
SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'photo' INTERSECT SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'film'
extra
CREATE TABLE Ref_Payment_Methods (payment_method_code text, payment_method_description text); CREATE TABLE Ref_Service_Types (Service_Type_Code text, Parent_Service_Type_Code text, Service_Type_Description text); CREATE TABLE Addresses (Address_ID text, Line_1 text, Line_2 text, City_Town text, State_County text, Other_Details text); CREATE TABLE Products (Product_ID text, Product_Name text, Product_Price number, Product_Description text, Other_Product_Service_Details text); CREATE TABLE Marketing_Regions (Marketing_Region_Code text, Marketing_Region_Name text, Marketing_Region_Descriptrion text, Other_Details text); CREATE TABLE Clients (Client_ID number, Address_ID number, Customer_Email_Address text, Customer_Name text, Customer_Phone text, Other_Details text); CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID number, Address_ID number, Currency_Code text, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Performers (Performer_ID number, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Customers (Customer_ID text, Address_ID number, Customer_Name text, Customer_Phone text, Customer_Email_Address text, Other_Details text); CREATE TABLE Stores (Store_ID text, Address_ID number, Marketing_Region_Code text, Store_Name text, Store_Phone text, Store_Email_Address text, Other_Details text); CREATE TABLE Bookings (Booking_ID number, Customer_ID number, Workshop_Group_ID text, Status_Code text, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Performers_in_Bookings (Order_ID number, Performer_ID number); CREATE TABLE Customer_Orders (Order_ID number, Customer_ID number, Store_ID number, Order_Date time, Planned_Delivery_Date time, Actual_Delivery_Date time, Other_Order_Details text); CREATE TABLE Order_Items (Order_Item_ID number, Order_ID number, Product_ID number, Order_Quantity text, Other_Item_Details text); CREATE TABLE Invoices (Invoice_ID number, Order_ID number, payment_method_code text, Product_ID number, Order_Quantity text, Other_Item_Details text, Order_Item_ID number); CREATE TABLE Services (Service_ID number, Service_Type_Code text, Workshop_Group_ID number, Product_Description text, Product_Name text, Product_Price number, Other_Product_Service_Details text); CREATE TABLE Bookings_Services (Order_ID number, Product_ID number); CREATE TABLE Invoice_Items (Invoice_Item_ID number, Invoice_ID number, Order_ID number, Order_Item_ID number, Product_ID number, Order_Quantity number, Other_Item_Details text);
Give me the description of the service type that offers not only the photo product but also the film product.
SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'photo' INTERSECT SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'film'
extra
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
How many bands are there?
SELECT count(*) FROM Band
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Find the number of bands.
SELECT count(*) FROM Band
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are all the labels?
SELECT DISTINCT label FROM Albums
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the different album labels listed?
SELECT DISTINCT label FROM Albums
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Find all the albums in 2012.
SELECT * FROM Albums WHERE YEAR = 2012
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
return all columns of the albums created in the year of 2012.
SELECT * FROM Albums WHERE YEAR = 2012
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Find all the stage positions of the musicians with first name "Solveig"
SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = "Solveig"
medium
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the different stage positions for all musicians whose first name is "Solveig"?
SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = "Solveig"
medium
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
How many songs are there?
SELECT count(*) FROM Songs
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Count the number of songs.
SELECT count(*) FROM Songs
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Find all the songs performed by artist with last name "Heilo"
SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = "Heilo"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the names of the songs by the artist whose last name is "Heilo"?
SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = "Heilo"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Hom many musicians performed in the song "Flash"?
SELECT count(*) FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.Title = "Flash"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
How many musicians play in the song "Flash"?
SELECT count(*) FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.Title = "Flash"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Find all the songs produced by artists with first name "Marianne".
SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.firstname = "Marianne"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the names of all songs produced by the artist with the first name "Marianne"?
SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.firstname = "Marianne"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Who performed the song named "Badlands"? Show the first name and the last name.
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the first and last names of the artist who perfomed the song "Badlands"?
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
Who is performing in the back stage position for the song "Badlands"? Show the first name and the last name.
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands" AND T1.StagePosition = "back"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the first and last names of the performer who was in the back stage position for the song "Badlands"?
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands" AND T1.StagePosition = "back"
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
How many unique labels are there for albums?
SELECT count(DISTINCT label) FROM albums
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What are the unique labels for the albums?
SELECT count(DISTINCT label) FROM albums
easy
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the label that has the most albums?
SELECT label FROM albums GROUP BY label ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the label with the most albums?
SELECT label FROM albums GROUP BY label ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the last name of the musician that have produced the most number of songs?
SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId GROUP BY lastname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the last name of the musician who was in the most songs?
SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId GROUP BY lastname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the last name of the musician that has been at the back position the most?
SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE stageposition = "back" GROUP BY lastname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Songs (SongId number, Title text); CREATE TABLE Albums (AId number, Title text, Year number, Label text, Type text); CREATE TABLE Band (Id number, Firstname text, Lastname text); CREATE TABLE Instruments (SongId number, BandmateId number, Instrument text); CREATE TABLE Performance (SongId number, Bandmate number, StagePosition text); CREATE TABLE Tracklists (AlbumId number, Position number, SongId number); CREATE TABLE Vocals (SongId number, Bandmate number, Type text);
What is the last name of the musicians who has played back position the most?
SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE stageposition = "back" GROUP BY lastname ORDER BY count(*) DESC LIMIT 1
extra