schema
stringlengths 144
5.45k
| question
stringlengths 16
224
| query
stringlengths 18
577
| hardness
stringclasses 5
values |
---|---|---|---|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
List the name of artworks whose type is not "Program Talent Show".
|
SELECT Name FROM artwork WHERE TYPE != "Program Talent Show"
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What are the names and locations of festivals?
|
SELECT Festival_Name , LOCATION FROM festival_detail
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What are the names of the chairs of festivals, sorted in ascending order of the year held?
|
SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What is the location of the festival with the largest number of audience?
|
SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What are the names of festivals held in year 2007?
|
SELECT Festival_Name FROM festival_detail WHERE YEAR = 2007
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What is the average number of audience for festivals?
|
SELECT avg(Num_of_Audience) FROM festival_detail
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the names of the three most recent festivals.
|
SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
For each nomination, show the name of the artwork and name of the festival where it is nominated.
|
SELECT T2.Name , T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show distinct types of artworks that are nominated in festivals in 2007.
|
SELECT DISTINCT T2.Type FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T3.Year = 2007
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the names of artworks in ascending order of the year they are nominated in.
|
SELECT T2.Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3.Year
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the names of festivals that have nominated artworks of type "Program Talent Show".
|
SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T2.Type = "Program Talent Show"
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the ids and names of festivals that have at least two nominations for artworks.
|
SELECT T1.Festival_ID , T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*) >= 2
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the id, name of each festival and the number of artworks it has nominated.
|
SELECT T1.Festival_ID , T3.Festival_Name , COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Please show different types of artworks with the corresponding number of artworks of each type.
|
SELECT TYPE , COUNT(*) FROM artwork GROUP BY TYPE
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
List the most common type of artworks.
|
SELECT TYPE FROM artwork GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
List the year in which there are more than one festivals.
|
SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*) > 1
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
List the name of artworks that are not nominated.
|
SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination)
|
hard
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
Show the number of audience in year 2008 or 2010.
|
SELECT Num_of_Audience FROM festival_detail WHERE YEAR = 2008 OR YEAR = 2010
|
medium
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
What are the total number of the audiences who visited any of the festivals?
|
SELECT sum(Num_of_Audience) FROM festival_detail
|
easy
|
CREATE TABLE festival_detail (Festival_ID number, Festival_Name text, Chair_Name text, Location text, Year number, Num_of_Audience number); CREATE TABLE artwork (Artwork_ID number, Type text, Name text); CREATE TABLE nomination (Artwork_ID number, Festival_ID number, Result text);
|
In which year are there festivals both inside the 'United States' and outside the 'United States'?
|
SELECT YEAR FROM festival_detail WHERE LOCATION = 'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != 'United States'
|
hard
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
How many premises are there?
|
SELECT count(*) FROM premises
|
easy
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
What are all the distinct premise types?
|
SELECT DISTINCT premises_type FROM premises
|
easy
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Find the types and details for all premises and order by the premise type.
|
SELECT premises_type , premise_details FROM premises ORDER BY premises_type
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show each premise type and the number of premises in that type.
|
SELECT premises_type , count(*) FROM premises GROUP BY premises_type
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show all distinct product categories along with the number of mailshots in each category.
|
SELECT product_category , count(*) FROM mailshot_campaigns GROUP BY product_category
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the name and phone of the customer without any mailshot.
|
SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
|
extra
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the name and phone for customers with a mailshot with outcome code 'No Response'.
|
SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.outcome_code = 'No Response'
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the outcome code of mailshots along with the number of mailshots in each outcome code.
|
SELECT outcome_code , count(*) FROM mailshot_customers GROUP BY outcome_code
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the names of customers who have at least 2 mailshots with outcome code 'Order'.
|
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE outcome_code = 'Order' GROUP BY T1.customer_id HAVING count(*) >= 2
|
hard
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the names of customers who have the most mailshots.
|
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.
|
SELECT T2.customer_name , T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'Order' INTERSECT SELECT T2.customer_name , T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'No Response'
|
extra
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the premise type and address type code for all customer addresses.
|
SELECT T2.premises_type , T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id = T2.premise_id
|
medium
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
What are the distinct address type codes for all customer addresses?
|
SELECT DISTINCT address_type_code FROM customer_addresses
|
easy
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.
|
SELECT order_shipping_charges , customer_id FROM customer_orders WHERE order_status_code = 'Cancelled' OR order_status_code = 'Paid'
|
extra
|
CREATE TABLE Premises (premise_id number, premises_type text, premise_details text); CREATE TABLE Products (product_id number, product_category text, product_name text); CREATE TABLE Customers (customer_id number, payment_method text, customer_name text, customer_phone text, customer_email text, customer_address text, customer_login text, customer_password text); CREATE TABLE Mailshot_Campaigns (mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time); CREATE TABLE Customer_Addresses (customer_id number, premise_id number, date_address_from time, address_type_code text, date_address_to time); CREATE TABLE Customer_Orders (order_id number, customer_id number, order_status_code text, shipping_method_code text, order_placed_datetime time, order_delivered_datetime time, order_shipping_charges text); CREATE TABLE Mailshot_Customers (mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time); CREATE TABLE Order_Items (item_id number, order_item_status_code text, order_id number, product_id number, item_status_code text, item_delivered_datetime time, item_order_quantity text);
|
Show the names of customers having an order with shipping method FedEx and order status Paid.
|
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE shipping_method_code = 'FedEx' AND order_status_code = 'Paid'
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
How many courses are there in total?
|
SELECT count(*) FROM COURSE
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Count the number of courses.
|
SELECT count(*) FROM COURSE
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
How many courses have more than 2 credits?
|
SELECT count(*) FROM COURSE WHERE Credits > 2
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Count the number of courses with more than 2 credits.
|
SELECT count(*) FROM COURSE WHERE Credits > 2
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
List all names of courses with 1 credit?
|
SELECT CName FROM COURSE WHERE Credits = 1
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the names of courses with 1 credit?
|
SELECT CName FROM COURSE WHERE Credits = 1
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Which courses are taught on days MTW?
|
SELECT CName FROM COURSE WHERE Days = "MTW"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the course names for courses taught on MTW?
|
SELECT CName FROM COURSE WHERE Days = "MTW"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the number of departments in Division "AS"?
|
SELECT count(*) FROM DEPARTMENT WHERE Division = "AS"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
How many departments are in the division AS?
|
SELECT count(*) FROM DEPARTMENT WHERE Division = "AS"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the phones of departments in Room 268?
|
SELECT DPhone FROM DEPARTMENT WHERE Room = 268
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Give the phones for departments in room 268.
|
SELECT DPhone FROM DEPARTMENT WHERE Room = 268
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the number of students that have at least one grade "B".
|
SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = "B"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
How many students have had at least one "B" grade?
|
SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = "B"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the max and min grade point for all letter grade.
|
SELECT max(gradepoint) , min(gradepoint) FROM GRADECONVERSION
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the maximum and minumum grade points?
|
SELECT max(gradepoint) , min(gradepoint) FROM GRADECONVERSION
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the first names of students whose first names contain letter "a".
|
SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%'
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the first names for students who have an "a" in their first name?
|
SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%'
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the first names and last names of male (sex is M) faculties who live in building NEB.
|
SELECT Fname , Lname FROM FACULTY WHERE sex = "M" AND Building = "NEB"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the full names of faculties with sex M and who live in building NEB?
|
SELECT Fname , Lname FROM FACULTY WHERE sex = "M" AND Building = "NEB"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the rooms of faculties with rank professor who live in building NEB.
|
SELECT Room FROM FACULTY WHERE Rank = "Professor" AND Building = "NEB"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the rooms for members of the faculty who are professors and who live in building NEB?
|
SELECT Room FROM FACULTY WHERE Rank = "Professor" AND Building = "NEB"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the department name that is in Building "Mergenthaler".
|
SELECT DName FROM DEPARTMENT WHERE Building = "Mergenthaler"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the name of the department in the Building Mergenthaler?
|
SELECT DName FROM DEPARTMENT WHERE Building = "Mergenthaler"
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
List all information about courses sorted by credits in the ascending order.
|
SELECT * FROM COURSE ORDER BY Credits
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is all the information about courses, ordered by credits ascending?
|
SELECT * FROM COURSE ORDER BY Credits
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
List the course name of courses sorted by credits.
|
SELECT CName FROM COURSE ORDER BY Credits
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the course names, ordered by credits?
|
SELECT CName FROM COURSE ORDER BY Credits
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the first name of students in the descending order of age.
|
SELECT Fname FROM STUDENT ORDER BY Age DESC
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the first names of students, ordered by age from greatest to least?
|
SELECT Fname FROM STUDENT ORDER BY Age DESC
|
easy
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the last name of female (sex is F) students in the descending order of age.
|
SELECT LName FROM STUDENT WHERE Sex = "F" ORDER BY Age DESC
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the last names of female students, ordered by age descending?
|
SELECT LName FROM STUDENT WHERE Sex = "F" ORDER BY Age DESC
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the last names of faculties in building Barton in alphabetic order.
|
SELECT Lname FROM FACULTY WHERE Building = "Barton" ORDER BY Lname
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the last names of faculty in building Barton, sorted by last name?
|
SELECT Lname FROM FACULTY WHERE Building = "Barton" ORDER BY Lname
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the first names of faculties of rank Professor in alphabetic order.
|
SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the first names for all faculty professors, ordered by first name?
|
SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the name of the department that has the biggest number of students minored in?
|
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the name of the department with the most students minoring in it?
|
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the name of the department that has no students minored in?
|
SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the name of the department htat has no students minoring in it?
|
SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the name of the department that has the fewest members.
|
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the name of the department with the fewest members?
|
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the rank of the faculty that the fewest faculties belong to.
|
SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the least common faculty rank?
|
SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the first and last names of the instructors who teach the top 3 number of courses?
|
SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the full names of the 3 instructors who teach the most courses?
|
SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Which building does the instructor who teaches the most number of courses live in?
|
SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Give the building that the instructor who teaches the greatest number of courses lives in.
|
SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
|
extra
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the name of courses that have at least five enrollments?
|
SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Give the names of the courses with at least five enrollments.
|
SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the first name and last name of the instructor of course that has course name
|
SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = "COMPUTER LITERACY"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What is the full name of the instructor who has a course named COMPUTER LITERACY?
|
SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = "COMPUTER LITERACY"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.
|
SELECT T2.Dname , T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the department name and room for the course INTRODUCTION TO COMPUTER SCIENCE?
|
SELECT T2.Dname , T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE"
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the student first and last names and grade points of all enrollments.
|
SELECT T3.Fname , T3.LName , T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the full names and gradepoints for all enrollments?
|
SELECT T3.Fname , T3.LName , T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the distinct student first names of all students that have grade point at least 3.8 in one course.
|
SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T2.gradepoint >= 3.8
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the distinct first names for students with a grade point of 3.8 or above in at least one course?
|
SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T2.gradepoint >= 3.8
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the full names of faculties who are members of department with department number 520.
|
SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the full names of faculty members who are a part of department 520?
|
SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the first names and last names of the students that minor in the department with DNO 140.
|
SELECT T2.Fname , T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the full names of students minoring in department 140?
|
SELECT T2.Fname , T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140
|
medium
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the last names of faculties who are members of computer science department.
|
SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = "Computer Science"
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
What are the last names of faculty who are part of the computer science department?
|
SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = "Computer Science"
|
hard
|
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); CREATE TABLE Department (DNO number, Division text, DName text, Room text, Building text, DPhone number); CREATE TABLE Member_of (FacID number, DNO number, Appt_Type text); CREATE TABLE Course (CID text, CName text, Credits number, Instructor number, Days text, Hours text, DNO number); CREATE TABLE Minor_in (StuID number, DNO number); CREATE TABLE Enrolled_in (StuID number, CID text, Grade text); CREATE TABLE Gradeconversion (lettergrade text, gradepoint number);
|
Find the average grade point of student whose last name is Smith.
|
SELECT avg(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = "Smith"
|
hard
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.