db_id large_stringclasses 40
values | query large_stringlengths 22 608 | query_toks listlengths 4 75 | query_toks_no_value listlengths 4 101 | question large_stringlengths 22 185 | question_toks listlengths 5 36 | context large_stringclasses 40
values |
|---|---|---|---|---|---|---|
movie_2 | SELECT T1.title FROM movies AS T1 JOIN movietheaters AS T2 ON T1.code = T2.movie WHERE T2.name = 'Odeon' | [
"SELECT",
"T1.title",
"FROM",
"movies",
"AS",
"T1",
"JOIN",
"movietheaters",
"AS",
"T2",
"ON",
"T1.code",
"=",
"T2.movie",
"WHERE",
"T2.name",
"=",
"'Odeon",
"'"
] | [
"select",
"t1",
".",
"title",
"from",
"movies",
"as",
"t1",
"join",
"movietheaters",
"as",
"t2",
"on",
"t1",
".",
"code",
"=",
"t2",
".",
"movie",
"where",
"t2",
".",
"name",
"=",
"value"
] | What are the movie titles for ones that are played in the Odeon theater? | [
"What",
"are",
"the",
"movie",
"titles",
"for",
"ones",
"that",
"are",
"played",
"in",
"the",
"Odeon",
"theater",
"?"
] | CREATE TABLE Movies (
Code NUMBER PRIMARY KEY,
Title TEXT,
Rating TEXT
);
CREATE TABLE MovieTheaters (
Code NUMBER PRIMARY KEY,
Name TEXT,
Movie NUMBER,
FOREIGN KEY (Movie) REFERENCES Movies(Code)
); |
boat_1 | SELECT AVG(age) FROM Sailors WHERE rating = 7 | [
"SELECT",
"AVG",
"(",
"age",
")",
"FROM",
"Sailors",
"WHERE",
"rating",
"=",
"7"
] | [
"select",
"avg",
"(",
"age",
")",
"from",
"sailors",
"where",
"rating",
"=",
"value"
] | What is average age of all sailors who have a rating of 7? | [
"What",
"is",
"average",
"age",
"of",
"all",
"sailors",
"who",
"have",
"a",
"rating",
"of",
"7",
"?"
] | CREATE TABLE Sailors (
sid NUMBER PRIMARY KEY,
name TEXT,
rating NUMBER,
age NUMBER
);
CREATE TABLE Boats (
bid NUMBER PRIMARY KEY,
name TEXT,
color TEXT
);
CREATE TABLE Reserves (
sid NUMBER,
bid NUMBER,
day TEXT,
FOREIGN KEY (bid) REFERENCES Boats(bid),
FOREIGN KEY (sid) REFERENCES Sailors(sid)
); |
car_racing | SELECT avg(T2.age) FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T1.Official_native_language = "English" | [
"SELECT",
"avg",
"(",
"T2.age",
")",
"FROM",
"country",
"AS",
"T1",
"JOIN",
"driver",
"AS",
"T2",
"ON",
"T1.Country_ID",
"=",
"T2.Country",
"WHERE",
"T1.Official_native_language",
"=",
"``",
"English",
"''"
] | [
"select",
"avg",
"(",
"t2",
".",
"age",
")",
"from",
"country",
"as",
"t1",
"join",
"driver",
"as",
"t2",
"on",
"t1",
".",
"country_id",
"=",
"t2",
".",
"country",
"where",
"t1",
".",
"official_native_language",
"=",
"value"
] | What is the average age of drivers from countries with official native language "English" | [
"What",
"is",
"the",
"average",
"age",
"of",
"drivers",
"from",
"countries",
"with",
"official",
"native",
"language",
"``",
"English",
"''"
] | CREATE TABLE country (
Country_Id NUMBER PRIMARY KEY,
Country TEXT,
Capital TEXT,
Official_native_language TEXT,
Regoin TEXT
);
CREATE TABLE team (
Team_ID NUMBER PRIMARY KEY,
Team TEXT,
Make TEXT,
Manager TEXT,
Sponsor TEXT,
Car_Owner TEXT
);
CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver TEXT,
Country NUMBER,
Age NUMBER,
Car_# NUMBER,
Make TEXT,
Points TEXT,
Laps NUMBER,
Winnings TEXT
);
CREATE TABLE team_driver (
Team_ID NUMBER PRIMARY KEY,
Driver_ID NUMBER,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID),
FOREIGN KEY (Team_ID) REFERENCES team(Team_ID)
); |
real_estate_rentals | SELECT first_name , middle_name , last_name FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id = T2.user_id WHERE T1.property_address_id = T2.user_address_id; | [
"SELECT",
"first_name",
",",
"middle_name",
",",
"last_name",
"FROM",
"Properties",
"AS",
"T1",
"JOIN",
"Users",
"AS",
"T2",
"ON",
"T1.owner_user_id",
"=",
"T2.user_id",
"WHERE",
"T1.property_address_id",
"=",
"T2.user_address_id",
";"
] | [
"select",
"first_name",
",",
"middle_name",
",",
"last_name",
"from",
"properties",
"as",
"t1",
"join",
"users",
"as",
"t2",
"on",
"t1",
".",
"owner_user_id",
"=",
"t2",
".",
"user_id",
"where",
"t1",
".",
"property_address_id",
"=",
"t2",
".",
"user_address... | What are the first, middle and last names of users who own the property they live in? | [
"What",
"are",
"the",
"first",
",",
"middle",
"and",
"last",
"names",
"of",
"users",
"who",
"own",
"the",
"property",
"they",
"live",
"in",
"?"
] | CREATE TABLE Ref_Age_Categories (
age_category_code TEXT PRIMARY KEY,
age_category_description TEXT
);
CREATE TABLE Ref_Property_Types (
property_type_code TEXT PRIMARY KEY,
property_type_description TEXT
);
CREATE TABLE Ref_Room_Types (
room_type_code TEXT PRIMARY KEY,
room_type_description TEXT
);
CREATE TABLE Ref_User_Categories (
user_category_code TEXT PRIMARY KEY,
user_category_description TEXT
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
line_1_number_building TEXT,
line_2_number_street TEXT,
line_3_area_locality TEXT,
town_city TEXT,
zip_postcode TEXT,
county_state_province TEXT,
country TEXT,
other_address_details TEXT
);
CREATE TABLE Features (
feature_id NUMBER PRIMARY KEY,
feature_name TEXT,
feature_description TEXT
);
CREATE TABLE Users (
user_id NUMBER PRIMARY KEY,
age_category_code TEXT,
user_category_code TEXT,
user_address_id NUMBER,
is_buyer TEXT,
is_seller TEXT,
login_name TEXT,
password TEXT,
date_registered TIME,
first_name TEXT,
middle_name TEXT,
last_name TEXT,
other_user_details TEXT
);
CREATE TABLE Properties (
property_id NUMBER PRIMARY KEY,
property_address_id NUMBER,
owner_user_id NUMBER,
property_type_code TEXT,
date_on_market TIME,
date_off_market TIME,
property_name TEXT,
property_description TEXT,
garage_yn TEXT,
parking_lots TEXT,
room_count TEXT,
vendor_requested_price NUMBER,
price_min NUMBER,
price_max NUMBER,
other_property_details TEXT,
FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code),
FOREIGN KEY (property_address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (owner_user_id) REFERENCES Users(user_id)
);
CREATE TABLE Property_Features (
property_id NUMBER,
feature_id NUMBER,
feature_value TEXT,
property_feature_description TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (feature_id) REFERENCES Features(feature_id)
);
CREATE TABLE Property_Photos (
property_id NUMBER,
photo_seq NUMBER,
photo_title TEXT,
photo_description TEXT,
photo_filename TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Rooms (
property_id NUMBER,
room_number TEXT,
room_type_code TEXT,
room_size TEXT,
other_room_details TEXT,
FOREIGN KEY (room_type_code) REFERENCES Ref_Room_Types(room_type_code),
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE User_Property_History (
user_id NUMBER,
property_id NUMBER,
datestamp TIME,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE User_Searches (
user_id NUMBER,
search_seq NUMBER,
search_datetime TIME,
search_string TEXT,
FOREIGN KEY (user_id) REFERENCES Users(user_id)
); |
car_road_race | SELECT T1.Driver_Name , COUNT(*) FROM driver AS T1 JOIN race AS T2 ON T1.Driver_ID = T2.Driver_ID GROUP BY T1.Driver_ID | [
"SELECT",
"T1.Driver_Name",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"driver",
"AS",
"T1",
"JOIN",
"race",
"AS",
"T2",
"ON",
"T1.Driver_ID",
"=",
"T2.Driver_ID",
"GROUP",
"BY",
"T1.Driver_ID"
] | [
"select",
"t1",
".",
"driver_name",
",",
"count",
"(",
"*",
")",
"from",
"driver",
"as",
"t1",
"join",
"race",
"as",
"t2",
"on",
"t1",
".",
"driver_id",
"=",
"t2",
".",
"driver_id",
"group",
"by",
"t1",
".",
"driver_id"
] | Please show the names of drivers and the number of races they participate in. | [
"Please",
"show",
"the",
"names",
"of",
"drivers",
"and",
"the",
"number",
"of",
"races",
"they",
"participate",
"in",
"."
] | CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver_Name TEXT,
Entrant TEXT,
Constructor TEXT,
Chassis TEXT,
Engine TEXT,
Age NUMBER
);
CREATE TABLE race (
Road NUMBER PRIMARY KEY,
Driver_ID NUMBER,
Race_Name TEXT,
Pole_Position TEXT,
Fastest_Lap TEXT,
Winning_driver TEXT,
Winning_team TEXT,
Report TEXT,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID)
); |
address_1 | SELECT count(*) FROM City AS T1 JOIN Student AS T2 ON T1.city_code = T2.city_code WHERE T1.country = "CHINA" | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"City",
"AS",
"T1",
"JOIN",
"Student",
"AS",
"T2",
"ON",
"T1.city_code",
"=",
"T2.city_code",
"WHERE",
"T1.country",
"=",
"``",
"CHINA",
"''"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"city",
"as",
"t1",
"join",
"student",
"as",
"t2",
"on",
"t1",
".",
"city_code",
"=",
"t2",
".",
"city_code",
"where",
"t1",
".",
"country",
"=",
"value"
] | Count the number of students living in China. | [
"Count",
"the",
"number",
"of",
"students",
"living",
"in",
"China",
"."
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
cre_Students_Information_Systems | SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) >= 2 UNION SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Detention AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) < 2 | [
"SELECT",
"T1.bio_data",
",",
"T1.student_id",
"FROM",
"Students",
"AS",
"T1",
"JOIN",
"Classes",
"AS",
"T2",
"ON",
"T1.student_id",
"=",
"T2.student_id",
"GROUP",
"BY",
"T1.student_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2",
"UNION",
"SELECT",
"T1... | [
"select",
"t1",
".",
"bio_data",
",",
"t1",
".",
"student_id",
"from",
"students",
"as",
"t1",
"join",
"classes",
"as",
"t2",
"on",
"t1",
".",
"student_id",
"=",
"t2",
".",
"student_id",
"group",
"by",
"t1",
".",
"student_id",
"having",
"count",
"(",
"... | List the biographical data and student id for the students who take 2 or more classes and the students who have less than 2 detentions. | [
"List",
"the",
"biographical",
"data",
"and",
"student",
"id",
"for",
"the",
"students",
"who",
"take",
"2",
"or",
"more",
"classes",
"and",
"the",
"students",
"who",
"have",
"less",
"than",
"2",
"detentions",
"."
] | CREATE TABLE Students (
student_id NUMBER PRIMARY KEY,
bio_data TEXT,
student_details TEXT
);
CREATE TABLE Transcripts (
transcript_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_transcript TIME,
transcript_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behaviour_Monitoring (
behaviour_monitoring_id NUMBER PRIMARY KEY,
student_id NUMBER,
behaviour_monitoring_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Ref_Event_Types (
event_type_code TEXT PRIMARY KEY,
event_type_description TEXT
);
CREATE TABLE Ref_Achievement_Type (
achievement_type_code TEXT PRIMARY KEY,
achievement_type_description TEXT
);
CREATE TABLE Ref_Address_Types (
address_type_code TEXT PRIMARY KEY,
address_type_description TEXT
);
CREATE TABLE Ref_Detention_Type (
detention_type_code TEXT PRIMARY KEY,
detention_type_description TEXT
);
CREATE TABLE Student_Events (
event_id NUMBER PRIMARY KEY,
event_type_code TEXT,
student_id NUMBER,
event_date TIME,
other_details TEXT,
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types(event_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Teachers (
teacher_id NUMBER PRIMARY KEY,
teacher_details TEXT
);
CREATE TABLE Student_Loans (
student_loan_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_loan TIME,
amount_of_loan NUMBER,
other_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Classes (
class_id NUMBER PRIMARY KEY,
student_id NUMBER,
teacher_id NUMBER,
class_details TEXT,
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Students_Addresses (
student_address_id NUMBER PRIMARY KEY,
address_id NUMBER,
address_type_code TEXT,
student_id NUMBER,
date_from TIME,
date_to TIME,
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types(address_type_code),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Detention (
detention_id NUMBER PRIMARY KEY,
detention_type_code TEXT,
student_id NUMBER,
datetime_detention_start TIME,
datetime_detention_end TIME,
detention_summary TEXT,
other_details TEXT,
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Achievements (
achievement_id NUMBER PRIMARY KEY,
achievement_type_code TEXT,
student_id NUMBER,
date_achievement TIME,
achievement_details TEXT,
other_details TEXT,
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type(achievement_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
); |
vehicle_rent | SELECT name , model_year FROM vehicles WHERE city_fuel_economy_rate <= highway_fuel_economy_rate | [
"SELECT",
"name",
",",
"model_year",
"FROM",
"vehicles",
"WHERE",
"city_fuel_economy_rate",
"<",
"=",
"highway_fuel_economy_rate"
] | [
"select",
"name",
",",
"model_year",
"from",
"vehicles",
"where",
"city_fuel_economy_rate",
"<",
"=",
"highway_fuel_economy_rate"
] | Show name and model year for vehicles with city fuel economy rate less than or equal to highway fuel economy rate. | [
"Show",
"name",
"and",
"model",
"year",
"for",
"vehicles",
"with",
"city",
"fuel",
"economy",
"rate",
"less",
"than",
"or",
"equal",
"to",
"highway",
"fuel",
"economy",
"rate",
"."
] | CREATE TABLE Customers (
id NUMBER PRIMARY KEY,
name TEXT,
age NUMBER,
membership_credit NUMBER
);
CREATE TABLE Discount (
id NUMBER PRIMARY KEY,
name TEXT,
membership_credit NUMBER
);
CREATE TABLE Vehicles (
id NUMBER PRIMARY KEY,
name TEXT,
Model_year NUMBER,
Type_of_powertrain TEXT,
Combined_fuel_economy_rate NUMBER,
City_fuel_economy_rate NUMBER,
Highway_fuel_economy_rate NUMBER,
Cost_per_25_miles NUMBER,
Annual_fuel_cost NUMBER,
Notes TEXT
);
CREATE TABLE Renting_history (
id NUMBER PRIMARY KEY,
customer_id NUMBER,
discount_id NUMBER,
vehicles_id NUMBER,
total_hours NUMBER,
FOREIGN KEY (discount_id) REFERENCES Discount(id),
FOREIGN KEY (vehicles_id) REFERENCES Vehicles(id),
FOREIGN KEY (customer_id) REFERENCES Customers(id)
); |
bike_racing | SELECT T1.id , T1.name FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id = T2.cyclist_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"T1.id",
",",
"T1.name",
"FROM",
"cyclist",
"AS",
"T1",
"JOIN",
"cyclists_own_bikes",
"AS",
"T2",
"ON",
"T1.id",
"=",
"T2.cyclist_id",
"GROUP",
"BY",
"T1.id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t1",
".",
"id",
",",
"t1",
".",
"name",
"from",
"cyclist",
"as",
"t1",
"join",
"cyclists_own_bikes",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"cyclist_id",
"group",
"by",
"t1",
".",
"id",
"order",
"by",
"count",
"(",
"*",
")",
... | What are the id and name of the cyclist who owns the most bikes? | [
"What",
"are",
"the",
"id",
"and",
"name",
"of",
"the",
"cyclist",
"who",
"owns",
"the",
"most",
"bikes",
"?"
] | CREATE TABLE bike (
id NUMBER PRIMARY KEY,
product_name TEXT,
weight NUMBER,
price NUMBER,
material TEXT
);
CREATE TABLE cyclist (
id NUMBER PRIMARY KEY,
heat NUMBER,
name TEXT,
nation TEXT,
result NUMBER
);
CREATE TABLE cyclists_own_bikes (
cyclist_id NUMBER PRIMARY KEY,
bike_id NUMBER,
purchase_year NUMBER,
FOREIGN KEY (bike_id) REFERENCES bike(id),
FOREIGN KEY (cyclist_id) REFERENCES cyclist(id)
); |
customers_and_orders | SELECT product_name FROM Products WHERE product_type_code = "Clothes" ORDER BY product_price DESC LIMIT 1 | [
"SELECT",
"product_name",
"FROM",
"Products",
"WHERE",
"product_type_code",
"=",
"``",
"Clothes",
"''",
"ORDER",
"BY",
"product_price",
"DESC",
"LIMIT",
"1"
] | [
"select",
"product_name",
"from",
"products",
"where",
"product_type_code",
"=",
"value",
"order",
"by",
"product_price",
"desc",
"limit",
"value"
] | What is the name of the most expensive product with type Clothes? | [
"What",
"is",
"the",
"name",
"of",
"the",
"most",
"expensive",
"product",
"with",
"type",
"Clothes",
"?"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
product_type_code TEXT,
product_name TEXT,
product_price NUMBER
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
address_id NUMBER,
payment_method_code TEXT,
customer_number TEXT,
customer_name TEXT,
customer_address TEXT,
customer_phone TEXT,
customer_email TEXT
);
CREATE TABLE Customer_Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_date TIME,
order_status_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER,
order_id NUMBER,
product_id NUMBER,
order_quantity TEXT,
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id)
); |
cre_Doc_Workflow | SELECT author_name FROM Authors | [
"SELECT",
"author_name",
"FROM",
"Authors"
] | [
"select",
"author_name",
"from",
"authors"
] | Show all author names. | [
"Show",
"all",
"author",
"names",
"."
] | CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
staff_details TEXT
);
CREATE TABLE Ref_Staff_Roles (
staff_role_code TEXT PRIMARY KEY,
staff_role_description TEXT
);
CREATE TABLE Process_Outcomes (
process_outcome_code TEXT PRIMARY KEY,
process_outcome_description TEXT
);
CREATE TABLE Process_Status (
process_status_code TEXT PRIMARY KEY,
process_status_description TEXT
);
CREATE TABLE Authors (
author_name TEXT PRIMARY KEY,
other_details TEXT
);
CREATE TABLE Documents (
document_id NUMBER PRIMARY KEY,
author_name TEXT,
document_name TEXT,
document_description TEXT,
other_details TEXT,
FOREIGN KEY (author_name) REFERENCES Authors(author_name)
);
CREATE TABLE Business_Processes (
process_id NUMBER PRIMARY KEY,
next_process_id NUMBER,
process_name TEXT,
process_description TEXT,
other_details TEXT
);
CREATE TABLE Documents_Processes (
document_id NUMBER PRIMARY KEY,
process_id NUMBER,
process_outcome_code TEXT,
process_status_code TEXT,
FOREIGN KEY (process_status_code) REFERENCES Process_Status(process_status_code),
FOREIGN KEY (process_outcome_code) REFERENCES Process_Outcomes(process_outcome_code),
FOREIGN KEY (process_id) REFERENCES Business_Processes(process_id),
FOREIGN KEY (document_id) REFERENCES Documents(document_id)
);
CREATE TABLE Staff_in_Processes (
document_id NUMBER PRIMARY KEY,
process_id NUMBER,
staff_id NUMBER,
staff_role_code TEXT,
date_from TIME,
date_to TIME,
other_details TEXT,
FOREIGN KEY (staff_role_code) REFERENCES Ref_Staff_Roles(staff_role_code),
FOREIGN KEY (document_id) REFERENCES Documents_Processes(document_id),
FOREIGN KEY (process_id) REFERENCES Documents_Processes(process_id),
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id)
); |
region_building | SELECT avg(Population) FROM region | [
"SELECT",
"avg",
"(",
"Population",
")",
"FROM",
"region"
] | [
"select",
"avg",
"(",
"population",
")",
"from",
"region"
] | What is the average population for all regions? | [
"What",
"is",
"the",
"average",
"population",
"for",
"all",
"regions",
"?"
] | CREATE TABLE building (
Building_ID NUMBER PRIMARY KEY,
Region_ID NUMBER,
Name TEXT,
Address TEXT,
Number_of_Stories NUMBER,
Completed_Year NUMBER,
FOREIGN KEY (Region_ID) REFERENCES region(Region_ID)
);
CREATE TABLE region (
Region_ID NUMBER PRIMARY KEY,
Name TEXT,
Capital TEXT,
Area NUMBER,
Population NUMBER
); |
advertising_agencies | SELECT agency_id , count(*) FROM Staff GROUP BY agency_id | [
"SELECT",
"agency_id",
",",
"count",
"(",
"*",
")",
"FROM",
"Staff",
"GROUP",
"BY",
"agency_id"
] | [
"select",
"agency_id",
",",
"count",
"(",
"*",
")",
"from",
"staff",
"group",
"by",
"agency_id"
] | Show the agency ids and the number of staff in each agent? | [
"Show",
"the",
"agency",
"ids",
"and",
"the",
"number",
"of",
"staff",
"in",
"each",
"agent",
"?"
] | CREATE TABLE Agencies (
agency_id NUMBER PRIMARY KEY,
agency_details TEXT
);
CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
agency_id NUMBER,
staff_details TEXT
);
CREATE TABLE Clients (
client_id NUMBER PRIMARY KEY,
agency_id NUMBER,
sic_code TEXT,
client_details TEXT,
FOREIGN KEY (agency_id) REFERENCES Agencies(agency_id)
);
CREATE TABLE Invoices (
invoice_id NUMBER PRIMARY KEY,
client_id NUMBER,
invoice_status TEXT,
invoice_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Meetings (
meeting_id NUMBER PRIMARY KEY,
client_id NUMBER,
meeting_outcome TEXT,
meeting_type TEXT,
billable_yn TEXT,
start_date_time TIME,
end_date_time TIME,
purpose_of_meeting TEXT,
other_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Payments (
payment_id NUMBER,
invoice_id NUMBER,
payment_details TEXT,
FOREIGN KEY (invoice_id) REFERENCES Invoices(invoice_id)
);
CREATE TABLE Staff_in_Meetings (
meeting_id NUMBER,
staff_id NUMBER,
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (meeting_id) REFERENCES Meetings(meeting_id)
); |
soccer_3 | SELECT Country FROM player GROUP BY Country HAVING COUNT(*) > 1 | [
"SELECT",
"Country",
"FROM",
"player",
"GROUP",
"BY",
"Country",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] | [
"select",
"country",
"from",
"player",
"group",
"by",
"country",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | List the country that have more than one player. | [
"List",
"the",
"country",
"that",
"have",
"more",
"than",
"one",
"player",
"."
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
warehouse_1 | SELECT sum(capacity) FROM warehouses | [
"SELECT",
"sum",
"(",
"capacity",
")",
"FROM",
"warehouses"
] | [
"select",
"sum",
"(",
"capacity",
")",
"from",
"warehouses"
] | What is the total capacity of all warehouses? | [
"What",
"is",
"the",
"total",
"capacity",
"of",
"all",
"warehouses",
"?"
] | CREATE TABLE Warehouses (
Code NUMBER PRIMARY KEY,
Location TEXT,
Capacity NUMBER
);
CREATE TABLE Boxes (
Code TEXT PRIMARY KEY,
Contents TEXT,
Value NUMBER,
Warehouse NUMBER,
FOREIGN KEY (Warehouse) REFERENCES Warehouses(Code)
); |
soccer_3 | SELECT Manufacturer FROM club GROUP BY Manufacturer HAVING COUNT(*) > 1 | [
"SELECT",
"Manufacturer",
"FROM",
"club",
"GROUP",
"BY",
"Manufacturer",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] | [
"select",
"manufacturer",
"from",
"club",
"group",
"by",
"manufacturer",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | List the manufacturers that are associated with more than one club. | [
"List",
"the",
"manufacturers",
"that",
"are",
"associated",
"with",
"more",
"than",
"one",
"club",
"."
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
bakery_1 | SELECT id FROM goods WHERE id LIKE "%APP%" | [
"SELECT",
"id",
"FROM",
"goods",
"WHERE",
"id",
"LIKE",
"``",
"%",
"APP",
"%",
"''"
] | [
"select",
"id",
"from",
"goods",
"where",
"id",
"like",
"value"
] | Give me the list of ids of all goods whose id has "APP". | [
"Give",
"me",
"the",
"list",
"of",
"ids",
"of",
"all",
"goods",
"whose",
"id",
"has",
"``",
"APP",
"''",
"."
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
art_1 | SELECT T2.title FROM artists AS T1 JOIN paintings AS T2 ON T1.artistID = T2.painterID WHERE T1.artistID = 222 UNION SELECT T4.title FROM artists AS T3 JOIN sculptures AS T4 ON T3.artistID = T4.sculptorID WHERE T3.artistID = 222 | [
"SELECT",
"T2.title",
"FROM",
"artists",
"AS",
"T1",
"JOIN",
"paintings",
"AS",
"T2",
"ON",
"T1.artistID",
"=",
"T2.painterID",
"WHERE",
"T1.artistID",
"=",
"222",
"UNION",
"SELECT",
"T4.title",
"FROM",
"artists",
"AS",
"T3",
"JOIN",
"sculptures",
"AS",
"T4",
... | [
"select",
"t2",
".",
"title",
"from",
"artists",
"as",
"t1",
"join",
"paintings",
"as",
"t2",
"on",
"t1",
".",
"artistid",
"=",
"t2",
".",
"painterid",
"where",
"t1",
".",
"artistid",
"=",
"value",
"union",
"select",
"t4",
".",
"title",
"from",
"artist... | What are the titles of all paintings and sculpture works made by the artist whose id is 222? | [
"What",
"are",
"the",
"titles",
"of",
"all",
"paintings",
"and",
"sculpture",
"works",
"made",
"by",
"the",
"artist",
"whose",
"id",
"is",
"222",
"?"
] | CREATE TABLE Artists (
artistID NUMBER PRIMARY KEY,
lname TEXT,
fname TEXT,
birthYear NUMBER,
deathYear NUMBER
);
CREATE TABLE Paintings (
paintingID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
height_mm NUMBER,
width_mm NUMBER,
medium TEXT,
mediumOn TEXT,
location TEXT,
painterID NUMBER,
FOREIGN KEY (painterID) REFERENCES Artists(artistID)
);
CREATE TABLE Sculptures (
sculptureID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
medium TEXT,
location TEXT,
sculptorID NUMBER,
FOREIGN KEY (sculptorID) REFERENCES Artists(artistID)
); |
restaurant_bills | SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID | [
"SELECT",
"T1.Name",
",",
"T2.Dish_Name",
"FROM",
"customer",
"AS",
"T1",
"JOIN",
"customer_order",
"AS",
"T2",
"ON",
"T1.Customer_ID",
"=",
"T2.Customer_ID"
] | [
"select",
"t1",
".",
"name",
",",
"t2",
".",
"dish_name",
"from",
"customer",
"as",
"t1",
"join",
"customer_order",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id"
] | Show the names of customers and names of dishes they order. | [
"Show",
"the",
"names",
"of",
"customers",
"and",
"names",
"of",
"dishes",
"they",
"order",
"."
] | CREATE TABLE customer (
Customer_ID NUMBER PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Card_Credit NUMBER,
Level_of_Membership NUMBER
);
CREATE TABLE branch (
Branch_ID NUMBER PRIMARY KEY,
Manager TEXT,
Years_opened NUMBER,
Location_of_office TEXT
);
CREATE TABLE customer_order (
Customer_ID NUMBER PRIMARY KEY,
Branch_ID NUMBER,
Dish_Name TEXT,
Quantity NUMBER,
FOREIGN KEY (Branch_ID) REFERENCES branch(Branch_ID),
FOREIGN KEY (Customer_ID) REFERENCES customer(Customer_ID)
); |
cre_Students_Information_Systems | select bio_data from students where student_id not in (select t1.student_id from students as t1 join detention as t2 on t1.student_id = t2.student_id union select t1.student_id from students as t1 join student_loans as t2 on t1.student_id = t2.student_id) | [
"select",
"bio_data",
"from",
"students",
"where",
"student_id",
"not",
"in",
"(",
"select",
"t1.student_id",
"from",
"students",
"as",
"t1",
"join",
"detention",
"as",
"t2",
"on",
"t1.student_id",
"=",
"t2.student_id",
"union",
"select",
"t1.student_id",
"from",
... | [
"select",
"bio_data",
"from",
"students",
"where",
"student_id",
"not",
"in",
"(",
"select",
"t1",
".",
"student_id",
"from",
"students",
"as",
"t1",
"join",
"detention",
"as",
"t2",
"on",
"t1",
".",
"student_id",
"=",
"t2",
".",
"student_id",
"union",
"se... | Which students never had a detention or student loan ? Find their biographical data . | [
"Which",
"students",
"never",
"had",
"a",
"detention",
"or",
"student",
"loan",
"?",
"Find",
"their",
"biographical",
"data",
"."
] | CREATE TABLE Students (
student_id NUMBER PRIMARY KEY,
bio_data TEXT,
student_details TEXT
);
CREATE TABLE Transcripts (
transcript_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_transcript TIME,
transcript_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behaviour_Monitoring (
behaviour_monitoring_id NUMBER PRIMARY KEY,
student_id NUMBER,
behaviour_monitoring_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Ref_Event_Types (
event_type_code TEXT PRIMARY KEY,
event_type_description TEXT
);
CREATE TABLE Ref_Achievement_Type (
achievement_type_code TEXT PRIMARY KEY,
achievement_type_description TEXT
);
CREATE TABLE Ref_Address_Types (
address_type_code TEXT PRIMARY KEY,
address_type_description TEXT
);
CREATE TABLE Ref_Detention_Type (
detention_type_code TEXT PRIMARY KEY,
detention_type_description TEXT
);
CREATE TABLE Student_Events (
event_id NUMBER PRIMARY KEY,
event_type_code TEXT,
student_id NUMBER,
event_date TIME,
other_details TEXT,
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types(event_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Teachers (
teacher_id NUMBER PRIMARY KEY,
teacher_details TEXT
);
CREATE TABLE Student_Loans (
student_loan_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_loan TIME,
amount_of_loan NUMBER,
other_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Classes (
class_id NUMBER PRIMARY KEY,
student_id NUMBER,
teacher_id NUMBER,
class_details TEXT,
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Students_Addresses (
student_address_id NUMBER PRIMARY KEY,
address_id NUMBER,
address_type_code TEXT,
student_id NUMBER,
date_from TIME,
date_to TIME,
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types(address_type_code),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Detention (
detention_id NUMBER PRIMARY KEY,
detention_type_code TEXT,
student_id NUMBER,
datetime_detention_start TIME,
datetime_detention_end TIME,
detention_summary TEXT,
other_details TEXT,
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Achievements (
achievement_id NUMBER PRIMARY KEY,
achievement_type_code TEXT,
student_id NUMBER,
date_achievement TIME,
achievement_details TEXT,
other_details TEXT,
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type(achievement_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
); |
video_game | SELECT Player_name FROM player ORDER BY Player_name ASC | [
"SELECT",
"Player_name",
"FROM",
"player",
"ORDER",
"BY",
"Player_name",
"ASC"
] | [
"select",
"player_name",
"from",
"player",
"order",
"by",
"player_name",
"asc"
] | What are the names of all players in alphabetical order? | [
"What",
"are",
"the",
"names",
"of",
"all",
"players",
"in",
"alphabetical",
"order",
"?"
] | CREATE TABLE platform (
Platform_ID NUMBER PRIMARY KEY,
Platform_name TEXT,
Market_district TEXT,
Download_rank NUMBER
);
CREATE TABLE game (
Game_ID NUMBER PRIMARY KEY,
Title TEXT,
Release_Date TEXT,
Franchise TEXT,
Developers TEXT,
Platform_ID NUMBER,
Units_sold_Millions NUMBER,
FOREIGN KEY (Platform_ID) REFERENCES platform(Platform_ID)
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Rank_of_the_year NUMBER,
Player_name TEXT,
Position TEXT,
College TEXT
);
CREATE TABLE game_player (
Player_ID NUMBER PRIMARY KEY,
Game_ID NUMBER,
If_active OTHERS,
FOREIGN KEY (Game_ID) REFERENCES game(Game_ID),
FOREIGN KEY (Player_ID) REFERENCES player(Player_ID)
); |
online_exams | SELECT Exam_Date , Exam_Name FROM Exams WHERE Subject_Code != 'Database' | [
"SELECT",
"Exam_Date",
",",
"Exam_Name",
"FROM",
"Exams",
"WHERE",
"Subject_Code",
"!",
"=",
"'Database",
"'"
] | [
"select",
"exam_date",
",",
"exam_name",
"from",
"exams",
"where",
"subject_code",
"!",
"=",
"value"
] | Find the exams whose subject code is not "Database". What are the exam dates and exam names? | [
"Find",
"the",
"exams",
"whose",
"subject",
"code",
"is",
"not",
"``",
"Database",
"''",
".",
"What",
"are",
"the",
"exam",
"dates",
"and",
"exam",
"names",
"?"
] | CREATE TABLE Students (
Student_ID NUMBER PRIMARY KEY,
First_Name TEXT,
Middle_Name TEXT,
Last_Name TEXT,
Gender_MFU TEXT,
Student_Address TEXT,
Email_Adress TEXT,
Cell_Mobile_Phone TEXT,
Home_Phone TEXT
);
CREATE TABLE Questions (
Question_ID NUMBER PRIMARY KEY,
Type_of_Question_Code TEXT,
Question_Text TEXT
);
CREATE TABLE Exams (
Exam_ID NUMBER PRIMARY KEY,
Subject_Code TEXT,
Exam_Date TIME,
Exam_Name TEXT
);
CREATE TABLE Questions_in_Exams (
Exam_ID NUMBER PRIMARY KEY,
Question_ID NUMBER,
FOREIGN KEY (Exam_ID) REFERENCES Exams(Exam_ID),
FOREIGN KEY (Question_ID) REFERENCES Questions(Question_ID)
);
CREATE TABLE Valid_Answers (
Valid_Answer_ID NUMBER PRIMARY KEY,
Question_ID NUMBER,
Valid_Answer_Text TEXT,
FOREIGN KEY (Question_ID) REFERENCES Questions(Question_ID)
);
CREATE TABLE Student_Answers (
Student_Answer_ID NUMBER PRIMARY KEY,
Exam_ID NUMBER,
Question_ID NUMBER,
Student_ID NUMBER,
Date_of_Answer TIME,
Comments TEXT,
Satisfactory_YN TEXT,
Student_Answer_Text TEXT,
FOREIGN KEY (Exam_ID) REFERENCES Questions_in_Exams(Exam_ID),
FOREIGN KEY (Question_ID) REFERENCES Questions_in_Exams(Question_ID),
FOREIGN KEY (Student_ID) REFERENCES Students(Student_ID)
);
CREATE TABLE Student_Assessments (
Student_Answer_ID TEXT PRIMARY KEY,
Valid_Answer_ID NUMBER,
Student_Answer_Text TEXT,
Satisfactory_YN TEXT,
Assessment TEXT,
FOREIGN KEY (Valid_Answer_ID) REFERENCES Valid_Answers(Valid_Answer_ID)
); |
bakery_1 | SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.flavor = "Apple" AND T2.food = "Pie" UNION SELECT ReceiptNumber FROM receipts WHERE CustomerId = 12 | [
"SELECT",
"T1.receipt",
"FROM",
"items",
"AS",
"T1",
"JOIN",
"goods",
"AS",
"T2",
"ON",
"T1.item",
"=",
"T2.id",
"WHERE",
"T2.flavor",
"=",
"``",
"Apple",
"''",
"AND",
"T2.food",
"=",
"``",
"Pie",
"''",
"UNION",
"SELECT",
"ReceiptNumber",
"FROM",
"receipts... | [
"select",
"t1",
".",
"receipt",
"from",
"items",
"as",
"t1",
"join",
"goods",
"as",
"t2",
"on",
"t1",
".",
"item",
"=",
"t2",
".",
"id",
"where",
"t2",
".",
"flavor",
"=",
"value",
"and",
"t2",
".",
"food",
"=",
"value",
"union",
"select",
"receipt... | Find all receipts in which either apple flavor pie was bought or customer id 12 shopped. | [
"Find",
"all",
"receipts",
"in",
"which",
"either",
"apple",
"flavor",
"pie",
"was",
"bought",
"or",
"customer",
"id",
"12",
"shopped",
"."
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
planet_1 | SELECT Date FROM Shipment; | [
"SELECT",
"Date",
"FROM",
"Shipment",
";"
] | [
"select",
"date",
"from",
"shipment"
] | What are the dates of every shipment in the database? | [
"What",
"are",
"the",
"dates",
"of",
"every",
"shipment",
"in",
"the",
"database",
"?"
] | CREATE TABLE Employee (
EmployeeID NUMBER PRIMARY KEY,
Name TEXT,
Position TEXT,
Salary NUMBER,
Remarks TEXT
);
CREATE TABLE Planet (
PlanetID NUMBER PRIMARY KEY,
Name TEXT,
Coordinates NUMBER
);
CREATE TABLE Shipment (
ShipmentID NUMBER PRIMARY KEY,
Date TIME,
Manager NUMBER,
Planet NUMBER,
FOREIGN KEY (Planet) REFERENCES Planet(PlanetID),
FOREIGN KEY (Manager) REFERENCES Employee(EmployeeID)
);
CREATE TABLE Has_Clearance (
Employee NUMBER PRIMARY KEY,
Planet NUMBER,
Level NUMBER,
FOREIGN KEY (Planet) REFERENCES Planet(PlanetID),
FOREIGN KEY (Employee) REFERENCES Employee(EmployeeID)
);
CREATE TABLE Client (
AccountNumber NUMBER PRIMARY KEY,
Name TEXT
);
CREATE TABLE Package (
Shipment NUMBER PRIMARY KEY,
PackageNumber NUMBER,
Contents TEXT,
Weight NUMBER,
Sender NUMBER,
Recipient NUMBER,
FOREIGN KEY (Recipient) REFERENCES Client(AccountNumber),
FOREIGN KEY (Sender) REFERENCES Client(AccountNumber),
FOREIGN KEY (Shipment) REFERENCES Shipment(ShipmentID)
); |
art_1 | SELECT fname , deathYear - birthYear FROM artists ORDER BY deathYear - birthYear DESC LIMIT 1 | [
"SELECT",
"fname",
",",
"deathYear",
"-",
"birthYear",
"FROM",
"artists",
"ORDER",
"BY",
"deathYear",
"-",
"birthYear",
"DESC",
"LIMIT",
"1"
] | [
"select",
"fname",
",",
"deathyear",
"-",
"birthyear",
"from",
"artists",
"order",
"by",
"deathyear",
"-",
"birthyear",
"desc",
"limit",
"value"
] | What are the first name and age of the artist who had the longest life? | [
"What",
"are",
"the",
"first",
"name",
"and",
"age",
"of",
"the",
"artist",
"who",
"had",
"the",
"longest",
"life",
"?"
] | CREATE TABLE Artists (
artistID NUMBER PRIMARY KEY,
lname TEXT,
fname TEXT,
birthYear NUMBER,
deathYear NUMBER
);
CREATE TABLE Paintings (
paintingID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
height_mm NUMBER,
width_mm NUMBER,
medium TEXT,
mediumOn TEXT,
location TEXT,
painterID NUMBER,
FOREIGN KEY (painterID) REFERENCES Artists(artistID)
);
CREATE TABLE Sculptures (
sculptureID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
medium TEXT,
location TEXT,
sculptorID NUMBER,
FOREIGN KEY (sculptorID) REFERENCES Artists(artistID)
); |
vehicle_driver | SELECT avg(top_speed) FROM vehicle | [
"SELECT",
"avg",
"(",
"top_speed",
")",
"FROM",
"vehicle"
] | [
"select",
"avg",
"(",
"top_speed",
")",
"from",
"vehicle"
] | What is the average top speed of vehicles? | [
"What",
"is",
"the",
"average",
"top",
"speed",
"of",
"vehicles",
"?"
] | CREATE TABLE vehicle (
Vehicle_ID NUMBER PRIMARY KEY,
Model TEXT,
Build_Year TEXT,
Top_Speed NUMBER,
Power NUMBER,
Builder TEXT,
Total_Production TEXT
);
CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Name TEXT,
Citizenship TEXT,
Racing_Series TEXT
);
CREATE TABLE vehicle_driver (
Driver_ID NUMBER PRIMARY KEY,
Vehicle_ID NUMBER,
FOREIGN KEY (Vehicle_ID) REFERENCES vehicle(Vehicle_ID),
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID)
); |
cre_Doc_and_collections | SELECT Document_Object_ID , count(*) FROM Document_Subset_Members GROUP BY Document_Object_ID ORDER BY count(*) ASC LIMIT 1; | [
"SELECT",
"Document_Object_ID",
",",
"count",
"(",
"*",
")",
"FROM",
"Document_Subset_Members",
"GROUP",
"BY",
"Document_Object_ID",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"ASC",
"LIMIT",
"1",
";"
] | [
"select",
"document_object_id",
",",
"count",
"(",
"*",
")",
"from",
"document_subset_members",
"group",
"by",
"document_object_id",
"order",
"by",
"count",
"(",
"*",
")",
"asc",
"limit",
"value"
] | Which document has least number of related documents? List the document id and the number of related documents. | [
"Which",
"document",
"has",
"least",
"number",
"of",
"related",
"documents",
"?",
"List",
"the",
"document",
"id",
"and",
"the",
"number",
"of",
"related",
"documents",
"."
] | CREATE TABLE Document_Subsets (
Document_Subset_ID NUMBER PRIMARY KEY,
Document_Subset_Name TEXT,
Document_Subset_Details TEXT
);
CREATE TABLE Collection_Subsets (
Collection_Subset_ID NUMBER PRIMARY KEY,
Collection_Subset_Name TEXT,
Collecrtion_Subset_Details TEXT
);
CREATE TABLE Document_Objects (
Document_Object_ID NUMBER PRIMARY KEY,
Parent_Document_Object_ID NUMBER,
Owner TEXT,
Description TEXT,
Other_Details TEXT
);
CREATE TABLE Collections (
Collection_ID NUMBER PRIMARY KEY,
Parent_Collection_ID NUMBER,
Collection_Name TEXT,
Collection_Description TEXT
);
CREATE TABLE Documents_in_Collections (
Document_Object_ID NUMBER PRIMARY KEY,
Collection_ID NUMBER,
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Document_Subset_Members (
Document_Object_ID NUMBER PRIMARY KEY,
Related_Document_Object_ID NUMBER,
Document_Subset_ID NUMBER,
FOREIGN KEY (Document_Subset_ID) REFERENCES Document_Subsets(Document_Subset_ID),
FOREIGN KEY (Related_Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Collection_Subset_Members (
Collection_ID NUMBER PRIMARY KEY,
Related_Collection_ID NUMBER,
Collection_Subset_ID NUMBER,
FOREIGN KEY (Collection_Subset_ID) REFERENCES Collection_Subsets(Collection_Subset_ID),
FOREIGN KEY (Related_Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID)
); |
planet_1 | SELECT T1.PackageNumber , max(T1.Weight) FROM PACKAGE AS T1 JOIN Client AS T2 ON T1.Sender = T2.AccountNumber WHERE T2.Name LIKE "John"; | [
"SELECT",
"T1.PackageNumber",
",",
"max",
"(",
"T1.Weight",
")",
"FROM",
"PACKAGE",
"AS",
"T1",
"JOIN",
"Client",
"AS",
"T2",
"ON",
"T1.Sender",
"=",
"T2.AccountNumber",
"WHERE",
"T2.Name",
"LIKE",
"``",
"John",
"''",
";"
] | [
"select",
"t1",
".",
"packagenumber",
",",
"max",
"(",
"t1",
".",
"weight",
")",
"from",
"package",
"as",
"t1",
"join",
"client",
"as",
"t2",
"on",
"t1",
".",
"sender",
"=",
"t2",
".",
"accountnumber",
"where",
"t2",
".",
"name",
"like",
"value"
] | What is the package number and weight of the heaviest package that was sent by a client named John or something similar? | [
"What",
"is",
"the",
"package",
"number",
"and",
"weight",
"of",
"the",
"heaviest",
"package",
"that",
"was",
"sent",
"by",
"a",
"client",
"named",
"John",
"or",
"something",
"similar",
"?"
] | CREATE TABLE Employee (
EmployeeID NUMBER PRIMARY KEY,
Name TEXT,
Position TEXT,
Salary NUMBER,
Remarks TEXT
);
CREATE TABLE Planet (
PlanetID NUMBER PRIMARY KEY,
Name TEXT,
Coordinates NUMBER
);
CREATE TABLE Shipment (
ShipmentID NUMBER PRIMARY KEY,
Date TIME,
Manager NUMBER,
Planet NUMBER,
FOREIGN KEY (Planet) REFERENCES Planet(PlanetID),
FOREIGN KEY (Manager) REFERENCES Employee(EmployeeID)
);
CREATE TABLE Has_Clearance (
Employee NUMBER PRIMARY KEY,
Planet NUMBER,
Level NUMBER,
FOREIGN KEY (Planet) REFERENCES Planet(PlanetID),
FOREIGN KEY (Employee) REFERENCES Employee(EmployeeID)
);
CREATE TABLE Client (
AccountNumber NUMBER PRIMARY KEY,
Name TEXT
);
CREATE TABLE Package (
Shipment NUMBER PRIMARY KEY,
PackageNumber NUMBER,
Contents TEXT,
Weight NUMBER,
Sender NUMBER,
Recipient NUMBER,
FOREIGN KEY (Recipient) REFERENCES Client(AccountNumber),
FOREIGN KEY (Sender) REFERENCES Client(AccountNumber),
FOREIGN KEY (Shipment) REFERENCES Shipment(ShipmentID)
); |
real_estate_rentals | SELECT T1.line_1_number_building , T1.line_2_number_street , T1.town_city FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id = T2.user_address_id WHERE T2.user_category_code = 'Senior Citizen'; | [
"SELECT",
"T1.line_1_number_building",
",",
"T1.line_2_number_street",
",",
"T1.town_city",
"FROM",
"Addresses",
"AS",
"T1",
"JOIN",
"Users",
"AS",
"T2",
"ON",
"T1.address_id",
"=",
"T2.user_address_id",
"WHERE",
"T2.user_category_code",
"=",
"'Senior",
"Citizen",
"'",
... | [
"select",
"t1",
".",
"line_1_number_building",
",",
"t1",
".",
"line_2_number_street",
",",
"t1",
".",
"town_city",
"from",
"addresses",
"as",
"t1",
"join",
"users",
"as",
"t2",
"on",
"t1",
".",
"address_id",
"=",
"t2",
".",
"user_address_id",
"where",
"t2",... | What are the buildings, streets, and cities corresponding to the addresses of senior citizens? | [
"What",
"are",
"the",
"buildings",
",",
"streets",
",",
"and",
"cities",
"corresponding",
"to",
"the",
"addresses",
"of",
"senior",
"citizens",
"?"
] | CREATE TABLE Ref_Age_Categories (
age_category_code TEXT PRIMARY KEY,
age_category_description TEXT
);
CREATE TABLE Ref_Property_Types (
property_type_code TEXT PRIMARY KEY,
property_type_description TEXT
);
CREATE TABLE Ref_Room_Types (
room_type_code TEXT PRIMARY KEY,
room_type_description TEXT
);
CREATE TABLE Ref_User_Categories (
user_category_code TEXT PRIMARY KEY,
user_category_description TEXT
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
line_1_number_building TEXT,
line_2_number_street TEXT,
line_3_area_locality TEXT,
town_city TEXT,
zip_postcode TEXT,
county_state_province TEXT,
country TEXT,
other_address_details TEXT
);
CREATE TABLE Features (
feature_id NUMBER PRIMARY KEY,
feature_name TEXT,
feature_description TEXT
);
CREATE TABLE Users (
user_id NUMBER PRIMARY KEY,
age_category_code TEXT,
user_category_code TEXT,
user_address_id NUMBER,
is_buyer TEXT,
is_seller TEXT,
login_name TEXT,
password TEXT,
date_registered TIME,
first_name TEXT,
middle_name TEXT,
last_name TEXT,
other_user_details TEXT
);
CREATE TABLE Properties (
property_id NUMBER PRIMARY KEY,
property_address_id NUMBER,
owner_user_id NUMBER,
property_type_code TEXT,
date_on_market TIME,
date_off_market TIME,
property_name TEXT,
property_description TEXT,
garage_yn TEXT,
parking_lots TEXT,
room_count TEXT,
vendor_requested_price NUMBER,
price_min NUMBER,
price_max NUMBER,
other_property_details TEXT,
FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code),
FOREIGN KEY (property_address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (owner_user_id) REFERENCES Users(user_id)
);
CREATE TABLE Property_Features (
property_id NUMBER,
feature_id NUMBER,
feature_value TEXT,
property_feature_description TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (feature_id) REFERENCES Features(feature_id)
);
CREATE TABLE Property_Photos (
property_id NUMBER,
photo_seq NUMBER,
photo_title TEXT,
photo_description TEXT,
photo_filename TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Rooms (
property_id NUMBER,
room_number TEXT,
room_type_code TEXT,
room_size TEXT,
other_room_details TEXT,
FOREIGN KEY (room_type_code) REFERENCES Ref_Room_Types(room_type_code),
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE User_Property_History (
user_id NUMBER,
property_id NUMBER,
datestamp TIME,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE User_Searches (
user_id NUMBER,
search_seq NUMBER,
search_datetime TIME,
search_string TEXT,
FOREIGN KEY (user_id) REFERENCES Users(user_id)
); |
cre_Doc_and_collections | SELECT count(*) , T2.Document_Object_ID FROM Collections AS T1 JOIN Documents_in_Collections AS T2 ON T1.Collection_ID = T2.Collection_ID GROUP BY T2.Document_Object_ID | [
"SELECT",
"count",
"(",
"*",
")",
",",
"T2.Document_Object_ID",
"FROM",
"Collections",
"AS",
"T1",
"JOIN",
"Documents_in_Collections",
"AS",
"T2",
"ON",
"T1.Collection_ID",
"=",
"T2.Collection_ID",
"GROUP",
"BY",
"T2.Document_Object_ID"
] | [
"select",
"count",
"(",
"*",
")",
",",
"t2",
".",
"document_object_id",
"from",
"collections",
"as",
"t1",
"join",
"documents_in_collections",
"as",
"t2",
"on",
"t1",
".",
"collection_id",
"=",
"t2",
".",
"collection_id",
"group",
"by",
"t2",
".",
"document_... | How many collections does each document belong to? List the count and the document id. | [
"How",
"many",
"collections",
"does",
"each",
"document",
"belong",
"to",
"?",
"List",
"the",
"count",
"and",
"the",
"document",
"id",
"."
] | CREATE TABLE Document_Subsets (
Document_Subset_ID NUMBER PRIMARY KEY,
Document_Subset_Name TEXT,
Document_Subset_Details TEXT
);
CREATE TABLE Collection_Subsets (
Collection_Subset_ID NUMBER PRIMARY KEY,
Collection_Subset_Name TEXT,
Collecrtion_Subset_Details TEXT
);
CREATE TABLE Document_Objects (
Document_Object_ID NUMBER PRIMARY KEY,
Parent_Document_Object_ID NUMBER,
Owner TEXT,
Description TEXT,
Other_Details TEXT
);
CREATE TABLE Collections (
Collection_ID NUMBER PRIMARY KEY,
Parent_Collection_ID NUMBER,
Collection_Name TEXT,
Collection_Description TEXT
);
CREATE TABLE Documents_in_Collections (
Document_Object_ID NUMBER PRIMARY KEY,
Collection_ID NUMBER,
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Document_Subset_Members (
Document_Object_ID NUMBER PRIMARY KEY,
Related_Document_Object_ID NUMBER,
Document_Subset_ID NUMBER,
FOREIGN KEY (Document_Subset_ID) REFERENCES Document_Subsets(Document_Subset_ID),
FOREIGN KEY (Related_Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Collection_Subset_Members (
Collection_ID NUMBER PRIMARY KEY,
Related_Collection_ID NUMBER,
Collection_Subset_ID NUMBER,
FOREIGN KEY (Collection_Subset_ID) REFERENCES Collection_Subsets(Collection_Subset_ID),
FOREIGN KEY (Related_Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID)
); |
cre_Doc_and_collections | SELECT OWNER FROM Document_Objects WHERE Description = 'Braeden Collection' | [
"SELECT",
"OWNER",
"FROM",
"Document_Objects",
"WHERE",
"Description",
"=",
"'Braeden",
"Collection",
"'"
] | [
"select",
"owner",
"from",
"document_objects",
"where",
"description",
"=",
"value"
] | What are the owners of the document objects described as the 'Braeden Collection'? | [
"What",
"are",
"the",
"owners",
"of",
"the",
"document",
"objects",
"described",
"as",
"the",
"'Braeden",
"Collection",
"'",
"?"
] | CREATE TABLE Document_Subsets (
Document_Subset_ID NUMBER PRIMARY KEY,
Document_Subset_Name TEXT,
Document_Subset_Details TEXT
);
CREATE TABLE Collection_Subsets (
Collection_Subset_ID NUMBER PRIMARY KEY,
Collection_Subset_Name TEXT,
Collecrtion_Subset_Details TEXT
);
CREATE TABLE Document_Objects (
Document_Object_ID NUMBER PRIMARY KEY,
Parent_Document_Object_ID NUMBER,
Owner TEXT,
Description TEXT,
Other_Details TEXT
);
CREATE TABLE Collections (
Collection_ID NUMBER PRIMARY KEY,
Parent_Collection_ID NUMBER,
Collection_Name TEXT,
Collection_Description TEXT
);
CREATE TABLE Documents_in_Collections (
Document_Object_ID NUMBER PRIMARY KEY,
Collection_ID NUMBER,
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Document_Subset_Members (
Document_Object_ID NUMBER PRIMARY KEY,
Related_Document_Object_ID NUMBER,
Document_Subset_ID NUMBER,
FOREIGN KEY (Document_Subset_ID) REFERENCES Document_Subsets(Document_Subset_ID),
FOREIGN KEY (Related_Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Collection_Subset_Members (
Collection_ID NUMBER PRIMARY KEY,
Related_Collection_ID NUMBER,
Collection_Subset_ID NUMBER,
FOREIGN KEY (Collection_Subset_ID) REFERENCES Collection_Subsets(Collection_Subset_ID),
FOREIGN KEY (Related_Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID)
); |
region_building | SELECT Name FROM region ORDER BY Name ASC | [
"SELECT",
"Name",
"FROM",
"region",
"ORDER",
"BY",
"Name",
"ASC"
] | [
"select",
"name",
"from",
"region",
"order",
"by",
"name",
"asc"
] | What are the names of regions in ascending alphabetical order? | [
"What",
"are",
"the",
"names",
"of",
"regions",
"in",
"ascending",
"alphabetical",
"order",
"?"
] | CREATE TABLE building (
Building_ID NUMBER PRIMARY KEY,
Region_ID NUMBER,
Name TEXT,
Address TEXT,
Number_of_Stories NUMBER,
Completed_Year NUMBER,
FOREIGN KEY (Region_ID) REFERENCES region(Region_ID)
);
CREATE TABLE region (
Region_ID NUMBER PRIMARY KEY,
Name TEXT,
Capital TEXT,
Area NUMBER,
Population NUMBER
); |
bakery_1 | SELECT id FROM goods WHERE flavor = "Apricot" AND price < 5 | [
"SELECT",
"id",
"FROM",
"goods",
"WHERE",
"flavor",
"=",
"``",
"Apricot",
"''",
"AND",
"price",
"<",
"5"
] | [
"select",
"id",
"from",
"goods",
"where",
"flavor",
"=",
"value",
"and",
"price",
"<",
"value"
] | What are ids of the goods that have Apricot flavor and are cheaper than 5 dollars? | [
"What",
"are",
"ids",
"of",
"the",
"goods",
"that",
"have",
"Apricot",
"flavor",
"and",
"are",
"cheaper",
"than",
"5",
"dollars",
"?"
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
government_shift | SELECT analytical_layer_type_code , count(*) FROM analytical_layer GROUP BY analytical_layer_type_code | [
"SELECT",
"analytical_layer_type_code",
",",
"count",
"(",
"*",
")",
"FROM",
"analytical_layer",
"GROUP",
"BY",
"analytical_layer_type_code"
] | [
"select",
"analytical_layer_type_code",
",",
"count",
"(",
"*",
")",
"from",
"analytical_layer",
"group",
"by",
"analytical_layer_type_code"
] | For each analytical layer, return the analytical layer type code and the number of times it was used. | [
"For",
"each",
"analytical",
"layer",
",",
"return",
"the",
"analytical",
"layer",
"type",
"code",
"and",
"the",
"number",
"of",
"times",
"it",
"was",
"used",
"."
] | CREATE TABLE Services (
Service_ID NUMBER PRIMARY KEY,
Service_Details TEXT
);
CREATE TABLE Customers (
Customer_ID NUMBER PRIMARY KEY,
Customer_Details TEXT
);
CREATE TABLE Channels (
Channel_ID NUMBER PRIMARY KEY,
Channel_Details TEXT
);
CREATE TABLE Customers_and_Services (
Customers_and_Services_ID NUMBER PRIMARY KEY,
Customer_ID NUMBER,
Service_ID NUMBER,
Customers_and_Services_Details TEXT,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID),
FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);
CREATE TABLE Customer_Interactions (
Customer_Interaction_ID NUMBER PRIMARY KEY,
Channel_ID NUMBER,
Customer_ID NUMBER,
Service_ID NUMBER,
Status_Code TEXT,
Services_and_Channels_Details TEXT,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID),
FOREIGN KEY (Channel_ID) REFERENCES Channels(Channel_ID),
FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);
CREATE TABLE Integration_Platform (
Integration_Platform_ID NUMBER PRIMARY KEY,
Customer_Interaction_ID NUMBER,
Integration_Platform_Details TEXT,
FOREIGN KEY (Customer_Interaction_ID) REFERENCES Customer_Interactions(Customer_Interaction_ID)
);
CREATE TABLE Analytical_Layer (
Analytical_ID NUMBER PRIMARY KEY,
Customers_and_Services_ID TEXT,
Pattern_Recognition TEXT,
Analytical_Layer_Type_Code TEXT,
FOREIGN KEY (Customers_and_Services_ID) REFERENCES Customers_and_Services(Customers_and_Services_ID)
); |
real_estate_rentals | SELECT T2.town_city FROM Properties AS T1 JOIN Addresses AS T2 ON T1.property_address_id = T2.address_id JOIN Property_Features AS T3 ON T1.property_id = T3.property_id JOIN Features AS T4 ON T4.feature_id = T3.feature_id WHERE T4.feature_name = 'swimming pool'; | [
"SELECT",
"T2.town_city",
"FROM",
"Properties",
"AS",
"T1",
"JOIN",
"Addresses",
"AS",
"T2",
"ON",
"T1.property_address_id",
"=",
"T2.address_id",
"JOIN",
"Property_Features",
"AS",
"T3",
"ON",
"T1.property_id",
"=",
"T3.property_id",
"JOIN",
"Features",
"AS",
"T4",... | [
"select",
"t2",
".",
"town_city",
"from",
"properties",
"as",
"t1",
"join",
"addresses",
"as",
"t2",
"on",
"t1",
".",
"property_address_id",
"=",
"t2",
".",
"address_id",
"join",
"property_features",
"as",
"t3",
"on",
"t1",
".",
"property_id",
"=",
"t3",
"... | In which cities are there any properties equipped with a swimming pool? | [
"In",
"which",
"cities",
"are",
"there",
"any",
"properties",
"equipped",
"with",
"a",
"swimming",
"pool",
"?"
] | CREATE TABLE Ref_Age_Categories (
age_category_code TEXT PRIMARY KEY,
age_category_description TEXT
);
CREATE TABLE Ref_Property_Types (
property_type_code TEXT PRIMARY KEY,
property_type_description TEXT
);
CREATE TABLE Ref_Room_Types (
room_type_code TEXT PRIMARY KEY,
room_type_description TEXT
);
CREATE TABLE Ref_User_Categories (
user_category_code TEXT PRIMARY KEY,
user_category_description TEXT
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
line_1_number_building TEXT,
line_2_number_street TEXT,
line_3_area_locality TEXT,
town_city TEXT,
zip_postcode TEXT,
county_state_province TEXT,
country TEXT,
other_address_details TEXT
);
CREATE TABLE Features (
feature_id NUMBER PRIMARY KEY,
feature_name TEXT,
feature_description TEXT
);
CREATE TABLE Users (
user_id NUMBER PRIMARY KEY,
age_category_code TEXT,
user_category_code TEXT,
user_address_id NUMBER,
is_buyer TEXT,
is_seller TEXT,
login_name TEXT,
password TEXT,
date_registered TIME,
first_name TEXT,
middle_name TEXT,
last_name TEXT,
other_user_details TEXT
);
CREATE TABLE Properties (
property_id NUMBER PRIMARY KEY,
property_address_id NUMBER,
owner_user_id NUMBER,
property_type_code TEXT,
date_on_market TIME,
date_off_market TIME,
property_name TEXT,
property_description TEXT,
garage_yn TEXT,
parking_lots TEXT,
room_count TEXT,
vendor_requested_price NUMBER,
price_min NUMBER,
price_max NUMBER,
other_property_details TEXT,
FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code),
FOREIGN KEY (property_address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (owner_user_id) REFERENCES Users(user_id)
);
CREATE TABLE Property_Features (
property_id NUMBER,
feature_id NUMBER,
feature_value TEXT,
property_feature_description TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (feature_id) REFERENCES Features(feature_id)
);
CREATE TABLE Property_Photos (
property_id NUMBER,
photo_seq NUMBER,
photo_title TEXT,
photo_description TEXT,
photo_filename TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Rooms (
property_id NUMBER,
room_number TEXT,
room_type_code TEXT,
room_size TEXT,
other_room_details TEXT,
FOREIGN KEY (room_type_code) REFERENCES Ref_Room_Types(room_type_code),
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE User_Property_History (
user_id NUMBER,
property_id NUMBER,
datestamp TIME,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE User_Searches (
user_id NUMBER,
search_seq NUMBER,
search_datetime TIME,
search_string TEXT,
FOREIGN KEY (user_id) REFERENCES Users(user_id)
); |
warehouse_1 | SELECT warehouse , avg(value) FROM boxes GROUP BY warehouse | [
"SELECT",
"warehouse",
",",
"avg",
"(",
"value",
")",
"FROM",
"boxes",
"GROUP",
"BY",
"warehouse"
] | [
"select",
"warehouse",
",",
"avg",
"(",
"value",
")",
"from",
"boxes",
"group",
"by",
"warehouse"
] | What is the average value of boxes for each warehouse? | [
"What",
"is",
"the",
"average",
"value",
"of",
"boxes",
"for",
"each",
"warehouse",
"?"
] | CREATE TABLE Warehouses (
Code NUMBER PRIMARY KEY,
Location TEXT,
Capacity NUMBER
);
CREATE TABLE Boxes (
Code TEXT PRIMARY KEY,
Contents TEXT,
Value NUMBER,
Warehouse NUMBER,
FOREIGN KEY (Warehouse) REFERENCES Warehouses(Code)
); |
car_racing | SELECT Make , COUNT(*) FROM driver GROUP BY Make | [
"SELECT",
"Make",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"driver",
"GROUP",
"BY",
"Make"
] | [
"select",
"make",
",",
"count",
"(",
"*",
")",
"from",
"driver",
"group",
"by",
"make"
] | List each make with the number of drivers with that make. | [
"List",
"each",
"make",
"with",
"the",
"number",
"of",
"drivers",
"with",
"that",
"make",
"."
] | CREATE TABLE country (
Country_Id NUMBER PRIMARY KEY,
Country TEXT,
Capital TEXT,
Official_native_language TEXT,
Regoin TEXT
);
CREATE TABLE team (
Team_ID NUMBER PRIMARY KEY,
Team TEXT,
Make TEXT,
Manager TEXT,
Sponsor TEXT,
Car_Owner TEXT
);
CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver TEXT,
Country NUMBER,
Age NUMBER,
Car_# NUMBER,
Make TEXT,
Points TEXT,
Laps NUMBER,
Winnings TEXT
);
CREATE TABLE team_driver (
Team_ID NUMBER PRIMARY KEY,
Driver_ID NUMBER,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID),
FOREIGN KEY (Team_ID) REFERENCES team(Team_ID)
); |
address_1 | SELECT state FROM City GROUP BY state HAVING count(*) >= 2 | [
"SELECT",
"state",
"FROM",
"City",
"GROUP",
"BY",
"state",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2"
] | [
"select",
"state",
"from",
"city",
"group",
"by",
"state",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] | List all states with at least two cities. | [
"List",
"all",
"states",
"with",
"at",
"least",
"two",
"cities",
"."
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
boat_1 | SELECT count(*) FROM Boats WHERE color = 'red' | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Boats",
"WHERE",
"color",
"=",
"'red",
"'"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"boats",
"where",
"color",
"=",
"value"
] | How many boats are red? | [
"How",
"many",
"boats",
"are",
"red",
"?"
] | CREATE TABLE Sailors (
sid NUMBER PRIMARY KEY,
name TEXT,
rating NUMBER,
age NUMBER
);
CREATE TABLE Boats (
bid NUMBER PRIMARY KEY,
name TEXT,
color TEXT
);
CREATE TABLE Reserves (
sid NUMBER,
bid NUMBER,
day TEXT,
FOREIGN KEY (bid) REFERENCES Boats(bid),
FOREIGN KEY (sid) REFERENCES Sailors(sid)
); |
advertising_agencies | SELECT invoice_id , count(*) FROM Payments GROUP BY invoice_id | [
"SELECT",
"invoice_id",
",",
"count",
"(",
"*",
")",
"FROM",
"Payments",
"GROUP",
"BY",
"invoice_id"
] | [
"select",
"invoice_id",
",",
"count",
"(",
"*",
")",
"from",
"payments",
"group",
"by",
"invoice_id"
] | How many payments are there for each invoice? | [
"How",
"many",
"payments",
"are",
"there",
"for",
"each",
"invoice",
"?"
] | CREATE TABLE Agencies (
agency_id NUMBER PRIMARY KEY,
agency_details TEXT
);
CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
agency_id NUMBER,
staff_details TEXT
);
CREATE TABLE Clients (
client_id NUMBER PRIMARY KEY,
agency_id NUMBER,
sic_code TEXT,
client_details TEXT,
FOREIGN KEY (agency_id) REFERENCES Agencies(agency_id)
);
CREATE TABLE Invoices (
invoice_id NUMBER PRIMARY KEY,
client_id NUMBER,
invoice_status TEXT,
invoice_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Meetings (
meeting_id NUMBER PRIMARY KEY,
client_id NUMBER,
meeting_outcome TEXT,
meeting_type TEXT,
billable_yn TEXT,
start_date_time TIME,
end_date_time TIME,
purpose_of_meeting TEXT,
other_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Payments (
payment_id NUMBER,
invoice_id NUMBER,
payment_details TEXT,
FOREIGN KEY (invoice_id) REFERENCES Invoices(invoice_id)
);
CREATE TABLE Staff_in_Meetings (
meeting_id NUMBER,
staff_id NUMBER,
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (meeting_id) REFERENCES Meetings(meeting_id)
); |
e_commerce | SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name , T2.Payment_method_code FROM Customers AS T1 JOIN Customer_Payment_Methods AS T2 ON T1.customer_id = T2.customer_id | [
"SELECT",
"T1.customer_first_name",
",",
"T1.customer_middle_initial",
",",
"T1.customer_last_name",
",",
"T2.Payment_method_code",
"FROM",
"Customers",
"AS",
"T1",
"JOIN",
"Customer_Payment_Methods",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id"
] | [
"select",
"t1",
".",
"customer_first_name",
",",
"t1",
".",
"customer_middle_initial",
",",
"t1",
".",
"customer_last_name",
",",
"t2",
".",
"payment_method_code",
"from",
"customers",
"as",
"t1",
"join",
"customer_payment_methods",
"as",
"t2",
"on",
"t1",
".",
... | List the customers' first name, middle initial, last name and payment methods. | [
"List",
"the",
"customers",
"'",
"first",
"name",
",",
"middle",
"initial",
",",
"last",
"name",
"and",
"payment",
"methods",
"."
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
parent_product_id NUMBER,
product_name TEXT,
product_price NUMBER,
product_color TEXT,
product_size TEXT,
product_description TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
gender_code TEXT,
customer_first_name TEXT,
customer_middle_initial TEXT,
customer_last_name TEXT,
email_address TEXT,
login_name TEXT,
login_password TEXT,
phone_number TEXT,
address_line_1 TEXT,
town_city TEXT,
county TEXT,
country TEXT
);
CREATE TABLE Customer_Payment_Methods (
customer_id NUMBER,
payment_method_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Invoices (
invoice_number NUMBER PRIMARY KEY,
invoice_status_code TEXT,
invoice_date TIME
);
CREATE TABLE Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_status_code TEXT,
date_order_placed TIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER PRIMARY KEY,
product_id NUMBER,
order_id NUMBER,
order_item_status_code TEXT,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Shipments (
shipment_id NUMBER PRIMARY KEY,
order_id NUMBER,
invoice_number NUMBER,
shipment_tracking_number TEXT,
shipment_date TIME,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number)
);
CREATE TABLE Shipment_Items (
shipment_id NUMBER PRIMARY KEY,
order_item_id NUMBER,
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id),
FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id)
); |
car_road_race | SELECT Engine FROM driver GROUP BY Engine ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"Engine",
"FROM",
"driver",
"GROUP",
"BY",
"Engine",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"engine",
"from",
"driver",
"group",
"by",
"engine",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | What is the most common type of engine? | [
"What",
"is",
"the",
"most",
"common",
"type",
"of",
"engine",
"?"
] | CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver_Name TEXT,
Entrant TEXT,
Constructor TEXT,
Chassis TEXT,
Engine TEXT,
Age NUMBER
);
CREATE TABLE race (
Road NUMBER PRIMARY KEY,
Driver_ID NUMBER,
Race_Name TEXT,
Pole_Position TEXT,
Fastest_Lap TEXT,
Winning_driver TEXT,
Winning_team TEXT,
Report TEXT,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID)
); |
government_shift | SELECT DISTINCT t1.service_details FROM services AS t1 JOIN customers_and_services AS t2 ON t1.service_id = t2.service_id WHERE t2.customers_and_services_details = "Unsatisfied" | [
"SELECT",
"DISTINCT",
"t1.service_details",
"FROM",
"services",
"AS",
"t1",
"JOIN",
"customers_and_services",
"AS",
"t2",
"ON",
"t1.service_id",
"=",
"t2.service_id",
"WHERE",
"t2.customers_and_services_details",
"=",
"``",
"Unsatisfied",
"''"
] | [
"select",
"distinct",
"t1",
".",
"service_details",
"from",
"services",
"as",
"t1",
"join",
"customers_and_services",
"as",
"t2",
"on",
"t1",
".",
"service_id",
"=",
"t2",
".",
"service_id",
"where",
"t2",
".",
"customers_and_services_details",
"=",
"value"
] | Which services have been rated as "unsatisfied" in customers and services details? Give me the service_details. | [
"Which",
"services",
"have",
"been",
"rated",
"as",
"``",
"unsatisfied",
"''",
"in",
"customers",
"and",
"services",
"details",
"?",
"Give",
"me",
"the",
"service_details",
"."
] | CREATE TABLE Services (
Service_ID NUMBER PRIMARY KEY,
Service_Details TEXT
);
CREATE TABLE Customers (
Customer_ID NUMBER PRIMARY KEY,
Customer_Details TEXT
);
CREATE TABLE Channels (
Channel_ID NUMBER PRIMARY KEY,
Channel_Details TEXT
);
CREATE TABLE Customers_and_Services (
Customers_and_Services_ID NUMBER PRIMARY KEY,
Customer_ID NUMBER,
Service_ID NUMBER,
Customers_and_Services_Details TEXT,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID),
FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);
CREATE TABLE Customer_Interactions (
Customer_Interaction_ID NUMBER PRIMARY KEY,
Channel_ID NUMBER,
Customer_ID NUMBER,
Service_ID NUMBER,
Status_Code TEXT,
Services_and_Channels_Details TEXT,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID),
FOREIGN KEY (Channel_ID) REFERENCES Channels(Channel_ID),
FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);
CREATE TABLE Integration_Platform (
Integration_Platform_ID NUMBER PRIMARY KEY,
Customer_Interaction_ID NUMBER,
Integration_Platform_Details TEXT,
FOREIGN KEY (Customer_Interaction_ID) REFERENCES Customer_Interactions(Customer_Interaction_ID)
);
CREATE TABLE Analytical_Layer (
Analytical_ID NUMBER PRIMARY KEY,
Customers_and_Services_ID TEXT,
Pattern_Recognition TEXT,
Analytical_Layer_Type_Code TEXT,
FOREIGN KEY (Customers_and_Services_ID) REFERENCES Customers_and_Services(Customers_and_Services_ID)
); |
customers_and_orders | SELECT T2.customer_name , T1.customer_id , count(*) FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id | [
"SELECT",
"T2.customer_name",
",",
"T1.customer_id",
",",
"count",
"(",
"*",
")",
"FROM",
"Customer_orders",
"AS",
"T1",
"JOIN",
"Customers",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"GROUP",
"BY",
"T1.customer_id"
] | [
"select",
"t2",
".",
"customer_name",
",",
"t1",
".",
"customer_id",
",",
"count",
"(",
"*",
")",
"from",
"customer_orders",
"as",
"t1",
"join",
"customers",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"group",
"by",
"t1",
... | What are the names, ids, and number of orders made for each customer? | [
"What",
"are",
"the",
"names",
",",
"ids",
",",
"and",
"number",
"of",
"orders",
"made",
"for",
"each",
"customer",
"?"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
product_type_code TEXT,
product_name TEXT,
product_price NUMBER
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
address_id NUMBER,
payment_method_code TEXT,
customer_number TEXT,
customer_name TEXT,
customer_address TEXT,
customer_phone TEXT,
customer_email TEXT
);
CREATE TABLE Customer_Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_date TIME,
order_status_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER,
order_id NUMBER,
product_id NUMBER,
order_quantity TEXT,
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id)
); |
club_leader | SELECT T3.Name , T2.Club_Name FROM club_leader AS T1 JOIN club AS T2 ON T1.Club_ID = T2.Club_ID JOIN member AS T3 ON T1.Member_ID = T3.Member_ID | [
"SELECT",
"T3.Name",
",",
"T2.Club_Name",
"FROM",
"club_leader",
"AS",
"T1",
"JOIN",
"club",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"JOIN",
"member",
"AS",
"T3",
"ON",
"T1.Member_ID",
"=",
"T3.Member_ID"
] | [
"select",
"t3",
".",
"name",
",",
"t2",
".",
"club_name",
"from",
"club_leader",
"as",
"t1",
"join",
"club",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"join",
"member",
"as",
"t3",
"on",
"t1",
".",
"member_id",
"=",
"t3",
"... | Show the names of club leaders and the names of clubs they joined. | [
"Show",
"the",
"names",
"of",
"club",
"leaders",
"and",
"the",
"names",
"of",
"clubs",
"they",
"joined",
"."
] | CREATE TABLE member (
Member_ID NUMBER PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Age NUMBER
);
CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Overall_Ranking NUMBER,
Team_Leader TEXT,
Club_Name TEXT
);
CREATE TABLE club_leader (
Club_ID NUMBER PRIMARY KEY,
Member_ID NUMBER,
Year_Join TEXT,
FOREIGN KEY (Member_ID) REFERENCES member(Member_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
aan_1 | SELECT T1.name FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id HAVING count(*) > 50 | [
"SELECT",
"T1.name",
"FROM",
"Author",
"AS",
"T1",
"JOIN",
"Author_list",
"AS",
"T2",
"ON",
"T1.author_id",
"=",
"T2.author_id",
"GROUP",
"BY",
"T1.author_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"50"
] | [
"select",
"t1",
".",
"name",
"from",
"author",
"as",
"t1",
"join",
"author_list",
"as",
"t2",
"on",
"t1",
".",
"author_id",
"=",
"t2",
".",
"author_id",
"group",
"by",
"t1",
".",
"author_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | What are the names of all authors who have more than 50 papers? | [
"What",
"are",
"the",
"names",
"of",
"all",
"authors",
"who",
"have",
"more",
"than",
"50",
"papers",
"?"
] | CREATE TABLE Affiliation (
affiliation_id NUMBER PRIMARY KEY,
name TEXT,
address TEXT
);
CREATE TABLE Author (
author_id NUMBER PRIMARY KEY,
name TEXT,
email TEXT
);
CREATE TABLE Author_list (
paper_id TEXT PRIMARY KEY,
author_id NUMBER,
affiliation_id NUMBER,
FOREIGN KEY (affiliation_id) REFERENCES Affiliation(affiliation_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Citation (
paper_id TEXT PRIMARY KEY,
cited_paper_id TEXT,
FOREIGN KEY (cited_paper_id) REFERENCES Paper(paper_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Paper (
paper_id TEXT PRIMARY KEY,
title TEXT,
venue TEXT,
year NUMBER
); |
cre_Doc_and_collections | SELECT Collection_Name FROM Collections EXCEPT SELECT T2.Collection_Name FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID; | [
"SELECT",
"Collection_Name",
"FROM",
"Collections",
"EXCEPT",
"SELECT",
"T2.Collection_Name",
"FROM",
"Collections",
"AS",
"T1",
"JOIN",
"Collections",
"AS",
"T2",
"ON",
"T1.Parent_Collection_ID",
"=",
"T2.Collection_ID",
";"
] | [
"select",
"collection_name",
"from",
"collections",
"except",
"select",
"t2",
".",
"collection_name",
"from",
"collections",
"as",
"t1",
"join",
"collections",
"as",
"t2",
"on",
"t1",
".",
"parent_collection_id",
"=",
"t2",
".",
"collection_id"
] | Which collection is not the parent of other collection? List the collection's name. | [
"Which",
"collection",
"is",
"not",
"the",
"parent",
"of",
"other",
"collection",
"?",
"List",
"the",
"collection",
"'s",
"name",
"."
] | CREATE TABLE Document_Subsets (
Document_Subset_ID NUMBER PRIMARY KEY,
Document_Subset_Name TEXT,
Document_Subset_Details TEXT
);
CREATE TABLE Collection_Subsets (
Collection_Subset_ID NUMBER PRIMARY KEY,
Collection_Subset_Name TEXT,
Collecrtion_Subset_Details TEXT
);
CREATE TABLE Document_Objects (
Document_Object_ID NUMBER PRIMARY KEY,
Parent_Document_Object_ID NUMBER,
Owner TEXT,
Description TEXT,
Other_Details TEXT
);
CREATE TABLE Collections (
Collection_ID NUMBER PRIMARY KEY,
Parent_Collection_ID NUMBER,
Collection_Name TEXT,
Collection_Description TEXT
);
CREATE TABLE Documents_in_Collections (
Document_Object_ID NUMBER PRIMARY KEY,
Collection_ID NUMBER,
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Document_Subset_Members (
Document_Object_ID NUMBER PRIMARY KEY,
Related_Document_Object_ID NUMBER,
Document_Subset_ID NUMBER,
FOREIGN KEY (Document_Subset_ID) REFERENCES Document_Subsets(Document_Subset_ID),
FOREIGN KEY (Related_Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Collection_Subset_Members (
Collection_ID NUMBER PRIMARY KEY,
Related_Collection_ID NUMBER,
Collection_Subset_ID NUMBER,
FOREIGN KEY (Collection_Subset_ID) REFERENCES Collection_Subsets(Collection_Subset_ID),
FOREIGN KEY (Related_Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID)
); |
car_road_race | SELECT Winning_driver , Winning_team FROM race ORDER BY Winning_team ASC | [
"SELECT",
"Winning_driver",
",",
"Winning_team",
"FROM",
"race",
"ORDER",
"BY",
"Winning_team",
"ASC"
] | [
"select",
"winning_driver",
",",
"winning_team",
"from",
"race",
"order",
"by",
"winning_team",
"asc"
] | What are the winning drivers and teams of races, ordered alphabetically by team? | [
"What",
"are",
"the",
"winning",
"drivers",
"and",
"teams",
"of",
"races",
",",
"ordered",
"alphabetically",
"by",
"team",
"?"
] | CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver_Name TEXT,
Entrant TEXT,
Constructor TEXT,
Chassis TEXT,
Engine TEXT,
Age NUMBER
);
CREATE TABLE race (
Road NUMBER PRIMARY KEY,
Driver_ID NUMBER,
Race_Name TEXT,
Pole_Position TEXT,
Fastest_Lap TEXT,
Winning_driver TEXT,
Winning_team TEXT,
Report TEXT,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID)
); |
customers_and_orders | SELECT order_status_code , count(*) FROM Customer_orders GROUP BY order_status_code | [
"SELECT",
"order_status_code",
",",
"count",
"(",
"*",
")",
"FROM",
"Customer_orders",
"GROUP",
"BY",
"order_status_code"
] | [
"select",
"order_status_code",
",",
"count",
"(",
"*",
")",
"from",
"customer_orders",
"group",
"by",
"order_status_code"
] | Show all order status and the number of orders in each status. | [
"Show",
"all",
"order",
"status",
"and",
"the",
"number",
"of",
"orders",
"in",
"each",
"status",
"."
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
product_type_code TEXT,
product_name TEXT,
product_price NUMBER
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
address_id NUMBER,
payment_method_code TEXT,
customer_number TEXT,
customer_name TEXT,
customer_address TEXT,
customer_phone TEXT,
customer_email TEXT
);
CREATE TABLE Customer_Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_date TIME,
order_status_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER,
order_id NUMBER,
product_id NUMBER,
order_quantity TEXT,
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id)
); |
institution_sports | SELECT T2.Name FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T1.Number_of_Championships DESC | [
"SELECT",
"T2.Name",
"FROM",
"championship",
"AS",
"T1",
"JOIN",
"institution",
"AS",
"T2",
"ON",
"T1.Institution_ID",
"=",
"T2.Institution_ID",
"ORDER",
"BY",
"T1.Number_of_Championships",
"DESC"
] | [
"select",
"t2",
".",
"name",
"from",
"championship",
"as",
"t1",
"join",
"institution",
"as",
"t2",
"on",
"t1",
".",
"institution_id",
"=",
"t2",
".",
"institution_id",
"order",
"by",
"t1",
".",
"number_of_championships",
"desc"
] | List the names of institutions in descending order of the number of championships. | [
"List",
"the",
"names",
"of",
"institutions",
"in",
"descending",
"order",
"of",
"the",
"number",
"of",
"championships",
"."
] | CREATE TABLE institution (
Institution_ID NUMBER PRIMARY KEY,
Name TEXT,
Team TEXT,
City TEXT,
Province TEXT,
Founded NUMBER,
Affiliation TEXT,
Enrollment NUMBER,
Endowment TEXT,
Stadium TEXT,
Capacity NUMBER
);
CREATE TABLE Championship (
Institution_ID NUMBER PRIMARY KEY,
Nickname TEXT,
Joined NUMBER,
Number_of_Championships NUMBER,
FOREIGN KEY (Institution_ID) REFERENCES institution(Institution_ID)
); |
book_review | SELECT max(Chapters) , min(Chapters) FROM book | [
"SELECT",
"max",
"(",
"Chapters",
")",
",",
"min",
"(",
"Chapters",
")",
"FROM",
"book"
] | [
"select",
"max",
"(",
"chapters",
")",
",",
"min",
"(",
"chapters",
")",
"from",
"book"
] | What are the maximum and minimum number of chapters for each book? | [
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"number",
"of",
"chapters",
"for",
"each",
"book",
"?"
] | CREATE TABLE book (
Book_ID NUMBER PRIMARY KEY,
Title TEXT,
Type TEXT,
Pages NUMBER,
Chapters NUMBER,
Audio TEXT,
Release TEXT
);
CREATE TABLE review (
Review_ID NUMBER PRIMARY KEY,
Book_ID NUMBER,
Rating NUMBER,
Readers_in_Million NUMBER,
Rank NUMBER,
FOREIGN KEY (Book_ID) REFERENCES book(Book_ID)
); |
advertising_agencies | SELECT invoice_id , invoice_status , invoice_details FROM Invoices | [
"SELECT",
"invoice_id",
",",
"invoice_status",
",",
"invoice_details",
"FROM",
"Invoices"
] | [
"select",
"invoice_id",
",",
"invoice_status",
",",
"invoice_details",
"from",
"invoices"
] | Show ids, status codes, and details for all invoices for clients. | [
"Show",
"ids",
",",
"status",
"codes",
",",
"and",
"details",
"for",
"all",
"invoices",
"for",
"clients",
"."
] | CREATE TABLE Agencies (
agency_id NUMBER PRIMARY KEY,
agency_details TEXT
);
CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
agency_id NUMBER,
staff_details TEXT
);
CREATE TABLE Clients (
client_id NUMBER PRIMARY KEY,
agency_id NUMBER,
sic_code TEXT,
client_details TEXT,
FOREIGN KEY (agency_id) REFERENCES Agencies(agency_id)
);
CREATE TABLE Invoices (
invoice_id NUMBER PRIMARY KEY,
client_id NUMBER,
invoice_status TEXT,
invoice_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Meetings (
meeting_id NUMBER PRIMARY KEY,
client_id NUMBER,
meeting_outcome TEXT,
meeting_type TEXT,
billable_yn TEXT,
start_date_time TIME,
end_date_time TIME,
purpose_of_meeting TEXT,
other_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Payments (
payment_id NUMBER,
invoice_id NUMBER,
payment_details TEXT,
FOREIGN KEY (invoice_id) REFERENCES Invoices(invoice_id)
);
CREATE TABLE Staff_in_Meetings (
meeting_id NUMBER,
staff_id NUMBER,
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (meeting_id) REFERENCES Meetings(meeting_id)
); |
bakery_1 | SELECT DISTINCT T1.date FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id WHERE T3.price > 15 | [
"SELECT",
"DISTINCT",
"T1.date",
"FROM",
"receipts",
"AS",
"T1",
"JOIN",
"items",
"AS",
"T2",
"ON",
"T1.ReceiptNumber",
"=",
"T2.receipt",
"JOIN",
"goods",
"AS",
"T3",
"ON",
"T2.item",
"=",
"T3.id",
"WHERE",
"T3.price",
">",
"15"
] | [
"select",
"distinct",
"t1",
".",
"date",
"from",
"receipts",
"as",
"t1",
"join",
"items",
"as",
"t2",
"on",
"t1",
".",
"receiptnumber",
"=",
"t2",
".",
"receipt",
"join",
"goods",
"as",
"t3",
"on",
"t2",
".",
"item",
"=",
"t3",
".",
"id",
"where",
... | On which date did some customer buy a good that costs more than 15 dollars? | [
"On",
"which",
"date",
"did",
"some",
"customer",
"buy",
"a",
"good",
"that",
"costs",
"more",
"than",
"15",
"dollars",
"?"
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
sing_contest | select name , language from songs | [
"select",
"name",
",",
"language",
"from",
"songs"
] | [
"select",
"name",
",",
"language",
"from",
"songs"
] | List the names and languages of the songs . | [
"List",
"the",
"names",
"and",
"languages",
"of",
"the",
"songs",
"."
] | CREATE TABLE participants (
id NUMBER PRIMARY KEY,
name TEXT,
popularity NUMBER
);
CREATE TABLE songs (
id NUMBER PRIMARY KEY,
language TEXT,
original_artist TEXT,
name TEXT,
english_translation TEXT
);
CREATE TABLE performance_score (
participant_id NUMBER PRIMARY KEY,
songs_id NUMBER,
voice_sound_quality NUMBER,
rhythm_tempo NUMBER,
stage_presence NUMBER,
FOREIGN KEY (songs_id) REFERENCES songs(id),
FOREIGN KEY (participant_id) REFERENCES participants(id)
); |
cre_Doc_and_collections | SELECT Collection_Name FROM Collections; | [
"SELECT",
"Collection_Name",
"FROM",
"Collections",
";"
] | [
"select",
"collection_name",
"from",
"collections"
] | what are the collection names? | [
"what",
"are",
"the",
"collection",
"names",
"?"
] | CREATE TABLE Document_Subsets (
Document_Subset_ID NUMBER PRIMARY KEY,
Document_Subset_Name TEXT,
Document_Subset_Details TEXT
);
CREATE TABLE Collection_Subsets (
Collection_Subset_ID NUMBER PRIMARY KEY,
Collection_Subset_Name TEXT,
Collecrtion_Subset_Details TEXT
);
CREATE TABLE Document_Objects (
Document_Object_ID NUMBER PRIMARY KEY,
Parent_Document_Object_ID NUMBER,
Owner TEXT,
Description TEXT,
Other_Details TEXT
);
CREATE TABLE Collections (
Collection_ID NUMBER PRIMARY KEY,
Parent_Collection_ID NUMBER,
Collection_Name TEXT,
Collection_Description TEXT
);
CREATE TABLE Documents_in_Collections (
Document_Object_ID NUMBER PRIMARY KEY,
Collection_ID NUMBER,
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Document_Subset_Members (
Document_Object_ID NUMBER PRIMARY KEY,
Related_Document_Object_ID NUMBER,
Document_Subset_ID NUMBER,
FOREIGN KEY (Document_Subset_ID) REFERENCES Document_Subsets(Document_Subset_ID),
FOREIGN KEY (Related_Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID),
FOREIGN KEY (Document_Object_ID) REFERENCES Document_Objects(Document_Object_ID)
);
CREATE TABLE Collection_Subset_Members (
Collection_ID NUMBER PRIMARY KEY,
Related_Collection_ID NUMBER,
Collection_Subset_ID NUMBER,
FOREIGN KEY (Collection_Subset_ID) REFERENCES Collection_Subsets(Collection_Subset_ID),
FOREIGN KEY (Related_Collection_ID) REFERENCES Collections(Collection_ID),
FOREIGN KEY (Collection_ID) REFERENCES Collections(Collection_ID)
); |
book_press | SELECT count(*) , gender FROM author WHERE age > 30 GROUP BY gender | [
"SELECT",
"count",
"(",
"*",
")",
",",
"gender",
"FROM",
"author",
"WHERE",
"age",
">",
"30",
"GROUP",
"BY",
"gender"
] | [
"select",
"count",
"(",
"*",
")",
",",
"gender",
"from",
"author",
"where",
"age",
">",
"value",
"group",
"by",
"gender"
] | How many authors are of age above 30 for each gender? | [
"How",
"many",
"authors",
"are",
"of",
"age",
"above",
"30",
"for",
"each",
"gender",
"?"
] | CREATE TABLE author (
Author_ID NUMBER PRIMARY KEY,
Name TEXT,
Age NUMBER,
Gender TEXT
);
CREATE TABLE press (
Press_ID NUMBER PRIMARY KEY,
Name TEXT,
Month_Profits_billion NUMBER,
Year_Profits_billion NUMBER
);
CREATE TABLE book (
Book_ID NUMBER PRIMARY KEY,
Title TEXT,
Book_Series TEXT,
Author_ID NUMBER,
Press_ID NUMBER,
Sale_Amount TEXT,
Release_date TEXT,
FOREIGN KEY (Press_ID) REFERENCES press(Press_ID),
FOREIGN KEY (Author_ID) REFERENCES author(Author_ID)
); |
vehicle_rent | SELECT name FROM vehicles ORDER BY model_year DESC | [
"SELECT",
"name",
"FROM",
"vehicles",
"ORDER",
"BY",
"model_year",
"DESC"
] | [
"select",
"name",
"from",
"vehicles",
"order",
"by",
"model_year",
"desc"
] | What are the names of all vehicles, ordered by model year descending? | [
"What",
"are",
"the",
"names",
"of",
"all",
"vehicles",
",",
"ordered",
"by",
"model",
"year",
"descending",
"?"
] | CREATE TABLE Customers (
id NUMBER PRIMARY KEY,
name TEXT,
age NUMBER,
membership_credit NUMBER
);
CREATE TABLE Discount (
id NUMBER PRIMARY KEY,
name TEXT,
membership_credit NUMBER
);
CREATE TABLE Vehicles (
id NUMBER PRIMARY KEY,
name TEXT,
Model_year NUMBER,
Type_of_powertrain TEXT,
Combined_fuel_economy_rate NUMBER,
City_fuel_economy_rate NUMBER,
Highway_fuel_economy_rate NUMBER,
Cost_per_25_miles NUMBER,
Annual_fuel_cost NUMBER,
Notes TEXT
);
CREATE TABLE Renting_history (
id NUMBER PRIMARY KEY,
customer_id NUMBER,
discount_id NUMBER,
vehicles_id NUMBER,
total_hours NUMBER,
FOREIGN KEY (discount_id) REFERENCES Discount(id),
FOREIGN KEY (vehicles_id) REFERENCES Vehicles(id),
FOREIGN KEY (customer_id) REFERENCES Customers(id)
); |
cre_Students_Information_Systems | SELECT date_from , date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*) = 2 ) | [
"SELECT",
"date_from",
",",
"date_to",
"FROM",
"Students_Addresses",
"WHERE",
"student_id",
"IN",
"(",
"SELECT",
"student_id",
"FROM",
"Transcripts",
"GROUP",
"BY",
"student_id",
"HAVING",
"count",
"(",
"*",
")",
"=",
"2",
")"
] | [
"select",
"date_from",
",",
"date_to",
"from",
"students_addresses",
"where",
"student_id",
"in",
"(",
"select",
"student_id",
"from",
"transcripts",
"group",
"by",
"student_id",
"having",
"count",
"(",
"*",
")",
"=",
"value",
")"
] | List the start time and the end time of the students' addresses for the students who have 2 transcripts. | [
"List",
"the",
"start",
"time",
"and",
"the",
"end",
"time",
"of",
"the",
"students",
"'",
"addresses",
"for",
"the",
"students",
"who",
"have",
"2",
"transcripts",
"."
] | CREATE TABLE Students (
student_id NUMBER PRIMARY KEY,
bio_data TEXT,
student_details TEXT
);
CREATE TABLE Transcripts (
transcript_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_transcript TIME,
transcript_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behaviour_Monitoring (
behaviour_monitoring_id NUMBER PRIMARY KEY,
student_id NUMBER,
behaviour_monitoring_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Ref_Event_Types (
event_type_code TEXT PRIMARY KEY,
event_type_description TEXT
);
CREATE TABLE Ref_Achievement_Type (
achievement_type_code TEXT PRIMARY KEY,
achievement_type_description TEXT
);
CREATE TABLE Ref_Address_Types (
address_type_code TEXT PRIMARY KEY,
address_type_description TEXT
);
CREATE TABLE Ref_Detention_Type (
detention_type_code TEXT PRIMARY KEY,
detention_type_description TEXT
);
CREATE TABLE Student_Events (
event_id NUMBER PRIMARY KEY,
event_type_code TEXT,
student_id NUMBER,
event_date TIME,
other_details TEXT,
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types(event_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Teachers (
teacher_id NUMBER PRIMARY KEY,
teacher_details TEXT
);
CREATE TABLE Student_Loans (
student_loan_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_loan TIME,
amount_of_loan NUMBER,
other_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Classes (
class_id NUMBER PRIMARY KEY,
student_id NUMBER,
teacher_id NUMBER,
class_details TEXT,
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Students_Addresses (
student_address_id NUMBER PRIMARY KEY,
address_id NUMBER,
address_type_code TEXT,
student_id NUMBER,
date_from TIME,
date_to TIME,
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types(address_type_code),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Detention (
detention_id NUMBER PRIMARY KEY,
detention_type_code TEXT,
student_id NUMBER,
datetime_detention_start TIME,
datetime_detention_end TIME,
detention_summary TEXT,
other_details TEXT,
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Achievements (
achievement_id NUMBER PRIMARY KEY,
achievement_type_code TEXT,
student_id NUMBER,
date_achievement TIME,
achievement_details TEXT,
other_details TEXT,
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type(achievement_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
); |
restaurant_bills | SELECT Nationality , Card_Credit FROM customer | [
"SELECT",
"Nationality",
",",
"Card_Credit",
"FROM",
"customer"
] | [
"select",
"nationality",
",",
"card_credit",
"from",
"customer"
] | Find the nationality and card credit of each customer. | [
"Find",
"the",
"nationality",
"and",
"card",
"credit",
"of",
"each",
"customer",
"."
] | CREATE TABLE customer (
Customer_ID NUMBER PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Card_Credit NUMBER,
Level_of_Membership NUMBER
);
CREATE TABLE branch (
Branch_ID NUMBER PRIMARY KEY,
Manager TEXT,
Years_opened NUMBER,
Location_of_office TEXT
);
CREATE TABLE customer_order (
Customer_ID NUMBER PRIMARY KEY,
Branch_ID NUMBER,
Dish_Name TEXT,
Quantity NUMBER,
FOREIGN KEY (Branch_ID) REFERENCES branch(Branch_ID),
FOREIGN KEY (Customer_ID) REFERENCES customer(Customer_ID)
); |
institution_sports | SELECT City , Province FROM institution | [
"SELECT",
"City",
",",
"Province",
"FROM",
"institution"
] | [
"select",
"city",
",",
"province",
"from",
"institution"
] | Return the cities and provinces of institutions. | [
"Return",
"the",
"cities",
"and",
"provinces",
"of",
"institutions",
"."
] | CREATE TABLE institution (
Institution_ID NUMBER PRIMARY KEY,
Name TEXT,
Team TEXT,
City TEXT,
Province TEXT,
Founded NUMBER,
Affiliation TEXT,
Enrollment NUMBER,
Endowment TEXT,
Stadium TEXT,
Capacity NUMBER
);
CREATE TABLE Championship (
Institution_ID NUMBER PRIMARY KEY,
Nickname TEXT,
Joined NUMBER,
Number_of_Championships NUMBER,
FOREIGN KEY (Institution_ID) REFERENCES institution(Institution_ID)
); |
soccer_3 | SELECT COUNT (DISTINCT Country) FROM player | [
"SELECT",
"COUNT",
"(",
"DISTINCT",
"Country",
")",
"FROM",
"player"
] | [
"select",
"count",
"(",
"distinct",
"country",
")",
"from",
"player"
] | What is the number of distinct countries of all players? | [
"What",
"is",
"the",
"number",
"of",
"distinct",
"countries",
"of",
"all",
"players",
"?"
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
club_leader | SELECT Nationality , COUNT(*) FROM member GROUP BY Nationality | [
"SELECT",
"Nationality",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"member",
"GROUP",
"BY",
"Nationality"
] | [
"select",
"nationality",
",",
"count",
"(",
"*",
")",
"from",
"member",
"group",
"by",
"nationality"
] | Show different nationalities along with the number of members of each nationality. | [
"Show",
"different",
"nationalities",
"along",
"with",
"the",
"number",
"of",
"members",
"of",
"each",
"nationality",
"."
] | CREATE TABLE member (
Member_ID NUMBER PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Age NUMBER
);
CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Overall_Ranking NUMBER,
Team_Leader TEXT,
Club_Name TEXT
);
CREATE TABLE club_leader (
Club_ID NUMBER PRIMARY KEY,
Member_ID NUMBER,
Year_Join TEXT,
FOREIGN KEY (Member_ID) REFERENCES member(Member_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
address_1 | SELECT avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code WHERE T2.city_name = "Boston" | [
"SELECT",
"avg",
"(",
"distance",
")",
"FROM",
"Direct_distance",
"AS",
"T1",
"JOIN",
"City",
"AS",
"T2",
"ON",
"T1.city1_code",
"=",
"T2.city_code",
"WHERE",
"T2.city_name",
"=",
"``",
"Boston",
"''"
] | [
"select",
"avg",
"(",
"distance",
")",
"from",
"direct_distance",
"as",
"t1",
"join",
"city",
"as",
"t2",
"on",
"t1",
".",
"city1_code",
"=",
"t2",
".",
"city_code",
"where",
"t2",
".",
"city_name",
"=",
"value"
] | What is the average distance between Boston and all other cities. | [
"What",
"is",
"the",
"average",
"distance",
"between",
"Boston",
"and",
"all",
"other",
"cities",
"."
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
art_1 | SELECT count(*) FROM paintings WHERE LOCATION = "Gallery 240" | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"paintings",
"WHERE",
"LOCATION",
"=",
"``",
"Gallery",
"240",
"''"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"paintings",
"where",
"location",
"=",
"value"
] | What is the total number of paintings exhibited in gallery 240? | [
"What",
"is",
"the",
"total",
"number",
"of",
"paintings",
"exhibited",
"in",
"gallery",
"240",
"?"
] | CREATE TABLE Artists (
artistID NUMBER PRIMARY KEY,
lname TEXT,
fname TEXT,
birthYear NUMBER,
deathYear NUMBER
);
CREATE TABLE Paintings (
paintingID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
height_mm NUMBER,
width_mm NUMBER,
medium TEXT,
mediumOn TEXT,
location TEXT,
painterID NUMBER,
FOREIGN KEY (painterID) REFERENCES Artists(artistID)
);
CREATE TABLE Sculptures (
sculptureID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
medium TEXT,
location TEXT,
sculptorID NUMBER,
FOREIGN KEY (sculptorID) REFERENCES Artists(artistID)
); |
aan_1 | SELECT venue FROM paper GROUP BY venue ORDER BY count(*) LIMIT 1 | [
"SELECT",
"venue",
"FROM",
"paper",
"GROUP",
"BY",
"venue",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"LIMIT",
"1"
] | [
"select",
"venue",
"from",
"paper",
"group",
"by",
"venue",
"order",
"by",
"count",
"(",
"*",
")",
"limit",
"value"
] | Which venue has the fewest publications? | [
"Which",
"venue",
"has",
"the",
"fewest",
"publications",
"?"
] | CREATE TABLE Affiliation (
affiliation_id NUMBER PRIMARY KEY,
name TEXT,
address TEXT
);
CREATE TABLE Author (
author_id NUMBER PRIMARY KEY,
name TEXT,
email TEXT
);
CREATE TABLE Author_list (
paper_id TEXT PRIMARY KEY,
author_id NUMBER,
affiliation_id NUMBER,
FOREIGN KEY (affiliation_id) REFERENCES Affiliation(affiliation_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Citation (
paper_id TEXT PRIMARY KEY,
cited_paper_id TEXT,
FOREIGN KEY (cited_paper_id) REFERENCES Paper(paper_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Paper (
paper_id TEXT PRIMARY KEY,
title TEXT,
venue TEXT,
year NUMBER
); |
region_building | SELECT T1.Address , T2.Capital FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID | [
"SELECT",
"T1.Address",
",",
"T2.Capital",
"FROM",
"building",
"AS",
"T1",
"JOIN",
"region",
"AS",
"T2",
"ON",
"T1.Region_ID",
"=",
"T2.Region_ID"
] | [
"select",
"t1",
".",
"address",
",",
"t2",
".",
"capital",
"from",
"building",
"as",
"t1",
"join",
"region",
"as",
"t2",
"on",
"t1",
".",
"region_id",
"=",
"t2",
".",
"region_id"
] | For each building, return the address of the building and the name of the region it belongs to. | [
"For",
"each",
"building",
",",
"return",
"the",
"address",
"of",
"the",
"building",
"and",
"the",
"name",
"of",
"the",
"region",
"it",
"belongs",
"to",
"."
] | CREATE TABLE building (
Building_ID NUMBER PRIMARY KEY,
Region_ID NUMBER,
Name TEXT,
Address TEXT,
Number_of_Stories NUMBER,
Completed_Year NUMBER,
FOREIGN KEY (Region_ID) REFERENCES region(Region_ID)
);
CREATE TABLE region (
Region_ID NUMBER PRIMARY KEY,
Name TEXT,
Capital TEXT,
Area NUMBER,
Population NUMBER
); |
car_racing | SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Dodge" INTERSECT SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Chevrolet" | [
"SELECT",
"t2.country",
"FROM",
"driver",
"AS",
"t1",
"JOIN",
"country",
"AS",
"t2",
"ON",
"t1.country",
"=",
"t2.country_id",
"WHERE",
"t1.Make",
"=",
"``",
"Dodge",
"''",
"INTERSECT",
"SELECT",
"t2.country",
"FROM",
"driver",
"AS",
"t1",
"JOIN",
"country",
... | [
"select",
"t2",
".",
"country",
"from",
"driver",
"as",
"t1",
"join",
"country",
"as",
"t2",
"on",
"t1",
".",
"country",
"=",
"t2",
".",
"country_id",
"where",
"t1",
".",
"make",
"=",
"value",
"intersect",
"select",
"t2",
".",
"country",
"from",
"drive... | Find the countries in which there are both drivers with make "Dodge" and drivers with make "Chevrolet". | [
"Find",
"the",
"countries",
"in",
"which",
"there",
"are",
"both",
"drivers",
"with",
"make",
"``",
"Dodge",
"''",
"and",
"drivers",
"with",
"make",
"``",
"Chevrolet",
"''",
"."
] | CREATE TABLE country (
Country_Id NUMBER PRIMARY KEY,
Country TEXT,
Capital TEXT,
Official_native_language TEXT,
Regoin TEXT
);
CREATE TABLE team (
Team_ID NUMBER PRIMARY KEY,
Team TEXT,
Make TEXT,
Manager TEXT,
Sponsor TEXT,
Car_Owner TEXT
);
CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver TEXT,
Country NUMBER,
Age NUMBER,
Car_# NUMBER,
Make TEXT,
Points TEXT,
Laps NUMBER,
Winnings TEXT
);
CREATE TABLE team_driver (
Team_ID NUMBER PRIMARY KEY,
Driver_ID NUMBER,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID),
FOREIGN KEY (Team_ID) REFERENCES team(Team_ID)
); |
art_1 | SELECT DISTINCT LOCATION FROM paintings WHERE YEAR < 1885 OR YEAR > 1930 | [
"SELECT",
"DISTINCT",
"LOCATION",
"FROM",
"paintings",
"WHERE",
"YEAR",
"<",
"1885",
"OR",
"YEAR",
">",
"1930"
] | [
"select",
"distinct",
"location",
"from",
"paintings",
"where",
"year",
"<",
"value",
"or",
"year",
">",
"value"
] | What locations have works painted before 1885 or after 1930? | [
"What",
"locations",
"have",
"works",
"painted",
"before",
"1885",
"or",
"after",
"1930",
"?"
] | CREATE TABLE Artists (
artistID NUMBER PRIMARY KEY,
lname TEXT,
fname TEXT,
birthYear NUMBER,
deathYear NUMBER
);
CREATE TABLE Paintings (
paintingID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
height_mm NUMBER,
width_mm NUMBER,
medium TEXT,
mediumOn TEXT,
location TEXT,
painterID NUMBER,
FOREIGN KEY (painterID) REFERENCES Artists(artistID)
);
CREATE TABLE Sculptures (
sculptureID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
medium TEXT,
location TEXT,
sculptorID NUMBER,
FOREIGN KEY (sculptorID) REFERENCES Artists(artistID)
); |
address_1 | SELECT DISTINCT state FROM City | [
"SELECT",
"DISTINCT",
"state",
"FROM",
"City"
] | [
"select",
"distinct",
"state",
"from",
"city"
] | What are all the distinct states? | [
"What",
"are",
"all",
"the",
"distinct",
"states",
"?"
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
real_estate_rentals | SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*) >= 2; | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Properties",
"GROUP",
"BY",
"property_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2",
";"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"properties",
"group",
"by",
"property_id",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] | How many properties are there with at least 2 features? | [
"How",
"many",
"properties",
"are",
"there",
"with",
"at",
"least",
"2",
"features",
"?"
] | CREATE TABLE Ref_Age_Categories (
age_category_code TEXT PRIMARY KEY,
age_category_description TEXT
);
CREATE TABLE Ref_Property_Types (
property_type_code TEXT PRIMARY KEY,
property_type_description TEXT
);
CREATE TABLE Ref_Room_Types (
room_type_code TEXT PRIMARY KEY,
room_type_description TEXT
);
CREATE TABLE Ref_User_Categories (
user_category_code TEXT PRIMARY KEY,
user_category_description TEXT
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
line_1_number_building TEXT,
line_2_number_street TEXT,
line_3_area_locality TEXT,
town_city TEXT,
zip_postcode TEXT,
county_state_province TEXT,
country TEXT,
other_address_details TEXT
);
CREATE TABLE Features (
feature_id NUMBER PRIMARY KEY,
feature_name TEXT,
feature_description TEXT
);
CREATE TABLE Users (
user_id NUMBER PRIMARY KEY,
age_category_code TEXT,
user_category_code TEXT,
user_address_id NUMBER,
is_buyer TEXT,
is_seller TEXT,
login_name TEXT,
password TEXT,
date_registered TIME,
first_name TEXT,
middle_name TEXT,
last_name TEXT,
other_user_details TEXT
);
CREATE TABLE Properties (
property_id NUMBER PRIMARY KEY,
property_address_id NUMBER,
owner_user_id NUMBER,
property_type_code TEXT,
date_on_market TIME,
date_off_market TIME,
property_name TEXT,
property_description TEXT,
garage_yn TEXT,
parking_lots TEXT,
room_count TEXT,
vendor_requested_price NUMBER,
price_min NUMBER,
price_max NUMBER,
other_property_details TEXT,
FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code),
FOREIGN KEY (property_address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (owner_user_id) REFERENCES Users(user_id)
);
CREATE TABLE Property_Features (
property_id NUMBER,
feature_id NUMBER,
feature_value TEXT,
property_feature_description TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (feature_id) REFERENCES Features(feature_id)
);
CREATE TABLE Property_Photos (
property_id NUMBER,
photo_seq NUMBER,
photo_title TEXT,
photo_description TEXT,
photo_filename TEXT,
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Rooms (
property_id NUMBER,
room_number TEXT,
room_type_code TEXT,
room_size TEXT,
other_room_details TEXT,
FOREIGN KEY (room_type_code) REFERENCES Ref_Room_Types(room_type_code),
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE User_Property_History (
user_id NUMBER,
property_id NUMBER,
datestamp TIME,
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE User_Searches (
user_id NUMBER,
search_seq NUMBER,
search_datetime TIME,
search_string TEXT,
FOREIGN KEY (user_id) REFERENCES Users(user_id)
); |
conference | SELECT name , nationality FROM staff WHERE staff_id NOT IN (SELECT T2.staff_id FROM Conference AS T1 JOIN Conference_participation AS T2 ON T1.conference_id = T2.conference_id WHERE T1.Conference_Name = "ACL") | [
"SELECT",
"name",
",",
"nationality",
"FROM",
"staff",
"WHERE",
"staff_id",
"NOT",
"IN",
"(",
"SELECT",
"T2.staff_id",
"FROM",
"Conference",
"AS",
"T1",
"JOIN",
"Conference_participation",
"AS",
"T2",
"ON",
"T1.conference_id",
"=",
"T2.conference_id",
"WHERE",
"T1... | [
"select",
"name",
",",
"nationality",
"from",
"staff",
"where",
"staff_id",
"not",
"in",
"(",
"select",
"t2",
".",
"staff_id",
"from",
"conference",
"as",
"t1",
"join",
"conference_participation",
"as",
"t2",
"on",
"t1",
".",
"conference_id",
"=",
"t2",
".",... | What are the names and nationalities of the people who did not participate in any ACL conferences? | [
"What",
"are",
"the",
"names",
"and",
"nationalities",
"of",
"the",
"people",
"who",
"did",
"not",
"participate",
"in",
"any",
"ACL",
"conferences",
"?"
] | CREATE TABLE conference (
Conference_ID NUMBER PRIMARY KEY,
Conference_Name TEXT,
Year NUMBER,
Location TEXT
);
CREATE TABLE institution (
Institution_ID NUMBER PRIMARY KEY,
Institution_Name TEXT,
Location TEXT,
Founded NUMBER
);
CREATE TABLE staff (
staff_ID NUMBER PRIMARY KEY,
name TEXT,
Age NUMBER,
Nationality TEXT,
Institution_ID NUMBER,
FOREIGN KEY (Institution_ID) REFERENCES institution(Institution_ID)
);
CREATE TABLE conference_participation (
Conference_ID NUMBER,
staff_ID NUMBER PRIMARY KEY,
role TEXT,
FOREIGN KEY (Conference_ID) REFERENCES conference(Conference_ID),
FOREIGN KEY (staff_ID) REFERENCES staff(staff_ID)
); |
cre_Students_Information_Systems | SELECT T1.bio_data , T2.event_date FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id = T2.student_id | [
"SELECT",
"T1.bio_data",
",",
"T2.event_date",
"FROM",
"Students",
"AS",
"T1",
"JOIN",
"Student_Events",
"AS",
"T2",
"ON",
"T1.student_id",
"=",
"T2.student_id"
] | [
"select",
"t1",
".",
"bio_data",
",",
"t2",
".",
"event_date",
"from",
"students",
"as",
"t1",
"join",
"student_events",
"as",
"t2",
"on",
"t1",
".",
"student_id",
"=",
"t2",
".",
"student_id"
] | Which students have gone through any event? List the students' biographical data and event date. | [
"Which",
"students",
"have",
"gone",
"through",
"any",
"event",
"?",
"List",
"the",
"students",
"'",
"biographical",
"data",
"and",
"event",
"date",
"."
] | CREATE TABLE Students (
student_id NUMBER PRIMARY KEY,
bio_data TEXT,
student_details TEXT
);
CREATE TABLE Transcripts (
transcript_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_transcript TIME,
transcript_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behaviour_Monitoring (
behaviour_monitoring_id NUMBER PRIMARY KEY,
student_id NUMBER,
behaviour_monitoring_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Ref_Event_Types (
event_type_code TEXT PRIMARY KEY,
event_type_description TEXT
);
CREATE TABLE Ref_Achievement_Type (
achievement_type_code TEXT PRIMARY KEY,
achievement_type_description TEXT
);
CREATE TABLE Ref_Address_Types (
address_type_code TEXT PRIMARY KEY,
address_type_description TEXT
);
CREATE TABLE Ref_Detention_Type (
detention_type_code TEXT PRIMARY KEY,
detention_type_description TEXT
);
CREATE TABLE Student_Events (
event_id NUMBER PRIMARY KEY,
event_type_code TEXT,
student_id NUMBER,
event_date TIME,
other_details TEXT,
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types(event_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Teachers (
teacher_id NUMBER PRIMARY KEY,
teacher_details TEXT
);
CREATE TABLE Student_Loans (
student_loan_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_loan TIME,
amount_of_loan NUMBER,
other_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Classes (
class_id NUMBER PRIMARY KEY,
student_id NUMBER,
teacher_id NUMBER,
class_details TEXT,
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Students_Addresses (
student_address_id NUMBER PRIMARY KEY,
address_id NUMBER,
address_type_code TEXT,
student_id NUMBER,
date_from TIME,
date_to TIME,
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types(address_type_code),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Detention (
detention_id NUMBER PRIMARY KEY,
detention_type_code TEXT,
student_id NUMBER,
datetime_detention_start TIME,
datetime_detention_end TIME,
detention_summary TEXT,
other_details TEXT,
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Achievements (
achievement_id NUMBER PRIMARY KEY,
achievement_type_code TEXT,
student_id NUMBER,
date_achievement TIME,
achievement_details TEXT,
other_details TEXT,
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type(achievement_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
); |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1 | [
"SELECT",
"item",
"FROM",
"items",
"GROUP",
"BY",
"item",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"LIMIT",
"1"
] | [
"select",
"item",
"from",
"items",
"group",
"by",
"item",
"order",
"by",
"count",
"(",
"*",
")",
"limit",
"value"
] | What is the item that was bought the least number of times? | [
"What",
"is",
"the",
"item",
"that",
"was",
"bought",
"the",
"least",
"number",
"of",
"times",
"?"
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
art_1 | SELECT T1.lname , T1.fname FROM artists AS T1 JOIN sculptures AS T2 ON T1.artistID = T2.sculptorID INTERSECT SELECT T3.lname , T3.fname FROM artists AS T3 JOIN paintings AS T4 ON T3.artistID = T4.painterID | [
"SELECT",
"T1.lname",
",",
"T1.fname",
"FROM",
"artists",
"AS",
"T1",
"JOIN",
"sculptures",
"AS",
"T2",
"ON",
"T1.artistID",
"=",
"T2.sculptorID",
"INTERSECT",
"SELECT",
"T3.lname",
",",
"T3.fname",
"FROM",
"artists",
"AS",
"T3",
"JOIN",
"paintings",
"AS",
"T4... | [
"select",
"t1",
".",
"lname",
",",
"t1",
".",
"fname",
"from",
"artists",
"as",
"t1",
"join",
"sculptures",
"as",
"t2",
"on",
"t1",
".",
"artistid",
"=",
"t2",
".",
"sculptorid",
"intersect",
"select",
"t3",
".",
"lname",
",",
"t3",
".",
"fname",
"fr... | Give the full names of artists who have created paintings and sculptures. | [
"Give",
"the",
"full",
"names",
"of",
"artists",
"who",
"have",
"created",
"paintings",
"and",
"sculptures",
"."
] | CREATE TABLE Artists (
artistID NUMBER PRIMARY KEY,
lname TEXT,
fname TEXT,
birthYear NUMBER,
deathYear NUMBER
);
CREATE TABLE Paintings (
paintingID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
height_mm NUMBER,
width_mm NUMBER,
medium TEXT,
mediumOn TEXT,
location TEXT,
painterID NUMBER,
FOREIGN KEY (painterID) REFERENCES Artists(artistID)
);
CREATE TABLE Sculptures (
sculptureID NUMBER PRIMARY KEY,
title TEXT,
year NUMBER,
medium TEXT,
location TEXT,
sculptorID NUMBER,
FOREIGN KEY (sculptorID) REFERENCES Artists(artistID)
); |
warehouse_1 | SELECT DISTINCT warehouse FROM boxes WHERE CONTENTS = 'Rocks' OR CONTENTS = 'Scissors' | [
"SELECT",
"DISTINCT",
"warehouse",
"FROM",
"boxes",
"WHERE",
"CONTENTS",
"=",
"'Rocks",
"'",
"OR",
"CONTENTS",
"=",
"'Scissors",
"'"
] | [
"select",
"distinct",
"warehouse",
"from",
"boxes",
"where",
"contents",
"=",
"value",
"or",
"contents",
"=",
"value"
] | What are the distinct warehouses that have boxes with Rocks or Scissors as contents? | [
"What",
"are",
"the",
"distinct",
"warehouses",
"that",
"have",
"boxes",
"with",
"Rocks",
"or",
"Scissors",
"as",
"contents",
"?"
] | CREATE TABLE Warehouses (
Code NUMBER PRIMARY KEY,
Location TEXT,
Capacity NUMBER
);
CREATE TABLE Boxes (
Code TEXT PRIMARY KEY,
Contents TEXT,
Value NUMBER,
Warehouse NUMBER,
FOREIGN KEY (Warehouse) REFERENCES Warehouses(Code)
); |
boat_1 | SELECT name FROM Sailors WHERE rating > (SELECT max(T1.rating) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.color = 'red') | [
"SELECT",
"name",
"FROM",
"Sailors",
"WHERE",
"rating",
">",
"(",
"SELECT",
"max",
"(",
"T1.rating",
")",
"FROM",
"Sailors",
"AS",
"T1",
"JOIN",
"Reserves",
"AS",
"T2",
"ON",
"T1.sid",
"=",
"T2.sid",
"JOIN",
"Boats",
"AS",
"T3",
"ON",
"T3.bid",
"=",
"T... | [
"select",
"name",
"from",
"sailors",
"where",
"rating",
">",
"(",
"select",
"max",
"(",
"t1",
".",
"rating",
")",
"from",
"sailors",
"as",
"t1",
"join",
"reserves",
"as",
"t2",
"on",
"t1",
".",
"sid",
"=",
"t2",
".",
"sid",
"join",
"boats",
"as",
"... | Find the names of sailors whose rating is larger than the rating of all sailors who booked a red boat. | [
"Find",
"the",
"names",
"of",
"sailors",
"whose",
"rating",
"is",
"larger",
"than",
"the",
"rating",
"of",
"all",
"sailors",
"who",
"booked",
"a",
"red",
"boat",
"."
] | CREATE TABLE Sailors (
sid NUMBER PRIMARY KEY,
name TEXT,
rating NUMBER,
age NUMBER
);
CREATE TABLE Boats (
bid NUMBER PRIMARY KEY,
name TEXT,
color TEXT
);
CREATE TABLE Reserves (
sid NUMBER,
bid NUMBER,
day TEXT,
FOREIGN KEY (bid) REFERENCES Boats(bid),
FOREIGN KEY (sid) REFERENCES Sailors(sid)
); |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3 | [
"SELECT",
"item",
"FROM",
"items",
"GROUP",
"BY",
"item",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"3"
] | [
"select",
"item",
"from",
"items",
"group",
"by",
"item",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | Give the three most purchased items at this bakery. | [
"Give",
"the",
"three",
"most",
"purchased",
"items",
"at",
"this",
"bakery",
"."
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
aan_1 | SELECT count(DISTINCT T1.paper_id) FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T1.year >= 2000 AND T1.year <= 2009 AND T3.name LIKE "Stanford University" | [
"SELECT",
"count",
"(",
"DISTINCT",
"T1.paper_id",
")",
"FROM",
"Paper",
"AS",
"T1",
"JOIN",
"Author_list",
"AS",
"T2",
"ON",
"T1.paper_id",
"=",
"T2.paper_id",
"JOIN",
"Affiliation",
"AS",
"T3",
"ON",
"T2.affiliation_id",
"=",
"T3.affiliation_id",
"WHERE",
"T1.... | [
"select",
"count",
"(",
"distinct",
"t1",
".",
"paper_id",
")",
"from",
"paper",
"as",
"t1",
"join",
"author_list",
"as",
"t2",
"on",
"t1",
".",
"paper_id",
"=",
"t2",
".",
"paper_id",
"join",
"affiliation",
"as",
"t3",
"on",
"t2",
".",
"affiliation_id",... | Count the number of papers Stanford University had between 2000 and 2009. | [
"Count",
"the",
"number",
"of",
"papers",
"Stanford",
"University",
"had",
"between",
"2000",
"and",
"2009",
"."
] | CREATE TABLE Affiliation (
affiliation_id NUMBER PRIMARY KEY,
name TEXT,
address TEXT
);
CREATE TABLE Author (
author_id NUMBER PRIMARY KEY,
name TEXT,
email TEXT
);
CREATE TABLE Author_list (
paper_id TEXT PRIMARY KEY,
author_id NUMBER,
affiliation_id NUMBER,
FOREIGN KEY (affiliation_id) REFERENCES Affiliation(affiliation_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Citation (
paper_id TEXT PRIMARY KEY,
cited_paper_id TEXT,
FOREIGN KEY (cited_paper_id) REFERENCES Paper(paper_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Paper (
paper_id TEXT PRIMARY KEY,
title TEXT,
venue TEXT,
year NUMBER
); |
address_1 | SELECT T3.city_name FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code = T2.city_code JOIN City AS T3 ON T1.city2_code = T3.city_code WHERE T2.city_name = "Boston" ORDER BY distance DESC LIMIT 1 | [
"SELECT",
"T3.city_name",
"FROM",
"Direct_distance",
"AS",
"T1",
"JOIN",
"City",
"AS",
"T2",
"ON",
"T1.city1_code",
"=",
"T2.city_code",
"JOIN",
"City",
"AS",
"T3",
"ON",
"T1.city2_code",
"=",
"T3.city_code",
"WHERE",
"T2.city_name",
"=",
"``",
"Boston",
"''",
... | [
"select",
"t3",
".",
"city_name",
"from",
"direct_distance",
"as",
"t1",
"join",
"city",
"as",
"t2",
"on",
"t1",
".",
"city1_code",
"=",
"t2",
".",
"city_code",
"join",
"city",
"as",
"t3",
"on",
"t1",
".",
"city2_code",
"=",
"t3",
".",
"city_code",
"wh... | Give the city name of the city with greatest distance from Boston. | [
"Give",
"the",
"city",
"name",
"of",
"the",
"city",
"with",
"greatest",
"distance",
"from",
"Boston",
"."
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
address_1 | SELECT sum(distance) FROM Direct_distance WHERE city1_code = "BAL" | [
"SELECT",
"sum",
"(",
"distance",
")",
"FROM",
"Direct_distance",
"WHERE",
"city1_code",
"=",
"``",
"BAL",
"''"
] | [
"select",
"sum",
"(",
"distance",
")",
"from",
"direct_distance",
"where",
"city1_code",
"=",
"value"
] | What is the total distance between city BAL and all other cities. | [
"What",
"is",
"the",
"total",
"distance",
"between",
"city",
"BAL",
"and",
"all",
"other",
"cities",
"."
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
e_commerce | select product_color , product_description , product_size from products where product_price != ( select max(product_price) from products ) | [
"select",
"product_color",
",",
"product_description",
",",
"product_size",
"from",
"products",
"where",
"product_price",
"!=",
"(",
"select",
"max",
"(",
"product_price",
")",
"from",
"products",
")"
] | [
"select",
"product_color",
",",
"product_description",
",",
"product_size",
"from",
"products",
"where",
"product_price",
"!",
"=",
"(",
"select",
"max",
"(",
"product_price",
")",
"from",
"products",
")"
] | What are the colors , descriptions , and sizes for all products that are not at the maximum price ? | [
"What",
"are",
"the",
"colors",
",",
"descriptions",
",",
"and",
"sizes",
"for",
"all",
"products",
"that",
"are",
"not",
"at",
"the",
"maximum",
"price",
"?"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
parent_product_id NUMBER,
product_name TEXT,
product_price NUMBER,
product_color TEXT,
product_size TEXT,
product_description TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
gender_code TEXT,
customer_first_name TEXT,
customer_middle_initial TEXT,
customer_last_name TEXT,
email_address TEXT,
login_name TEXT,
login_password TEXT,
phone_number TEXT,
address_line_1 TEXT,
town_city TEXT,
county TEXT,
country TEXT
);
CREATE TABLE Customer_Payment_Methods (
customer_id NUMBER,
payment_method_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Invoices (
invoice_number NUMBER PRIMARY KEY,
invoice_status_code TEXT,
invoice_date TIME
);
CREATE TABLE Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_status_code TEXT,
date_order_placed TIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER PRIMARY KEY,
product_id NUMBER,
order_id NUMBER,
order_item_status_code TEXT,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Shipments (
shipment_id NUMBER PRIMARY KEY,
order_id NUMBER,
invoice_number NUMBER,
shipment_tracking_number TEXT,
shipment_date TIME,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number)
);
CREATE TABLE Shipment_Items (
shipment_id NUMBER PRIMARY KEY,
order_item_id NUMBER,
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id),
FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id)
); |
aan_1 | SELECT venue , YEAR FROM paper GROUP BY venue , YEAR ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"venue",
",",
"YEAR",
"FROM",
"paper",
"GROUP",
"BY",
"venue",
",",
"YEAR",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"venue",
",",
"year",
"from",
"paper",
"group",
"by",
"venue",
",",
"year",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | What was the venue and year with the most publications? | [
"What",
"was",
"the",
"venue",
"and",
"year",
"with",
"the",
"most",
"publications",
"?"
] | CREATE TABLE Affiliation (
affiliation_id NUMBER PRIMARY KEY,
name TEXT,
address TEXT
);
CREATE TABLE Author (
author_id NUMBER PRIMARY KEY,
name TEXT,
email TEXT
);
CREATE TABLE Author_list (
paper_id TEXT PRIMARY KEY,
author_id NUMBER,
affiliation_id NUMBER,
FOREIGN KEY (affiliation_id) REFERENCES Affiliation(affiliation_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Citation (
paper_id TEXT PRIMARY KEY,
cited_paper_id TEXT,
FOREIGN KEY (cited_paper_id) REFERENCES Paper(paper_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Paper (
paper_id TEXT PRIMARY KEY,
title TEXT,
venue TEXT,
year NUMBER
); |
cre_Students_Information_Systems | select bio_data from students where student_id not in (select t1.student_id from students as t1 join detention as t2 on t1.student_id = t2.student_id union select t1.student_id from students as t1 join student_loans as t2 on t1.student_id = t2.student_id) | [
"select",
"bio_data",
"from",
"students",
"where",
"student_id",
"not",
"in",
"(",
"select",
"t1.student_id",
"from",
"students",
"as",
"t1",
"join",
"detention",
"as",
"t2",
"on",
"t1.student_id",
"=",
"t2.student_id",
"union",
"select",
"t1.student_id",
"from",
... | [
"select",
"bio_data",
"from",
"students",
"where",
"student_id",
"not",
"in",
"(",
"select",
"t1",
".",
"student_id",
"from",
"students",
"as",
"t1",
"join",
"detention",
"as",
"t2",
"on",
"t1",
".",
"student_id",
"=",
"t2",
".",
"student_id",
"union",
"se... | List the biographical data of the students who never had a detention or student loan . | [
"List",
"the",
"biographical",
"data",
"of",
"the",
"students",
"who",
"never",
"had",
"a",
"detention",
"or",
"student",
"loan",
"."
] | CREATE TABLE Students (
student_id NUMBER PRIMARY KEY,
bio_data TEXT,
student_details TEXT
);
CREATE TABLE Transcripts (
transcript_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_transcript TIME,
transcript_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behaviour_Monitoring (
behaviour_monitoring_id NUMBER PRIMARY KEY,
student_id NUMBER,
behaviour_monitoring_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Ref_Event_Types (
event_type_code TEXT PRIMARY KEY,
event_type_description TEXT
);
CREATE TABLE Ref_Achievement_Type (
achievement_type_code TEXT PRIMARY KEY,
achievement_type_description TEXT
);
CREATE TABLE Ref_Address_Types (
address_type_code TEXT PRIMARY KEY,
address_type_description TEXT
);
CREATE TABLE Ref_Detention_Type (
detention_type_code TEXT PRIMARY KEY,
detention_type_description TEXT
);
CREATE TABLE Student_Events (
event_id NUMBER PRIMARY KEY,
event_type_code TEXT,
student_id NUMBER,
event_date TIME,
other_details TEXT,
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types(event_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Teachers (
teacher_id NUMBER PRIMARY KEY,
teacher_details TEXT
);
CREATE TABLE Student_Loans (
student_loan_id NUMBER PRIMARY KEY,
student_id NUMBER,
date_of_loan TIME,
amount_of_loan NUMBER,
other_details TEXT,
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Classes (
class_id NUMBER PRIMARY KEY,
student_id NUMBER,
teacher_id NUMBER,
class_details TEXT,
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Students_Addresses (
student_address_id NUMBER PRIMARY KEY,
address_id NUMBER,
address_type_code TEXT,
student_id NUMBER,
date_from TIME,
date_to TIME,
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types(address_type_code),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Detention (
detention_id NUMBER PRIMARY KEY,
detention_type_code TEXT,
student_id NUMBER,
datetime_detention_start TIME,
datetime_detention_end TIME,
detention_summary TEXT,
other_details TEXT,
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Achievements (
achievement_id NUMBER PRIMARY KEY,
achievement_type_code TEXT,
student_id NUMBER,
date_achievement TIME,
achievement_details TEXT,
other_details TEXT,
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type(achievement_type_code),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
); |
soccer_3 | SELECT Name FROM player ORDER BY Wins_count ASC | [
"SELECT",
"Name",
"FROM",
"player",
"ORDER",
"BY",
"Wins_count",
"ASC"
] | [
"select",
"name",
"from",
"player",
"order",
"by",
"wins_count",
"asc"
] | What are the names of players in ascending order of wins count? | [
"What",
"are",
"the",
"names",
"of",
"players",
"in",
"ascending",
"order",
"of",
"wins",
"count",
"?"
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
e_commerce | SELECT order_status_code FROM Orders GROUP BY order_status_code ORDER BY count(*) LIMIT 1 | [
"SELECT",
"order_status_code",
"FROM",
"Orders",
"GROUP",
"BY",
"order_status_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"LIMIT",
"1"
] | [
"select",
"order_status_code",
"from",
"orders",
"group",
"by",
"order_status_code",
"order",
"by",
"count",
"(",
"*",
")",
"limit",
"value"
] | What is the most uncommon order status? | [
"What",
"is",
"the",
"most",
"uncommon",
"order",
"status",
"?"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
parent_product_id NUMBER,
product_name TEXT,
product_price NUMBER,
product_color TEXT,
product_size TEXT,
product_description TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
gender_code TEXT,
customer_first_name TEXT,
customer_middle_initial TEXT,
customer_last_name TEXT,
email_address TEXT,
login_name TEXT,
login_password TEXT,
phone_number TEXT,
address_line_1 TEXT,
town_city TEXT,
county TEXT,
country TEXT
);
CREATE TABLE Customer_Payment_Methods (
customer_id NUMBER,
payment_method_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Invoices (
invoice_number NUMBER PRIMARY KEY,
invoice_status_code TEXT,
invoice_date TIME
);
CREATE TABLE Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_status_code TEXT,
date_order_placed TIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER PRIMARY KEY,
product_id NUMBER,
order_id NUMBER,
order_item_status_code TEXT,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Shipments (
shipment_id NUMBER PRIMARY KEY,
order_id NUMBER,
invoice_number NUMBER,
shipment_tracking_number TEXT,
shipment_date TIME,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number)
);
CREATE TABLE Shipment_Items (
shipment_id NUMBER PRIMARY KEY,
order_item_id NUMBER,
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id),
FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id)
); |
car_racing | SELECT max(Points) , min(Points) FROM driver | [
"SELECT",
"max",
"(",
"Points",
")",
",",
"min",
"(",
"Points",
")",
"FROM",
"driver"
] | [
"select",
"max",
"(",
"points",
")",
",",
"min",
"(",
"points",
")",
"from",
"driver"
] | What are the maximum and minimum points of drivers. | [
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"points",
"of",
"drivers",
"."
] | CREATE TABLE country (
Country_Id NUMBER PRIMARY KEY,
Country TEXT,
Capital TEXT,
Official_native_language TEXT,
Regoin TEXT
);
CREATE TABLE team (
Team_ID NUMBER PRIMARY KEY,
Team TEXT,
Make TEXT,
Manager TEXT,
Sponsor TEXT,
Car_Owner TEXT
);
CREATE TABLE driver (
Driver_ID NUMBER PRIMARY KEY,
Driver TEXT,
Country NUMBER,
Age NUMBER,
Car_# NUMBER,
Make TEXT,
Points TEXT,
Laps NUMBER,
Winnings TEXT
);
CREATE TABLE team_driver (
Team_ID NUMBER PRIMARY KEY,
Driver_ID NUMBER,
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID),
FOREIGN KEY (Team_ID) REFERENCES team(Team_ID)
); |
address_1 | SELECT latitude , longitude FROM City WHERE city_name = "Baltimore" | [
"SELECT",
"latitude",
",",
"longitude",
"FROM",
"City",
"WHERE",
"city_name",
"=",
"``",
"Baltimore",
"''"
] | [
"select",
"latitude",
",",
"longitude",
"from",
"city",
"where",
"city_name",
"=",
"value"
] | What is the latitude and longitude for Baltimore? | [
"What",
"is",
"the",
"latitude",
"and",
"longitude",
"for",
"Baltimore",
"?"
] | CREATE TABLE Student (
StuID NUMBER PRIMARY KEY,
LName TEXT,
Fname TEXT,
Age NUMBER,
Sex TEXT,
Major NUMBER,
Advisor NUMBER,
city_code TEXT,
FOREIGN KEY (city_code) REFERENCES City(city_code)
);
CREATE TABLE Direct_distance (
city1_code TEXT,
city2_code TEXT,
distance NUMBER,
FOREIGN KEY (city2_code) REFERENCES City(city_code),
FOREIGN KEY (city1_code) REFERENCES City(city_code)
);
CREATE TABLE City (
city_code TEXT PRIMARY KEY,
city_name TEXT,
state TEXT,
country TEXT,
latitude NUMBER,
longitude NUMBER
); |
vehicle_rent | SELECT count(*) FROM vehicles | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"vehicles"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"vehicles"
] | How many vehicles do we have? | [
"How",
"many",
"vehicles",
"do",
"we",
"have",
"?"
] | CREATE TABLE Customers (
id NUMBER PRIMARY KEY,
name TEXT,
age NUMBER,
membership_credit NUMBER
);
CREATE TABLE Discount (
id NUMBER PRIMARY KEY,
name TEXT,
membership_credit NUMBER
);
CREATE TABLE Vehicles (
id NUMBER PRIMARY KEY,
name TEXT,
Model_year NUMBER,
Type_of_powertrain TEXT,
Combined_fuel_economy_rate NUMBER,
City_fuel_economy_rate NUMBER,
Highway_fuel_economy_rate NUMBER,
Cost_per_25_miles NUMBER,
Annual_fuel_cost NUMBER,
Notes TEXT
);
CREATE TABLE Renting_history (
id NUMBER PRIMARY KEY,
customer_id NUMBER,
discount_id NUMBER,
vehicles_id NUMBER,
total_hours NUMBER,
FOREIGN KEY (discount_id) REFERENCES Discount(id),
FOREIGN KEY (vehicles_id) REFERENCES Vehicles(id),
FOREIGN KEY (customer_id) REFERENCES Customers(id)
); |
advertising_agencies | SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"invoice_status",
"FROM",
"Invoices",
"GROUP",
"BY",
"invoice_status",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"invoice_status",
"from",
"invoices",
"group",
"by",
"invoice_status",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | What is the invoice status code with most number of invoices. | [
"What",
"is",
"the",
"invoice",
"status",
"code",
"with",
"most",
"number",
"of",
"invoices",
"."
] | CREATE TABLE Agencies (
agency_id NUMBER PRIMARY KEY,
agency_details TEXT
);
CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
agency_id NUMBER,
staff_details TEXT
);
CREATE TABLE Clients (
client_id NUMBER PRIMARY KEY,
agency_id NUMBER,
sic_code TEXT,
client_details TEXT,
FOREIGN KEY (agency_id) REFERENCES Agencies(agency_id)
);
CREATE TABLE Invoices (
invoice_id NUMBER PRIMARY KEY,
client_id NUMBER,
invoice_status TEXT,
invoice_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Meetings (
meeting_id NUMBER PRIMARY KEY,
client_id NUMBER,
meeting_outcome TEXT,
meeting_type TEXT,
billable_yn TEXT,
start_date_time TIME,
end_date_time TIME,
purpose_of_meeting TEXT,
other_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Payments (
payment_id NUMBER,
invoice_id NUMBER,
payment_details TEXT,
FOREIGN KEY (invoice_id) REFERENCES Invoices(invoice_id)
);
CREATE TABLE Staff_in_Meetings (
meeting_id NUMBER,
staff_id NUMBER,
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (meeting_id) REFERENCES Meetings(meeting_id)
); |
boat_1 | SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = 'red' INTERSECT SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON T1.bid = T2.bid WHERE T1.color = "blue" | [
"SELECT",
"DISTINCT",
"T2.sid",
"FROM",
"Boats",
"AS",
"T1",
"JOIN",
"Reserves",
"AS",
"T2",
"ON",
"T1.bid",
"=",
"T2.bid",
"WHERE",
"T1.color",
"=",
"'red",
"'",
"INTERSECT",
"SELECT",
"DISTINCT",
"T2.sid",
"FROM",
"Boats",
"AS",
"T1",
"JOIN",
"Reserves",
... | [
"select",
"distinct",
"t2",
".",
"sid",
"from",
"boats",
"as",
"t1",
"join",
"reserves",
"as",
"t2",
"on",
"t1",
".",
"bid",
"=",
"t2",
".",
"bid",
"where",
"t1",
".",
"color",
"=",
"value",
"intersect",
"select",
"distinct",
"t2",
".",
"sid",
"from"... | Find the id of Sailors (sid) that reserved red and blue boat. | [
"Find",
"the",
"id",
"of",
"Sailors",
"(",
"sid",
")",
"that",
"reserved",
"red",
"and",
"blue",
"boat",
"."
] | CREATE TABLE Sailors (
sid NUMBER PRIMARY KEY,
name TEXT,
rating NUMBER,
age NUMBER
);
CREATE TABLE Boats (
bid NUMBER PRIMARY KEY,
name TEXT,
color TEXT
);
CREATE TABLE Reserves (
sid NUMBER,
bid NUMBER,
day TEXT,
FOREIGN KEY (bid) REFERENCES Boats(bid),
FOREIGN KEY (sid) REFERENCES Sailors(sid)
); |
boat_1 | SELECT name FROM Sailors WHERE name LIKE '%e%' | [
"SELECT",
"name",
"FROM",
"Sailors",
"WHERE",
"name",
"LIKE",
"'",
"%",
"e",
"%",
"'"
] | [
"select",
"name",
"from",
"sailors",
"where",
"name",
"like",
"value"
] | What is the name of sailors whose names contain letter e? | [
"What",
"is",
"the",
"name",
"of",
"sailors",
"whose",
"names",
"contain",
"letter",
"e",
"?"
] | CREATE TABLE Sailors (
sid NUMBER PRIMARY KEY,
name TEXT,
rating NUMBER,
age NUMBER
);
CREATE TABLE Boats (
bid NUMBER PRIMARY KEY,
name TEXT,
color TEXT
);
CREATE TABLE Reserves (
sid NUMBER,
bid NUMBER,
day TEXT,
FOREIGN KEY (bid) REFERENCES Boats(bid),
FOREIGN KEY (sid) REFERENCES Sailors(sid)
); |
aan_1 | SELECT DISTINCT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown , Kathleen%" OR T3.name LIKE "%Rambow , Owen%" | [
"SELECT",
"DISTINCT",
"T1.title",
",",
"T1.paper_id",
"FROM",
"Paper",
"AS",
"T1",
"JOIN",
"Author_list",
"AS",
"T2",
"ON",
"T1.paper_id",
"=",
"T2.paper_id",
"JOIN",
"Author",
"AS",
"T3",
"ON",
"T2.author_id",
"=",
"T3.author_id",
"WHERE",
"T3.name",
"LIKE",
... | [
"select",
"distinct",
"t1",
".",
"title",
",",
"t1",
".",
"paper_id",
"from",
"paper",
"as",
"t1",
"join",
"author_list",
"as",
"t2",
"on",
"t1",
".",
"paper_id",
"=",
"t2",
".",
"paper_id",
"join",
"author",
"as",
"t3",
"on",
"t2",
".",
"author_id",
... | What are the titles and paper ids for papers that have Mckeown, Kathleen or Rambow, Owen in their author list? | [
"What",
"are",
"the",
"titles",
"and",
"paper",
"ids",
"for",
"papers",
"that",
"have",
"Mckeown",
",",
"Kathleen",
"or",
"Rambow",
",",
"Owen",
"in",
"their",
"author",
"list",
"?"
] | CREATE TABLE Affiliation (
affiliation_id NUMBER PRIMARY KEY,
name TEXT,
address TEXT
);
CREATE TABLE Author (
author_id NUMBER PRIMARY KEY,
name TEXT,
email TEXT
);
CREATE TABLE Author_list (
paper_id TEXT PRIMARY KEY,
author_id NUMBER,
affiliation_id NUMBER,
FOREIGN KEY (affiliation_id) REFERENCES Affiliation(affiliation_id),
FOREIGN KEY (author_id) REFERENCES Author(author_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Citation (
paper_id TEXT PRIMARY KEY,
cited_paper_id TEXT,
FOREIGN KEY (cited_paper_id) REFERENCES Paper(paper_id),
FOREIGN KEY (paper_id) REFERENCES Paper(paper_id)
);
CREATE TABLE Paper (
paper_id TEXT PRIMARY KEY,
title TEXT,
venue TEXT,
year NUMBER
); |
advertising_agencies | SELECT count(*) FROM Staff | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Staff"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"staff"
] | Count the number of staff. | [
"Count",
"the",
"number",
"of",
"staff",
"."
] | CREATE TABLE Agencies (
agency_id NUMBER PRIMARY KEY,
agency_details TEXT
);
CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
agency_id NUMBER,
staff_details TEXT
);
CREATE TABLE Clients (
client_id NUMBER PRIMARY KEY,
agency_id NUMBER,
sic_code TEXT,
client_details TEXT,
FOREIGN KEY (agency_id) REFERENCES Agencies(agency_id)
);
CREATE TABLE Invoices (
invoice_id NUMBER PRIMARY KEY,
client_id NUMBER,
invoice_status TEXT,
invoice_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Meetings (
meeting_id NUMBER PRIMARY KEY,
client_id NUMBER,
meeting_outcome TEXT,
meeting_type TEXT,
billable_yn TEXT,
start_date_time TIME,
end_date_time TIME,
purpose_of_meeting TEXT,
other_details TEXT,
FOREIGN KEY (client_id) REFERENCES Clients(client_id)
);
CREATE TABLE Payments (
payment_id NUMBER,
invoice_id NUMBER,
payment_details TEXT,
FOREIGN KEY (invoice_id) REFERENCES Invoices(invoice_id)
);
CREATE TABLE Staff_in_Meetings (
meeting_id NUMBER,
staff_id NUMBER,
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (meeting_id) REFERENCES Meetings(meeting_id)
); |
online_exams | SELECT Exam_Date , Exam_Name FROM Exams WHERE Subject_Code != 'Database' | [
"SELECT",
"Exam_Date",
",",
"Exam_Name",
"FROM",
"Exams",
"WHERE",
"Subject_Code",
"!",
"=",
"'Database",
"'"
] | [
"select",
"exam_date",
",",
"exam_name",
"from",
"exams",
"where",
"subject_code",
"!",
"=",
"value"
] | What are the names and dates of the exams with subject code that is not "Database"? | [
"What",
"are",
"the",
"names",
"and",
"dates",
"of",
"the",
"exams",
"with",
"subject",
"code",
"that",
"is",
"not",
"``",
"Database",
"''",
"?"
] | CREATE TABLE Students (
Student_ID NUMBER PRIMARY KEY,
First_Name TEXT,
Middle_Name TEXT,
Last_Name TEXT,
Gender_MFU TEXT,
Student_Address TEXT,
Email_Adress TEXT,
Cell_Mobile_Phone TEXT,
Home_Phone TEXT
);
CREATE TABLE Questions (
Question_ID NUMBER PRIMARY KEY,
Type_of_Question_Code TEXT,
Question_Text TEXT
);
CREATE TABLE Exams (
Exam_ID NUMBER PRIMARY KEY,
Subject_Code TEXT,
Exam_Date TIME,
Exam_Name TEXT
);
CREATE TABLE Questions_in_Exams (
Exam_ID NUMBER PRIMARY KEY,
Question_ID NUMBER,
FOREIGN KEY (Exam_ID) REFERENCES Exams(Exam_ID),
FOREIGN KEY (Question_ID) REFERENCES Questions(Question_ID)
);
CREATE TABLE Valid_Answers (
Valid_Answer_ID NUMBER PRIMARY KEY,
Question_ID NUMBER,
Valid_Answer_Text TEXT,
FOREIGN KEY (Question_ID) REFERENCES Questions(Question_ID)
);
CREATE TABLE Student_Answers (
Student_Answer_ID NUMBER PRIMARY KEY,
Exam_ID NUMBER,
Question_ID NUMBER,
Student_ID NUMBER,
Date_of_Answer TIME,
Comments TEXT,
Satisfactory_YN TEXT,
Student_Answer_Text TEXT,
FOREIGN KEY (Exam_ID) REFERENCES Questions_in_Exams(Exam_ID),
FOREIGN KEY (Question_ID) REFERENCES Questions_in_Exams(Question_ID),
FOREIGN KEY (Student_ID) REFERENCES Students(Student_ID)
);
CREATE TABLE Student_Assessments (
Student_Answer_ID TEXT PRIMARY KEY,
Valid_Answer_ID NUMBER,
Student_Answer_Text TEXT,
Satisfactory_YN TEXT,
Assessment TEXT,
FOREIGN KEY (Valid_Answer_ID) REFERENCES Valid_Answers(Valid_Answer_ID)
); |
soccer_3 | SELECT T2.Name , T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID | [
"SELECT",
"T2.Name",
",",
"T1.Name",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID"
] | [
"select",
"t2",
".",
"name",
",",
"t1",
".",
"name",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id"
] | What are the names of players and the corresponding clubs that they are in? | [
"What",
"are",
"the",
"names",
"of",
"players",
"and",
"the",
"corresponding",
"clubs",
"that",
"they",
"are",
"in",
"?"
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
customers_and_orders | SELECT product_id , product_type_code , product_name FROM Products | [
"SELECT",
"product_id",
",",
"product_type_code",
",",
"product_name",
"FROM",
"Products"
] | [
"select",
"product_id",
",",
"product_type_code",
",",
"product_name",
"from",
"products"
] | What are the ids, type codes, and names for all products? | [
"What",
"are",
"the",
"ids",
",",
"type",
"codes",
",",
"and",
"names",
"for",
"all",
"products",
"?"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
product_type_code TEXT,
product_name TEXT,
product_price NUMBER
);
CREATE TABLE Addresses (
address_id NUMBER PRIMARY KEY,
address_details TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
address_id NUMBER,
payment_method_code TEXT,
customer_number TEXT,
customer_name TEXT,
customer_address TEXT,
customer_phone TEXT,
customer_email TEXT
);
CREATE TABLE Customer_Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_date TIME,
order_status_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER,
order_id NUMBER,
product_id NUMBER,
order_quantity TEXT,
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id)
); |
e_commerce | SELECT T1.gender_code , count(*) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.gender_code | [
"SELECT",
"T1.gender_code",
",",
"count",
"(",
"*",
")",
"FROM",
"Customers",
"AS",
"T1",
"JOIN",
"Orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"Order_items",
"AS",
"T3",
"ON",
"T2.order_id",
"=",
"T3.order_id",
"GROUP",
"BY",
... | [
"select",
"t1",
".",
"gender_code",
",",
"count",
"(",
"*",
")",
"from",
"customers",
"as",
"t1",
"join",
"orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t2",
".",
"order_id... | How many number of products does each gender of customers buy? List the gender and the number | [
"How",
"many",
"number",
"of",
"products",
"does",
"each",
"gender",
"of",
"customers",
"buy",
"?",
"List",
"the",
"gender",
"and",
"the",
"number"
] | CREATE TABLE Products (
product_id NUMBER PRIMARY KEY,
parent_product_id NUMBER,
product_name TEXT,
product_price NUMBER,
product_color TEXT,
product_size TEXT,
product_description TEXT
);
CREATE TABLE Customers (
customer_id NUMBER PRIMARY KEY,
gender_code TEXT,
customer_first_name TEXT,
customer_middle_initial TEXT,
customer_last_name TEXT,
email_address TEXT,
login_name TEXT,
login_password TEXT,
phone_number TEXT,
address_line_1 TEXT,
town_city TEXT,
county TEXT,
country TEXT
);
CREATE TABLE Customer_Payment_Methods (
customer_id NUMBER,
payment_method_code TEXT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Invoices (
invoice_number NUMBER PRIMARY KEY,
invoice_status_code TEXT,
invoice_date TIME
);
CREATE TABLE Orders (
order_id NUMBER PRIMARY KEY,
customer_id NUMBER,
order_status_code TEXT,
date_order_placed TIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id NUMBER PRIMARY KEY,
product_id NUMBER,
order_id NUMBER,
order_item_status_code TEXT,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Shipments (
shipment_id NUMBER PRIMARY KEY,
order_id NUMBER,
invoice_number NUMBER,
shipment_tracking_number TEXT,
shipment_date TIME,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number)
);
CREATE TABLE Shipment_Items (
shipment_id NUMBER PRIMARY KEY,
order_item_id NUMBER,
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id),
FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id)
); |
soccer_3 | SELECT T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Wins_count > 2 | [
"SELECT",
"T1.Name",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"WHERE",
"T2.Wins_count",
">",
"2"
] | [
"select",
"t1",
".",
"name",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"where",
"t2",
".",
"wins_count",
">",
"value"
] | Show names of clubs that have players with more than 2 win counts. | [
"Show",
"names",
"of",
"clubs",
"that",
"have",
"players",
"with",
"more",
"than",
"2",
"win",
"counts",
"."
] | CREATE TABLE club (
Club_ID NUMBER PRIMARY KEY,
Name TEXT,
Manager TEXT,
Captain TEXT,
Manufacturer TEXT,
Sponsor TEXT
);
CREATE TABLE player (
Player_ID NUMBER PRIMARY KEY,
Name TEXT,
Country TEXT,
Earnings NUMBER,
Events_number NUMBER,
Wins_count NUMBER,
Club_ID NUMBER,
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
bakery_1 | SELECT min(price) FROM goods WHERE flavor = "Cheese" | [
"SELECT",
"min",
"(",
"price",
")",
"FROM",
"goods",
"WHERE",
"flavor",
"=",
"``",
"Cheese",
"''"
] | [
"select",
"min",
"(",
"price",
")",
"from",
"goods",
"where",
"flavor",
"=",
"value"
] | Return the cheapest price for goods with cheese flavor. | [
"Return",
"the",
"cheapest",
"price",
"for",
"goods",
"with",
"cheese",
"flavor",
"."
] | CREATE TABLE customers (
Id NUMBER PRIMARY KEY,
LastName TEXT,
FirstName TEXT
);
CREATE TABLE goods (
Id TEXT PRIMARY KEY,
Flavor TEXT,
Food TEXT,
Price NUMBER
);
CREATE TABLE items (
Receipt NUMBER PRIMARY KEY,
Ordinal NUMBER,
Item TEXT,
FOREIGN KEY (Item) REFERENCES goods(Id)
);
CREATE TABLE receipts (
ReceiptNumber NUMBER PRIMARY KEY,
Date TEXT,
CustomerId NUMBER,
FOREIGN KEY (CustomerId) REFERENCES customers(Id)
); |
cre_Doc_Workflow | SELECT count(DISTINCT document_id) FROM Documents_processes | [
"SELECT",
"count",
"(",
"DISTINCT",
"document_id",
")",
"FROM",
"Documents_processes"
] | [
"select",
"count",
"(",
"distinct",
"document_id",
")",
"from",
"documents_processes"
] | How many documents have a process? | [
"How",
"many",
"documents",
"have",
"a",
"process",
"?"
] | CREATE TABLE Staff (
staff_id NUMBER PRIMARY KEY,
staff_details TEXT
);
CREATE TABLE Ref_Staff_Roles (
staff_role_code TEXT PRIMARY KEY,
staff_role_description TEXT
);
CREATE TABLE Process_Outcomes (
process_outcome_code TEXT PRIMARY KEY,
process_outcome_description TEXT
);
CREATE TABLE Process_Status (
process_status_code TEXT PRIMARY KEY,
process_status_description TEXT
);
CREATE TABLE Authors (
author_name TEXT PRIMARY KEY,
other_details TEXT
);
CREATE TABLE Documents (
document_id NUMBER PRIMARY KEY,
author_name TEXT,
document_name TEXT,
document_description TEXT,
other_details TEXT,
FOREIGN KEY (author_name) REFERENCES Authors(author_name)
);
CREATE TABLE Business_Processes (
process_id NUMBER PRIMARY KEY,
next_process_id NUMBER,
process_name TEXT,
process_description TEXT,
other_details TEXT
);
CREATE TABLE Documents_Processes (
document_id NUMBER PRIMARY KEY,
process_id NUMBER,
process_outcome_code TEXT,
process_status_code TEXT,
FOREIGN KEY (process_status_code) REFERENCES Process_Status(process_status_code),
FOREIGN KEY (process_outcome_code) REFERENCES Process_Outcomes(process_outcome_code),
FOREIGN KEY (process_id) REFERENCES Business_Processes(process_id),
FOREIGN KEY (document_id) REFERENCES Documents(document_id)
);
CREATE TABLE Staff_in_Processes (
document_id NUMBER PRIMARY KEY,
process_id NUMBER,
staff_id NUMBER,
staff_role_code TEXT,
date_from TIME,
date_to TIME,
other_details TEXT,
FOREIGN KEY (staff_role_code) REFERENCES Ref_Staff_Roles(staff_role_code),
FOREIGN KEY (document_id) REFERENCES Documents_Processes(document_id),
FOREIGN KEY (process_id) REFERENCES Documents_Processes(process_id),
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id)
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.