db_id
stringclasses
142 values
schema
stringclasses
142 values
schemaComEx
stringclasses
142 values
question
stringlengths
3
224
query
stringlengths
18
523
answer
stringlengths
13
498k
complexity
stringclasses
4 values
distinct
bool
2 classes
like
bool
2 classes
between
bool
2 classes
order_by
bool
2 classes
limit
bool
2 classes
grouby_by
bool
2 classes
having
bool
2 classes
single_join
bool
2 classes
multiple_join
bool
2 classes
multiple_select
bool
2 classes
intersect
bool
2 classes
except
bool
2 classes
union
bool
2 classes
sql_example_80
stringclasses
658 values
sql_example_85
stringclasses
728 values
sql_example_90
stringclasses
804 values
sql_example_95
stringclasses
875 values
insurance_fnol
CREATE TABLE "Available_Policies" ( "Policy_ID" INTEGER NOT NULL, policy_type_code CHAR(15), "Customer_Phone" VARCHAR(255), PRIMARY KEY ("Policy_ID"), UNIQUE ("Policy_ID") ) CREATE TABLE "Claims" ( "Claim_ID" INTEGER NOT NULL, "FNOL_ID" INTEGER NOT NULL, "Effective_Date" DATE, PRIMARY KEY ("Claim_ID"), FOREIGN KEY("FNOL_ID") REFERENCES "First_Notification_of_Loss" ("FNOL_ID"), UNIQUE ("Claim_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_name" VARCHAR(40), PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Customers_Policies" ( "Customer_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Date_Opened" DATE, "Date_Closed" DATE, PRIMARY KEY ("Customer_ID", "Policy_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Policy_ID") REFERENCES "Available_Policies" ("Policy_ID") ) CREATE TABLE "First_Notification_of_Loss" ( "FNOL_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Service_ID" INTEGER NOT NULL, PRIMARY KEY ("FNOL_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID", "Policy_ID") REFERENCES "Customers_Policies" ("Customer_ID", "Policy_ID"), UNIQUE ("FNOL_ID") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_name" VARCHAR(40), PRIMARY KEY ("Service_ID") ) CREATE TABLE "Settlements" ( "Settlement_ID" INTEGER NOT NULL, "Claim_ID" INTEGER, "Effective_Date" DATE, "Settlement_Amount" REAL, PRIMARY KEY ("Settlement_ID"), FOREIGN KEY("Claim_ID") REFERENCES "Claims" ("Claim_ID"), UNIQUE ("Settlement_ID") )
CREATE TABLE "Available_Policies" ( "Policy_ID" INTEGER NOT NULL, policy_type_code CHAR(15), "Customer_Phone" VARCHAR(255), PRIMARY KEY ("Policy_ID"), UNIQUE ("Policy_ID") ) /* 2 rows from Available_Policies table: Policy_ID policy_type_code Customer_Phone 246 Life Insurance +16(2)5838999222 257 Property Insurance 242.763.9214 */ CREATE TABLE "Claims" ( "Claim_ID" INTEGER NOT NULL, "FNOL_ID" INTEGER NOT NULL, "Effective_Date" DATE, PRIMARY KEY ("Claim_ID"), FOREIGN KEY("FNOL_ID") REFERENCES "First_Notification_of_Loss" ("FNOL_ID"), UNIQUE ("Claim_ID") ) /* 2 rows from Claims table: Claim_ID FNOL_ID Effective_Date 134 1722 1973-08-18 145 1611 2014-10-19 */ CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_name" VARCHAR(40), PRIMARY KEY ("Customer_ID") ) /* 2 rows from Customers table: Customer_ID Customer_name 194 America Jaskolski 214 Ellsworth Paucek */ CREATE TABLE "Customers_Policies" ( "Customer_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Date_Opened" DATE, "Date_Closed" DATE, PRIMARY KEY ("Customer_ID", "Policy_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Policy_ID") REFERENCES "Available_Policies" ("Policy_ID") ) /* 2 rows from Customers_Policies table: Customer_ID Policy_ID Date_Opened Date_Closed 214 257 2016-11-19 2018-03-04 214 301 2016-04-12 2018-02-07 */ CREATE TABLE "First_Notification_of_Loss" ( "FNOL_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Service_ID" INTEGER NOT NULL, PRIMARY KEY ("FNOL_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID", "Policy_ID") REFERENCES "Customers_Policies" ("Customer_ID", "Policy_ID"), UNIQUE ("FNOL_ID") ) /* 2 rows from First_Notification_of_Loss table: FNOL_ID Customer_ID Policy_ID Service_ID 532 214 257 6 1611 996 993 9 */ CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_name" VARCHAR(40), PRIMARY KEY ("Service_ID") ) /* 2 rows from Services table: Service_ID Service_name 1 New policy application 4 Close a policy */ CREATE TABLE "Settlements" ( "Settlement_ID" INTEGER NOT NULL, "Claim_ID" INTEGER, "Effective_Date" DATE, "Settlement_Amount" REAL, PRIMARY KEY ("Settlement_ID"), FOREIGN KEY("Claim_ID") REFERENCES "Claims" ("Claim_ID"), UNIQUE ("Settlement_ID") ) /* 2 rows from Settlements table: Settlement_ID Claim_ID Effective_Date Settlement_Amount 161 717 2009-11-20 6451.65 176 641 1971-06-29 1588.45 */
What are the IDs of customers who have "Diana" in part of their names?
SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
[{'Customer_ID': 562}]
Easy
false
true
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and account balances of customers with the letter a in their names?[/QUESTION] [SQL]SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%'[/SQL]
[QUESTION]What are the names and account balances of customers with the letter a in their names?[/QUESTION] [SQL]SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%'[/SQL]
climbing
CREATE TABLE climber ( "Climber_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Time" TEXT, "Points" REAL, "Mountain_ID" INTEGER, PRIMARY KEY ("Climber_ID"), FOREIGN KEY("Mountain_ID") REFERENCES mountain ("Mountain_ID") ) CREATE TABLE mountain ( "Mountain_ID" INTEGER, "Name" TEXT, "Height" REAL, "Prominence" REAL, "Range" TEXT, "Country" TEXT, PRIMARY KEY ("Mountain_ID") )
CREATE TABLE climber ( "Climber_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Time" TEXT, "Points" REAL, "Mountain_ID" INTEGER, PRIMARY KEY ("Climber_ID"), FOREIGN KEY("Mountain_ID") REFERENCES mountain ("Mountain_ID") ) /* 2 rows from climber table: Climber_ID Name Country Time Points Mountain_ID 1 Klaus Enders West Germany 1:13.05.6 15.0 1 2 Siegfried Schauzu West Germany 1:14.56.4 12.0 1 */ CREATE TABLE mountain ( "Mountain_ID" INTEGER, "Name" TEXT, "Height" REAL, "Prominence" REAL, "Range" TEXT, "Country" TEXT, PRIMARY KEY ("Mountain_ID") ) /* 2 rows from mountain table: Mountain_ID Name Height Prominence Range Country 1 Kibo (Uhuru Pk) 5895.0 5885.0 Kilimanjaro Tanzania 2 Mount Kenya (Batian) 5199.0 3825.0 Mount Kenya Kenya */
Show the distinct names of mountains climbed by climbers from country "West Germany".
SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany"
[{'Name': 'Kibo (Uhuru Pk)'}, {'Name': 'Mount Kenya (Batian)'}, {'Name': 'Mawenzi (Hans Meyer Pk)'}, {'Name': 'Mount Kenya (Lenana)'}]
Medium
true
false
false
false
false
false
false
true
false
false
false
false
false
theme_gallery
CREATE TABLE artist ( "Artist_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Year_Join" INTEGER, "Age" INTEGER, PRIMARY KEY ("Artist_ID") ) CREATE TABLE exhibition ( "Exhibition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Artist_ID" INTEGER, "Ticket_Price" REAL, PRIMARY KEY ("Exhibition_ID"), FOREIGN KEY("Artist_ID") REFERENCES artist ("Artist_ID") ) CREATE TABLE exhibition_record ( "Exhibition_ID" INTEGER, "Date" TEXT, "Attendance" INTEGER, PRIMARY KEY ("Exhibition_ID", "Date"), FOREIGN KEY("Exhibition_ID") REFERENCES exhibition ("Exhibition_ID") )
CREATE TABLE artist ( "Artist_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Year_Join" INTEGER, "Age" INTEGER, PRIMARY KEY ("Artist_ID") ) /* 2 rows from artist table: Artist_ID Name Country Year_Join Age 1 Vijay Singh Fiji 1998 45 2 John Daly United States 1991 46 */ CREATE TABLE exhibition ( "Exhibition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Artist_ID" INTEGER, "Ticket_Price" REAL, PRIMARY KEY ("Exhibition_ID"), FOREIGN KEY("Artist_ID") REFERENCES artist ("Artist_ID") ) /* 2 rows from exhibition table: Exhibition_ID Year Theme Artist_ID Ticket_Price 1 2004 Santa Claus 1 19.95 2 2005 Christmas stocking 2 19.95 */ CREATE TABLE exhibition_record ( "Exhibition_ID" INTEGER, "Date" TEXT, "Attendance" INTEGER, PRIMARY KEY ("Exhibition_ID", "Date"), FOREIGN KEY("Exhibition_ID") REFERENCES exhibition ("Exhibition_ID") ) /* 2 rows from exhibition_record table: Exhibition_ID Date Attendance 1 December 2 965 1 December 5 1098 */
What are the names of artists that have not had any exhibitions?
SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)
[{'Name': 'Mark Brooks'}, {'Name': 'Larry Nelson'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names of all male British artists?[/QUESTION] [SQL]SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male"[/SQL]
[QUESTION]What are the names of all male British artists?[/QUESTION] [SQL]SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male"[/SQL]
[QUESTION]What are the names of all male British artists?[/QUESTION] [SQL]SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male"[/SQL]
[QUESTION]What are the names of all male British artists?[/QUESTION] [SQL]SELECT artist_name FROM artist WHERE country = "UK" AND gender = "Male"[/SQL]
student_assessment
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) )
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1 line_2 city zip_postcode state_province_county country 5 0900 Roderick Oval New Albina, WA 19200-7914 Suite 096 Linnealand 862 Montana USA 9 966 Dach Ports Apt. 322 Lake Harmonyhaven, VA 65235 Apt. 163 South Minnie 716 Texas USA */ CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) /* 2 rows from Candidate_Assessments table: candidate_id qualification assessment_date asessment_outcome_code 111 A 2010-04-07 11:44:34 Pass 121 B 2010-04-17 11:44:34 Pass */ CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) /* 2 rows from Candidates table: candidate_id candidate_details 111 Jane 121 Robert */ CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) /* 2 rows from Courses table: course_id course_name course_description other_details 301 statistics statistics None 302 English English None */ CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) /* 2 rows from People table: person_id first_name middle_name last_name cell_mobile_number email_address login_name password 111 Shannon Elissa Senger 01955267735 [email protected] pgub 5e4ff49a61b3544da3ad7dc7e2cf28847564c64c 121 Virginie Jasmin Hartmann (508)319-2970x043 [email protected] bkkv b063331ea8116befaa7b84c59c6a22200f5f8caa */ CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from People_Addresses table: person_address_id person_id address_id date_from date_to 122 111 9 2012-09-26 13:21:00 2018-03-21 09:46:30 257 121 5 2008-07-31 02:17:25 2018-03-09 02:11:12 */ CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) /* 2 rows from Student_Course_Attendance table: student_id course_id date_of_attendance 111 301 2008-11-04 10:35:13 121 301 2012-04-09 11:44:34 */ CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Registrations table: student_id course_id registration_date 111 301 2008-11-04 10:35:13 121 301 2008-10-04 10:35:13 */ CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) ) /* 2 rows from Students table: student_id student_details 111 Marry 121 Martin */
What are the names of the courses in alphabetical order?
SELECT course_name FROM courses ORDER BY course_name
[{'course_name': 'Art history'}, {'course_name': 'English'}, {'course_name': 'French'}, {'course_name': 'data structure'}, {'course_name': 'database'}, {'course_name': 'statistics'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?[/QUESTION] [SQL]SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name[/SQL]
[QUESTION]What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?[/QUESTION] [SQL]SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name[/SQL]
[QUESTION]What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?[/QUESTION] [SQL]SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name[/SQL]
[QUESTION]What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?[/QUESTION] [SQL]SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name[/SQL]
tracking_orders
CREATE TABLE "Customers" ( customer_id INTEGER, customer_name VARCHAR(80), customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255), PRIMARY KEY (invoice_number) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status VARCHAR(10) NOT NULL, order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255), PRIMARY KEY (shipment_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) )
CREATE TABLE "Customers" ( customer_id INTEGER, customer_name VARCHAR(80), customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_name customer_details 1 Savannah rerum 2 George est */ CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255), PRIMARY KEY (invoice_number) ) /* 2 rows from Invoices table: invoice_number invoice_date invoice_details 1 1989-09-03 16:03:05 vitae 2 1989-12-11 16:40:57 magnam */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status VARCHAR(10) NOT NULL, order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id product_id order_id order_item_status order_item_details 1 4 6 Finish None 2 15 6 Finish None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id order_status date_order_placed order_details 1 2 Shipped 2009-02-21 15:26:19 None 2 11 Shipped 1974-06-24 22:10:26 None */ CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_name product_details 1 food None 2 book None */ CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Shipment_Items table: shipment_id order_item_id 11 12 10 15 */ CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255), PRIMARY KEY (shipment_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Shipments table: shipment_id order_id invoice_number shipment_tracking_number shipment_date other_shipment_details 1 5 13 3452 1983-08-13 22:34:11 None 2 7 2 0114 1977-11-10 12:11:25 None */
What are the invoice numbers created before 1989-09-03 or after 2007-12-25?
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
[{'invoice_number': 4}, {'invoice_number': 5}, {'invoice_number': 6}, {'invoice_number': 8}, {'invoice_number': 9}, {'invoice_number': 11}, {'invoice_number': 12}, {'invoice_number': 13}, {'invoice_number': 15}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
customers_and_invoices
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Accounts table: account_id customer_id date_account_opened account_name other_account_details 1 8 2016-07-30 22:22:24 900 Regular 2 3 2017-05-29 16:45:17 520 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_middle_initial customer_last_name gender email_address login_name login_password phone_number town_city state_county_province country 1 Dee A Larkin 1 [email protected] xhartmann 77789d292604ea04406f 241.796.1219x37862 North Nellie WestVirginia USA 2 Brennon H Weimann 0 [email protected] shayne.lesch ce97a3e4539347daab96 (943)219-4234x415 South Isabell Oklahoma USA */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) /* 2 rows from Financial_Transactions table: transaction_id account_id invoice_number transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 13 12 Payment 2018-03-15 21:13:57 613.9600 None None 2 9 1 Payment 2018-03-13 13:27:46 368.4600 None None */ CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Invoice_Line_Items table: order_item_id invoice_number product_id product_title product_quantity product_price derived_product_cost derived_vat_payable derived_total_cost 14 9 5 prod_name 4 742.3700 191.1100 None 69.8200 3 9 15 prod_name 1 814.8700 176.2900 None 59.5600 */ CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Invoices table: invoice_number order_id invoice_date 1 9 2018-03-01 16:40:48 2 9 2018-03-20 00:21:41 */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id product_quantity other_order_item_details 1 4 4 6 None 2 4 10 7 None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id date_order_placed order_details 1 12 2012-06-27 20:49:56 None 2 12 2012-08-25 07:51:54 None */ CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) /* 2 rows from Product_Categories table: production_type_code product_type_description vat_rating Food Food 15.8400 DVDs Dvd products 11.4000 */ CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) ) /* 2 rows from Products table: product_id parent_product_id production_type_code unit_price product_name product_color product_size 1 4 Food 617.9500 Coffee Bean Red Medium 2 4 Books 558.4900 Learning French Yellow Medium */
What is the customer id, first and last name with most number of accounts.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
[{'customer_id': 13, 'customer_first_name': 'Kieran', 'customer_last_name': 'Auer'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What are the names of all customers, ordered by account balance?[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]What are the names of all customers, ordered by account balance?[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]What are the names of all customers, ordered by account balance?[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]What are the names of all customers, ordered by account balance?[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
sports_competition
CREATE TABLE club ( "Club_ID" INTEGER, name TEXT, "Region" TEXT, "Start_year" TEXT, PRIMARY KEY ("Club_ID") ) CREATE TABLE club_rank ( "Rank" REAL, "Club_ID" INTEGER, "Gold" REAL, "Silver" REAL, "Bronze" REAL, "Total" REAL, PRIMARY KEY ("Rank", "Club_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) CREATE TABLE competition ( "Competition_ID" INTEGER, "Year" REAL, "Competition_type" TEXT, "Country" TEXT, PRIMARY KEY ("Competition_ID") ) CREATE TABLE competition_result ( "Competition_ID" INTEGER, "Club_ID_1" INTEGER, "Club_ID_2" INTEGER, "Score" TEXT, PRIMARY KEY ("Competition_ID", "Club_ID_1", "Club_ID_2"), FOREIGN KEY("Competition_ID") REFERENCES competition ("Competition_ID"), FOREIGN KEY("Club_ID_2") REFERENCES club ("Club_ID"), FOREIGN KEY("Club_ID_1") REFERENCES club ("Club_ID") ) CREATE TABLE player ( "Player_ID" INTEGER, name TEXT, "Position" TEXT, "Club_ID" INTEGER, "Apps" REAL, "Tries" REAL, "Goals" TEXT, "Points" REAL, PRIMARY KEY ("Player_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") )
CREATE TABLE club ( "Club_ID" INTEGER, name TEXT, "Region" TEXT, "Start_year" TEXT, PRIMARY KEY ("Club_ID") ) /* 2 rows from club table: Club_ID name Region Start_year 1 AIB USA 2009 2 BK Slide UK 1998 */ CREATE TABLE club_rank ( "Rank" REAL, "Club_ID" INTEGER, "Gold" REAL, "Silver" REAL, "Bronze" REAL, "Total" REAL, PRIMARY KEY ("Rank", "Club_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) /* 2 rows from club_rank table: Rank Club_ID Gold Silver Bronze Total 1.0 2 11.0 11.0 9.0 31.0 2.0 3 8.0 7.0 6.0 21.0 */ CREATE TABLE competition ( "Competition_ID" INTEGER, "Year" REAL, "Competition_type" TEXT, "Country" TEXT, PRIMARY KEY ("Competition_ID") ) /* 2 rows from competition table: Competition_ID Year Competition_type Country 1 2006.0 Friendly Italy 2 2006.0 Friendly Spain */ CREATE TABLE competition_result ( "Competition_ID" INTEGER, "Club_ID_1" INTEGER, "Club_ID_2" INTEGER, "Score" TEXT, PRIMARY KEY ("Competition_ID", "Club_ID_1", "Club_ID_2"), FOREIGN KEY("Competition_ID") REFERENCES competition ("Competition_ID"), FOREIGN KEY("Club_ID_2") REFERENCES club ("Club_ID"), FOREIGN KEY("Club_ID_1") REFERENCES club ("Club_ID") ) /* 2 rows from competition_result table: Competition_ID Club_ID_1 Club_ID_2 Score 1 1 2 11:10 2 3 2 25:2 */ CREATE TABLE player ( "Player_ID" INTEGER, name TEXT, "Position" TEXT, "Club_ID" INTEGER, "Apps" REAL, "Tries" REAL, "Goals" TEXT, "Points" REAL, PRIMARY KEY ("Player_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) /* 2 rows from player table: Player_ID name Position Club_ID Apps Tries Goals Points 1 Michael Platt Full Back 1 20.0 5.0 0 20.0 2 Dave Halley Right Wing 2 23.0 9.0 0 36.0 */
List the position of players and the average number of points of players of each position.
SELECT POSITION , avg(Points) FROM player GROUP BY POSITION
[{'Position': 'Full Back', 'avg(Points)': 20.0}, {'Position': 'Hooker', 'avg(Points)': 36.0}, {'Position': 'Left Wing', 'avg(Points)': 12.0}, {'Position': 'Loose Forward', 'avg(Points)': 20.0}, {'Position': 'Prop', 'avg(Points)': 9.333333333333334}, {'Position': 'Right Centre', 'avg(Points)': 36.0}, {'Position': 'Right Wing', 'avg(Points)': 36.0}, {'Position': 'Scrum Half', 'avg(Points)': 188.0}, {'Position': 'Second Row', 'avg(Points)': 20.0}, {'Position': 'Stand Off', 'avg(Points)': 110.0}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
who wrote the most papers on syntactic parsing ?
SELECT DISTINCT COUNT ( t4.paperid ) , t3.authorid FROM paperkeyphrase AS t1 JOIN keyphrase AS t2 ON t1.keyphraseid = t2.keyphraseid JOIN paper AS t4 ON t4.paperid = t1.paperid JOIN writes AS t3 ON t3.paperid = t4.paperid WHERE t2.keyphrasename = "syntactic parsing" GROUP BY t3.authorid ORDER BY COUNT ( t4.paperid ) DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
csu_1
CREATE TABLE "Campuses" ( "Id" INTEGER, "Campus" TEXT, "Location" TEXT, "County" TEXT, "Year" INTEGER, PRIMARY KEY ("Id") ) CREATE TABLE csu_fees ( "Campus" INTEGER, "Year" INTEGER, "CampusFee" INTEGER, PRIMARY KEY ("Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE degrees ( "Year" INTEGER, "Campus" INTEGER, "Degrees" INTEGER, PRIMARY KEY ("Year", "Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE discipline_enrollments ( "Campus" INTEGER, "Discipline" INTEGER, "Year" INTEGER, "Undergraduate" INTEGER, "Graduate" INTEGER, PRIMARY KEY ("Campus", "Discipline"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE enrollments ( "Campus" INTEGER, "Year" INTEGER, "TotalEnrollment_AY" INTEGER, "FTE_AY" INTEGER, PRIMARY KEY ("Campus", "Year"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE faculty ( "Campus" INTEGER, "Year" INTEGER, "Faculty" REAL, FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") )
CREATE TABLE "Campuses" ( "Id" INTEGER, "Campus" TEXT, "Location" TEXT, "County" TEXT, "Year" INTEGER, PRIMARY KEY ("Id") ) /* 2 rows from Campuses table: Id Campus Location County Year 1 California State University-Bakersfield Bakersfield Kern 1965 2 California State University-Channel Islands Camarillo Ventura 2002 */ CREATE TABLE csu_fees ( "Campus" INTEGER, "Year" INTEGER, "CampusFee" INTEGER, PRIMARY KEY ("Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from csu_fees table: Campus Year CampusFee 1 1996 1951 2 2003 1868 */ CREATE TABLE degrees ( "Year" INTEGER, "Campus" INTEGER, "Degrees" INTEGER, PRIMARY KEY ("Year", "Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from degrees table: Year Campus Degrees 1990 1 701 1991 1 681 */ CREATE TABLE discipline_enrollments ( "Campus" INTEGER, "Discipline" INTEGER, "Year" INTEGER, "Undergraduate" INTEGER, "Graduate" INTEGER, PRIMARY KEY ("Campus", "Discipline"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from discipline_enrollments table: Campus Discipline Year Undergraduate Graduate 1 4 2004 248 0 1 5 2004 811 73 */ CREATE TABLE enrollments ( "Campus" INTEGER, "Year" INTEGER, "TotalEnrollment_AY" INTEGER, "FTE_AY" INTEGER, PRIMARY KEY ("Campus", "Year"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from enrollments table: Campus Year TotalEnrollment_AY FTE_AY 1 1956 384 123 1 1957 432 151 */ CREATE TABLE faculty ( "Campus" INTEGER, "Year" INTEGER, "Faculty" REAL, FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from faculty table: Campus Year Faculty 1 2002 357.1 2 2002 48.4 */
Find the count of universities whose campus fee is greater than the average campus fee.
SELECT count(*) FROM csu_fees WHERE campusfee > (SELECT avg(campusfee) FROM csu_fees)
[{'count(*)': 10}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the first name and gpa of the students whose gpa is lower than the average gpa of all students.[/QUESTION] [SQL]SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student)[/SQL]
epinions_1
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) )
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) /* 2 rows from item table: i_id title 0 pear 1 orange */ CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) /* 2 rows from review table: a_id u_id i_id rating rank 1 1 1 10 1 2 2 1 5 2 */ CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) /* 2 rows from trust table: source_u_id target_u_id trust 1 2 10 1 3 6 */ CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) ) /* 2 rows from useracct table: u_id name 1 Helen 2 Mark */
For each user, return the name and the average rating of reviews given by them.
SELECT T1.name , avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
[{'name': 'Helen', 'avg(T2.rating)': 7.333333333333333}, {'name': 'Mark', 'avg(T2.rating)': 7.0}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what is the most populous state in the us
SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
perpetrator
CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Height" REAL, "Weight" REAL, "Home Town" TEXT, PRIMARY KEY ("People_ID") ) CREATE TABLE perpetrator ( "Perpetrator_ID" INTEGER, "People_ID" INTEGER, "Date" TEXT, "Year" REAL, "Location" TEXT, "Country" TEXT, "Killed" INTEGER, "Injured" INTEGER, PRIMARY KEY ("Perpetrator_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") )
CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Height" REAL, "Weight" REAL, "Home Town" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Height Weight Home Town 1 Ron Baxter 6.4 205.0 Los Angeles, CA 2 Brent Boyd 6.3 185.0 Baton Rouge, LA */ CREATE TABLE perpetrator ( "Perpetrator_ID" INTEGER, "People_ID" INTEGER, "Date" TEXT, "Year" REAL, "Location" TEXT, "Country" TEXT, "Killed" INTEGER, "Injured" INTEGER, PRIMARY KEY ("Perpetrator_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") ) /* 2 rows from perpetrator table: Perpetrator_ID People_ID Date Year Location Country Killed Injured 1 1 04.26 April 26/27 1982.0 Uiryeong South Korea 56 37 2 3 11.18 Nov. 18 1995.0 Zhaodong China 32 16 */
List the number of people injured by perpetrators in ascending order.
SELECT Injured FROM perpetrator ORDER BY Injured ASC
[{'Injured': 0}, {'Injured': 3}, {'Injured': 16}, {'Injured': 37}, {'Injured': 80}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
browser_web
CREATE TABLE "Web_client_accelerator" ( id INTEGER, name TEXT, "Operating_system" TEXT, "Client" TEXT, "Connection" TEXT, PRIMARY KEY (id) ) CREATE TABLE accelerator_compatible_browser ( accelerator_id INTEGER, browser_id INTEGER, compatible_since_year INTEGER, PRIMARY KEY (accelerator_id, browser_id), FOREIGN KEY(browser_id) REFERENCES browser (id), FOREIGN KEY(accelerator_id) REFERENCES "Web_client_accelerator" (id) ) CREATE TABLE browser ( id INTEGER, name TEXT, market_share REAL, PRIMARY KEY (id) )
CREATE TABLE "Web_client_accelerator" ( id INTEGER, name TEXT, "Operating_system" TEXT, "Client" TEXT, "Connection" TEXT, PRIMARY KEY (id) ) /* 2 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s */ CREATE TABLE accelerator_compatible_browser ( accelerator_id INTEGER, browser_id INTEGER, compatible_since_year INTEGER, PRIMARY KEY (accelerator_id, browser_id), FOREIGN KEY(browser_id) REFERENCES browser (id), FOREIGN KEY(accelerator_id) REFERENCES "Web_client_accelerator" (id) ) /* 2 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 */ CREATE TABLE browser ( id INTEGER, name TEXT, market_share REAL, PRIMARY KEY (id) ) /* 2 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 */
give me names of all compatible browsers and accelerators in the descending order of compatible year
SELECT T2.name , T3.name FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id ORDER BY T1.compatible_since_year DESC
[{'name': 'Nitro'}, {'name': 'fasTun'}, {'name': 'Fasterfox'}, {'name': 'Fasterfox'}, {'name': 'Fasterfox'}, {'name': 'CProxy'}, {'name': 'CACHEbox'}, {'name': 'CProxy'}, {'name': 'CACHEbox'}]
Hard
false
false
false
true
false
false
false
false
true
false
false
false
false
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
What is the most popular paper this year in CVPR ?
SELECT DISTINCT t3.citedpaperid , COUNT ( t3.citingpaperid ) FROM paper AS t1 JOIN cite AS t3 ON t1.paperid = t3.citedpaperid JOIN venue AS t2 ON t2.venueid = t1.venueid WHERE t1.year = 2016 AND t2.venuename = "CVPR" GROUP BY t3.citedpaperid ORDER BY COUNT ( t3.citingpaperid ) DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
[QUESTION]return me the keyword, which have been contained by the most number of papers in VLDB conference .[/QUESTION] [SQL]SELECT t1.keyword FROM publication_keyword AS t4 JOIN keyword AS t1 ON t4.kid = t1.kid JOIN publication AS t3 ON t3.pid = t4.pid JOIN conference AS t2 ON t3.cid = t2.cid WHERE t2.name = "VLDB" GROUP BY t1.keyword ORDER BY COUNT ( DISTINCT t3.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the keyword, which have been contained by the most number of papers in VLDB conference .[/QUESTION] [SQL]SELECT t1.keyword FROM publication_keyword AS t4 JOIN keyword AS t1 ON t4.kid = t1.kid JOIN publication AS t3 ON t3.pid = t4.pid JOIN conference AS t2 ON t3.cid = t2.cid WHERE t2.name = "VLDB" GROUP BY t1.keyword ORDER BY COUNT ( DISTINCT t3.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the keyword, which have been contained by the most number of papers in VLDB conference .[/QUESTION] [SQL]SELECT t1.keyword FROM publication_keyword AS t4 JOIN keyword AS t1 ON t4.kid = t1.kid JOIN publication AS t3 ON t3.pid = t4.pid JOIN conference AS t2 ON t3.cid = t2.cid WHERE t2.name = "VLDB" GROUP BY t1.keyword ORDER BY COUNT ( DISTINCT t3.title ) DESC LIMIT 1;[/SQL]
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
What are the names and seatings for all tracks opened after 2000, ordered by seating?
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
[{'Name': 'Chicagoland Speedway', 'Seating': 75000.0}, {'Name': 'Kansas Speedway', 'Seating': 81687.0}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
coffee_shop
CREATE TABLE happy_hour ( "HH_ID" INTEGER, "Shop_ID" INTEGER, "Month" TEXT, "Num_of_shaff_in_charge" INTEGER, PRIMARY KEY ("HH_ID", "Shop_ID", "Month"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") ) CREATE TABLE happy_hour_member ( "HH_ID" INTEGER, "Member_ID" INTEGER, "Total_amount" REAL, PRIMARY KEY ("HH_ID", "Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID") ) CREATE TABLE member ( "Member_ID" INTEGER, "Name" TEXT, "Membership_card" TEXT, "Age" INTEGER, "Time_of_purchase" INTEGER, "Level_of_membership" INTEGER, "Address" TEXT, PRIMARY KEY ("Member_ID") ) CREATE TABLE shop ( "Shop_ID" INTEGER, "Address" TEXT, "Num_of_staff" TEXT, "Score" REAL, "Open_Year" TEXT, PRIMARY KEY ("Shop_ID") )
CREATE TABLE happy_hour ( "HH_ID" INTEGER, "Shop_ID" INTEGER, "Month" TEXT, "Num_of_shaff_in_charge" INTEGER, PRIMARY KEY ("HH_ID", "Shop_ID", "Month"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") ) /* 2 rows from happy_hour table: HH_ID Shop_ID Month Num_of_shaff_in_charge 1 1 May 10 2 1 April 12 */ CREATE TABLE happy_hour_member ( "HH_ID" INTEGER, "Member_ID" INTEGER, "Total_amount" REAL, PRIMARY KEY ("HH_ID", "Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID") ) /* 2 rows from happy_hour_member table: HH_ID Member_ID Total_amount 1 3 20.9 4 3 20.92 */ CREATE TABLE member ( "Member_ID" INTEGER, "Name" TEXT, "Membership_card" TEXT, "Age" INTEGER, "Time_of_purchase" INTEGER, "Level_of_membership" INTEGER, "Address" TEXT, PRIMARY KEY ("Member_ID") ) /* 2 rows from member table: Member_ID Name Membership_card Age Time_of_purchase Level_of_membership Address 1 Ashby, Lazale Black 29 18 5 Hartford 2 Breton, Robert White 67 41 4 Waterbury */ CREATE TABLE shop ( "Shop_ID" INTEGER, "Address" TEXT, "Num_of_staff" TEXT, "Score" REAL, "Open_Year" TEXT, PRIMARY KEY ("Shop_ID") ) /* 2 rows from shop table: Shop_ID Address Num_of_staff Score Open_Year 1 1200 Main Street 13 42.0 2010 2 1111 Main Street 19 38.0 2008 */
Give me the names of members whose address is in Harford or Waterbury.
SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'
[{'Name': 'Breton, Robert'}, {'Name': 'Cobb, Sedrick'}, {'Name': 'Reynolds, Richard'}, {'Name': 'Rizzo, Todd'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
activity_1
CREATE TABLE "Activity" ( actid INTEGER, activity_name VARCHAR(25), PRIMARY KEY (actid) ) CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) CREATE TABLE "Faculty_Participates_in" ( "FacID" INTEGER, actid INTEGER, FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) CREATE TABLE "Participates_in" ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Activity" ( actid INTEGER, activity_name VARCHAR(25), PRIMARY KEY (actid) ) /* 2 rows from Activity table: actid activity_name 770 Mountain Climbing 771 Canoeing */ CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) /* 2 rows from Faculty table: FacID Lname Fname Rank Sex Phone Room Building 1082 Giuliano Mark Instructor M 2424 224 NEB 1121 Goodrich Michael Professor M 3593 219 NEB */ CREATE TABLE "Faculty_Participates_in" ( "FacID" INTEGER, actid INTEGER, FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) /* 2 rows from Faculty_Participates_in table: FacID actid 1082 784 1082 785 */ CREATE TABLE "Participates_in" ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) /* 2 rows from Participates_in table: stuid actid 1001 770 1001 771 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
What is the total number of faculty members?
SELECT count(*) FROM Faculty
[{'count(*)': 58}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the total number of professors with a Ph.D. ?[/QUESTION] [SQL]SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'[/SQL]
[QUESTION]What is the total number of professors with a Ph.D. ?[/QUESTION] [SQL]SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'[/SQL]
[QUESTION]What is the total number of professors with a Ph.D. ?[/QUESTION] [SQL]SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'[/SQL]
[QUESTION]What is the total number of professors with a Ph.D. ?[/QUESTION] [SQL]SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'[/SQL]
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
Find the name and address of the customers who have both New and Pending orders.
SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "New" INTERSECT SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending"
[{'customer_name': 'Lexus', 'customer_address': '9581 Will Flat Suite 272\nEast Cathryn, WY 30751-4404'}]
Hard
false
false
false
false
false
false
false
false
true
false
true
false
false
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
car_1
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") )
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) /* 2 rows from car_makers table: Id Maker FullName Country 1 amc American Motor Company 1 2 volkswagen Volkswagen 2 */ CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) /* 2 rows from car_names table: MakeId Model Make 1 chevrolet chevrolet chevelle malibu 2 buick buick skylark 320 */ CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) /* 2 rows from cars_data table: Id MPG Cylinders Edispl Horsepower Weight Accelerate Year 1 18 8 307.0 130 3504 12.0 1970 2 15 8 350.0 165 3693 11.5 1970 */ CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) /* 2 rows from continents table: ContId Continent 1 america 2 europe */ CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) /* 2 rows from countries table: CountryId CountryName Continent 1 usa 1 2 germany 2 */ CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") ) /* 2 rows from model_list table: ModelId Maker Model 1 1 amc 2 2 audi */
What is the average horsepower of the cars before 1980?
SELECT avg(horsepower) FROM CARS_DATA WHERE YEAR < 1980;
[{'avg(horsepower)': 111.13291139240506}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION] [SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL]
[QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION] [SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL]
[QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION] [SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL]
[QUESTION]What is the maximum mpg of the cars that had 8 cylinders or that were produced before 1980 ?[/QUESTION] [SQL]SELECT max(mpg) FROM cars_data WHERE cylinders = 8 OR YEAR < 1980[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
in which state is springfield
SELECT state_name FROM city WHERE city_name = "springfield";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
small_bank_1
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) )
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) /* 2 rows from ACCOUNTS table: custid name 1 Brown 2 Wang */ CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 */ CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 */
Find the checking balance and saving balance in the Brown’s account.
SELECT T2.balance , T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T1.name = 'Brown'
[{'balance': 200000.0}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]Find the total account balance of each customer from Utah or Texas.[/QUESTION] [SQL]SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'[/SQL]
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
What are the names, locations, and years of opening for tracks with seating higher than average?
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
[{'Name': 'Auto Club Speedway', 'Location': 'Fontana, CA', 'Year_Opened': 1997.0}, {'Name': 'Daytona International Speedway', 'Location': 'Daytona Beach, FL', 'Year_Opened': 1959.0}, {'Name': 'Michigan International Speedway', 'Location': 'Brooklyn, MI', 'Year_Opened': 1968.0}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
hospital_1
CREATE TABLE "Affiliated_With" ( "Physician" INTEGER NOT NULL, "Department" INTEGER NOT NULL, "PrimaryAffiliation" BOOLEAN NOT NULL, PRIMARY KEY ("Physician", "Department"), CONSTRAINT "fk_Affiliated_With_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Affiliated_With_Department_DepartmentID" FOREIGN KEY("Department") REFERENCES "Department" ("DepartmentID") ) CREATE TABLE "Appointment" ( "AppointmentID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "PrepNurse" INTEGER, "Physician" INTEGER NOT NULL, "Start" DATETIME NOT NULL, "End" DATETIME NOT NULL, "ExaminationRoom" TEXT NOT NULL, PRIMARY KEY ("AppointmentID"), CONSTRAINT "fk_Appointment_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Appointment_Nurse_EmployeeID" FOREIGN KEY("PrepNurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_Appointment_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Block" ( "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, PRIMARY KEY ("BlockFloor", "BlockCode") ) CREATE TABLE "Department" ( "DepartmentID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Head" INTEGER NOT NULL, CONSTRAINT "pk_Department" PRIMARY KEY ("DepartmentID"), CONSTRAINT "fk_Department_Physician_EmployeeID" FOREIGN KEY("Head") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Medication" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Brand" VARCHAR(30) NOT NULL, "Description" VARCHAR(30) NOT NULL, PRIMARY KEY ("Code") ) CREATE TABLE "Nurse" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "Registered" BOOLEAN NOT NULL, "SSN" INTEGER NOT NULL, PRIMARY KEY ("EmployeeID") ) CREATE TABLE "On_Call" ( "Nurse" INTEGER NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "OnCallStart" DATETIME NOT NULL, "OnCallEnd" DATETIME NOT NULL, PRIMARY KEY ("Nurse", "BlockFloor", "BlockCode", "OnCallStart", "OnCallEnd"), CONSTRAINT "fk_OnCall_Nurse_EmployeeID" FOREIGN KEY("Nurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_OnCall_Block_Floor" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) CREATE TABLE "Patient" ( "SSN" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Address" VARCHAR(30) NOT NULL, "Phone" VARCHAR(30) NOT NULL, "InsuranceID" INTEGER NOT NULL, "PCP" INTEGER NOT NULL, PRIMARY KEY ("SSN"), CONSTRAINT "fk_Patient_Physician_EmployeeID" FOREIGN KEY("PCP") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Physician" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "SSN" INTEGER NOT NULL, CONSTRAINT pk_physician PRIMARY KEY ("EmployeeID") ) CREATE TABLE "Prescribes" ( "Physician" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Medication" INTEGER NOT NULL, "Date" DATETIME NOT NULL, "Appointment" INTEGER, "Dose" VARCHAR(30) NOT NULL, PRIMARY KEY ("Physician", "Patient", "Medication", "Date"), CONSTRAINT "fk_Prescribes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Prescribes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Prescribes_Medication_Code" FOREIGN KEY("Medication") REFERENCES "Medication" ("Code"), CONSTRAINT "fk_Prescribes_Appointment_AppointmentID" FOREIGN KEY("Appointment") REFERENCES "Appointment" ("AppointmentID") ) CREATE TABLE "Procedures" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Cost" REAL NOT NULL, PRIMARY KEY ("Code") ) CREATE TABLE "Room" ( "RoomNumber" INTEGER NOT NULL, "RoomType" VARCHAR(30) NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "Unavailable" BOOLEAN NOT NULL, PRIMARY KEY ("RoomNumber"), CONSTRAINT "fk_Room_Block_PK" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) CREATE TABLE "Stay" ( "StayID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Room" INTEGER NOT NULL, "StayStart" DATETIME NOT NULL, "StayEnd" DATETIME NOT NULL, PRIMARY KEY ("StayID"), CONSTRAINT "fk_Stay_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Stay_Room_Number" FOREIGN KEY("Room") REFERENCES "Room" ("RoomNumber") ) CREATE TABLE "Trained_In" ( "Physician" INTEGER NOT NULL, "Treatment" INTEGER NOT NULL, "CertificationDate" DATETIME NOT NULL, "CertificationExpires" DATETIME NOT NULL, PRIMARY KEY ("Physician", "Treatment"), CONSTRAINT "fk_Trained_In_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Trained_In_Procedures_Code" FOREIGN KEY("Treatment") REFERENCES "Procedures" ("Code") ) CREATE TABLE "Undergoes" ( "Patient" INTEGER NOT NULL, "Procedures" INTEGER NOT NULL, "Stay" INTEGER NOT NULL, "DateUndergoes" DATETIME NOT NULL, "Physician" INTEGER NOT NULL, "AssistingNurse" INTEGER, PRIMARY KEY ("Patient", "Procedures", "Stay", "DateUndergoes"), CONSTRAINT "fk_Undergoes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Undergoes_Procedures_Code" FOREIGN KEY("Procedures") REFERENCES "Procedures" ("Code"), CONSTRAINT "fk_Undergoes_Stay_StayID" FOREIGN KEY("Stay") REFERENCES "Stay" ("StayID"), CONSTRAINT "fk_Undergoes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Undergoes_Nurse_EmployeeID" FOREIGN KEY("AssistingNurse") REFERENCES "Nurse" ("EmployeeID") )
CREATE TABLE "Affiliated_With" ( "Physician" INTEGER NOT NULL, "Department" INTEGER NOT NULL, "PrimaryAffiliation" BOOLEAN NOT NULL, PRIMARY KEY ("Physician", "Department"), CONSTRAINT "fk_Affiliated_With_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Affiliated_With_Department_DepartmentID" FOREIGN KEY("Department") REFERENCES "Department" ("DepartmentID") ) /* 2 rows from Affiliated_With table: Physician Department PrimaryAffiliation 1 1 True 2 1 True */ CREATE TABLE "Appointment" ( "AppointmentID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "PrepNurse" INTEGER, "Physician" INTEGER NOT NULL, "Start" DATETIME NOT NULL, "End" DATETIME NOT NULL, "ExaminationRoom" TEXT NOT NULL, PRIMARY KEY ("AppointmentID"), CONSTRAINT "fk_Appointment_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Appointment_Nurse_EmployeeID" FOREIGN KEY("PrepNurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_Appointment_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Appointment table: AppointmentID Patient PrepNurse Physician Start End ExaminationRoom 13216584 100000001 101 1 2008-04-24 10:00:00 2008-04-24 11:00:00 A 26548913 100000002 101 2 2008-04-24 10:00:00 2008-04-24 11:00:00 B */ CREATE TABLE "Block" ( "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, PRIMARY KEY ("BlockFloor", "BlockCode") ) /* 2 rows from Block table: BlockFloor BlockCode 1 1 1 2 */ CREATE TABLE "Department" ( "DepartmentID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Head" INTEGER NOT NULL, CONSTRAINT "pk_Department" PRIMARY KEY ("DepartmentID"), CONSTRAINT "fk_Department_Physician_EmployeeID" FOREIGN KEY("Head") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Department table: DepartmentID Name Head 1 General Medicine 4 2 Surgery 7 */ CREATE TABLE "Medication" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Brand" VARCHAR(30) NOT NULL, "Description" VARCHAR(30) NOT NULL, PRIMARY KEY ("Code") ) /* 2 rows from Medication table: Code Name Brand Description 1 Procrastin-X X N/A 2 Thesisin Foo Labs N/A */ CREATE TABLE "Nurse" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "Registered" BOOLEAN NOT NULL, "SSN" INTEGER NOT NULL, PRIMARY KEY ("EmployeeID") ) /* 2 rows from Nurse table: EmployeeID Name Position Registered SSN 101 Carla Espinosa Head Nurse True 111111110 102 Laverne Roberts Nurse True 222222220 */ CREATE TABLE "On_Call" ( "Nurse" INTEGER NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "OnCallStart" DATETIME NOT NULL, "OnCallEnd" DATETIME NOT NULL, PRIMARY KEY ("Nurse", "BlockFloor", "BlockCode", "OnCallStart", "OnCallEnd"), CONSTRAINT "fk_OnCall_Nurse_EmployeeID" FOREIGN KEY("Nurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_OnCall_Block_Floor" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) /* 2 rows from On_Call table: Nurse BlockFloor BlockCode OnCallStart OnCallEnd 101 1 1 2008-11-04 11:00:00 2008-11-04 19:00:00 101 1 2 2008-11-04 11:00:00 2008-11-04 19:00:00 */ CREATE TABLE "Patient" ( "SSN" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Address" VARCHAR(30) NOT NULL, "Phone" VARCHAR(30) NOT NULL, "InsuranceID" INTEGER NOT NULL, "PCP" INTEGER NOT NULL, PRIMARY KEY ("SSN"), CONSTRAINT "fk_Patient_Physician_EmployeeID" FOREIGN KEY("PCP") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Patient table: SSN Name Address Phone InsuranceID PCP 100000001 John Smith 42 Foobar Lane 555-0256 68476213 1 100000002 Grace Ritchie 37 Snafu Drive 555-0512 36546321 2 */ CREATE TABLE "Physician" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "SSN" INTEGER NOT NULL, CONSTRAINT pk_physician PRIMARY KEY ("EmployeeID") ) /* 2 rows from Physician table: EmployeeID Name Position SSN 1 John Dorian Staff Internist 111111111 2 Elliot Reid Attending Physician 222222222 */ CREATE TABLE "Prescribes" ( "Physician" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Medication" INTEGER NOT NULL, "Date" DATETIME NOT NULL, "Appointment" INTEGER, "Dose" VARCHAR(30) NOT NULL, PRIMARY KEY ("Physician", "Patient", "Medication", "Date"), CONSTRAINT "fk_Prescribes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Prescribes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Prescribes_Medication_Code" FOREIGN KEY("Medication") REFERENCES "Medication" ("Code"), CONSTRAINT "fk_Prescribes_Appointment_AppointmentID" FOREIGN KEY("Appointment") REFERENCES "Appointment" ("AppointmentID") ) /* 2 rows from Prescribes table: Physician Patient Medication Date Appointment Dose 1 100000001 1 2008-04-24 10:47:00 13216584 5 9 100000004 2 2008-04-27 10:53:00 86213939 10 */ CREATE TABLE "Procedures" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Cost" REAL NOT NULL, PRIMARY KEY ("Code") ) /* 2 rows from Procedures table: Code Name Cost 1 Reverse Rhinopodoplasty 1500.0 2 Obtuse Pyloric Recombobulation 3750.0 */ CREATE TABLE "Room" ( "RoomNumber" INTEGER NOT NULL, "RoomType" VARCHAR(30) NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "Unavailable" BOOLEAN NOT NULL, PRIMARY KEY ("RoomNumber"), CONSTRAINT "fk_Room_Block_PK" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) /* 2 rows from Room table: RoomNumber RoomType BlockFloor BlockCode Unavailable 101 Single 1 1 False 102 Single 1 1 False */ CREATE TABLE "Stay" ( "StayID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Room" INTEGER NOT NULL, "StayStart" DATETIME NOT NULL, "StayEnd" DATETIME NOT NULL, PRIMARY KEY ("StayID"), CONSTRAINT "fk_Stay_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Stay_Room_Number" FOREIGN KEY("Room") REFERENCES "Room" ("RoomNumber") ) /* 2 rows from Stay table: StayID Patient Room StayStart StayEnd 3215 100000001 111 2008-05-01 00:00:00 2008-05-04 00:00:00 3216 100000003 123 2008-05-03 00:00:00 2008-05-14 00:00:00 */ CREATE TABLE "Trained_In" ( "Physician" INTEGER NOT NULL, "Treatment" INTEGER NOT NULL, "CertificationDate" DATETIME NOT NULL, "CertificationExpires" DATETIME NOT NULL, PRIMARY KEY ("Physician", "Treatment"), CONSTRAINT "fk_Trained_In_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Trained_In_Procedures_Code" FOREIGN KEY("Treatment") REFERENCES "Procedures" ("Code") ) /* 2 rows from Trained_In table: Physician Treatment CertificationDate CertificationExpires 3 1 2008-01-01 00:00:00 2008-12-31 00:00:00 3 2 2008-01-01 00:00:00 2008-12-31 00:00:00 */ CREATE TABLE "Undergoes" ( "Patient" INTEGER NOT NULL, "Procedures" INTEGER NOT NULL, "Stay" INTEGER NOT NULL, "DateUndergoes" DATETIME NOT NULL, "Physician" INTEGER NOT NULL, "AssistingNurse" INTEGER, PRIMARY KEY ("Patient", "Procedures", "Stay", "DateUndergoes"), CONSTRAINT "fk_Undergoes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Undergoes_Procedures_Code" FOREIGN KEY("Procedures") REFERENCES "Procedures" ("Code"), CONSTRAINT "fk_Undergoes_Stay_StayID" FOREIGN KEY("Stay") REFERENCES "Stay" ("StayID"), CONSTRAINT "fk_Undergoes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Undergoes_Nurse_EmployeeID" FOREIGN KEY("AssistingNurse") REFERENCES "Nurse" ("EmployeeID") ) /* 2 rows from Undergoes table: Patient Procedures Stay DateUndergoes Physician AssistingNurse 100000001 6 3215 2008-05-02 00:00:00 3 101 100000001 2 3215 2008-05-03 00:00:00 7 101 */
What are the names of departments that have primarily affiliated physicians.
SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1
[{'Name': 'General Medicine'}, {'Name': 'Surgery'}, {'Name': 'Psychiatry'}]
Medium
true
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]How many different departments are there?[/QUESTION] [SQL]SELECT count(DISTINCT dept_name) FROM department[/SQL]
[QUESTION]How many different departments are there?[/QUESTION] [SQL]SELECT count(DISTINCT dept_name) FROM department[/SQL]
[QUESTION]How many different departments are there?[/QUESTION] [SQL]SELECT count(DISTINCT dept_name) FROM department[/SQL]
student_1
CREATE TABLE list ( "LastName" TEXT, "FirstName" TEXT, "Grade" INTEGER, "Classroom" INTEGER, PRIMARY KEY ("LastName", "FirstName") ) CREATE TABLE teachers ( "LastName" TEXT, "FirstName" TEXT, "Classroom" INTEGER, PRIMARY KEY ("LastName", "FirstName") )
CREATE TABLE list ( "LastName" TEXT, "FirstName" TEXT, "Grade" INTEGER, "Classroom" INTEGER, PRIMARY KEY ("LastName", "FirstName") ) /* 2 rows from list table: LastName FirstName Grade Classroom CAR MAUDE 2 101 KRISTENSEN STORMY 6 112 */ CREATE TABLE teachers ( "LastName" TEXT, "FirstName" TEXT, "Classroom" INTEGER, PRIMARY KEY ("LastName", "FirstName") ) /* 2 rows from teachers table: LastName FirstName Classroom MACROSTIE MIN 101 COVIN JEROME 102 */
List the first names of all the students in room 107.
SELECT DISTINCT firstname FROM list WHERE classroom = 107
[{'FirstName': ' SHERWOOD'}, {'FirstName': ' ROBBY'}, {'FirstName': ' CRYSTA'}, {'FirstName': ' VERTIE'}, {'FirstName': ' CHRISSY'}, {'FirstName': ' JORDON'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the first names of students who took exactly one class.[/QUESTION] [SQL]SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1[/SQL]
[QUESTION]Find the first names of students who took exactly one class.[/QUESTION] [SQL]SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1[/SQL]
[QUESTION]Find the first names of students who took exactly one class.[/QUESTION] [SQL]SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1[/SQL]
[QUESTION]Find the first names of students who took exactly one class.[/QUESTION] [SQL]SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1[/SQL]
company_office
CREATE TABLE "Companies" ( id INTEGER, name TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value_billion" TEXT, PRIMARY KEY (id) ) CREATE TABLE "Office_locations" ( building_id INTEGER, company_id INTEGER, move_in_year INTEGER, PRIMARY KEY (building_id, company_id), FOREIGN KEY(building_id) REFERENCES buildings (id), FOREIGN KEY(company_id) REFERENCES "Companies" (id) ) CREATE TABLE buildings ( id INTEGER, name TEXT, "City" TEXT, "Height" INTEGER, "Stories" INTEGER, "Status" TEXT, PRIMARY KEY (id) )
CREATE TABLE "Companies" ( id INTEGER, name TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value_billion" TEXT, PRIMARY KEY (id) ) /* 2 rows from Companies table: id name Headquarters Industry Sales_billion Profits_billion Assets_billion Market_Value_billion 1 JPMorgan Chase USA Banking 115.5 17.4 2117.6 182.2 2 HSBC UK Banking 103.3 13.3 2467.9 186.5 */ CREATE TABLE "Office_locations" ( building_id INTEGER, company_id INTEGER, move_in_year INTEGER, PRIMARY KEY (building_id, company_id), FOREIGN KEY(building_id) REFERENCES buildings (id), FOREIGN KEY(company_id) REFERENCES "Companies" (id) ) /* 2 rows from Office_locations table: building_id company_id move_in_year 1 1 2021 2 2 2022 */ CREATE TABLE buildings ( id INTEGER, name TEXT, "City" TEXT, "Height" INTEGER, "Stories" INTEGER, "Status" TEXT, PRIMARY KEY (id) ) /* 2 rows from buildings table: id name City Height Stories Status 1 Torre KOI Monterrey 220 67 under construction 2 Torre Mitikah Mexico City 210 60 under construction */
What are the names of companies whose headquarters are not "USA"?
SELECT name FROM Companies WHERE Headquarters != 'USA'
[{'name': 'HSBC'}, {'name': 'Royal Dutch Shell'}, {'name': 'PetroChina'}, {'name': 'Industrial and Commercial Bank of China'}, {'name': 'Petrobras'}, {'name': 'BNP Paribas'}, {'name': 'Santander Group'}, {'name': 'Gazprom'}, {'name': 'China Construction Bank'}, {'name': 'Total'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names of conductors whose nationalities are not "USA"?[/QUESTION] [SQL]SELECT Name FROM conductor WHERE Nationality != 'USA'[/SQL]
city_record
CREATE TABLE "match" ( "Match_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT, PRIMARY KEY ("Match_ID") ) CREATE TABLE city ( "City_ID" INTEGER, "City" TEXT, "Hanzi" TEXT, "Hanyu_Pinyin" TEXT, "Regional_Population" INTEGER, "GDP" REAL, PRIMARY KEY ("City_ID") ) CREATE TABLE hosting_city ( "Year" INTEGER, "Match_ID" INTEGER, "Host_City" TEXT, PRIMARY KEY ("Year"), FOREIGN KEY("Match_ID") REFERENCES "match" ("Match_ID"), FOREIGN KEY("Host_City") REFERENCES city ("City_ID") ) CREATE TABLE temperature ( "City_ID" INTEGER, "Jan" REAL, "Feb" REAL, "Mar" REAL, "Apr" REAL, "Jun" REAL, "Jul" REAL, "Aug" REAL, "Sep" REAL, "Oct" REAL, "Nov" REAL, "Dec" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("City_ID") REFERENCES city ("City_ID") )
CREATE TABLE "match" ( "Match_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT, PRIMARY KEY ("Match_ID") ) /* 2 rows from match table: Match_ID Date Venue Score Result Competition 1 18 February 1992 Estadio Cuscatlán , San Salvador , El Salvador 1-0 2-0 Friendly match 2 19 July 1992 Estadio Rigoberto López , Managua , Nicaragua 3-0 5-0 1994 FIFA World Cup qualification */ CREATE TABLE city ( "City_ID" INTEGER, "City" TEXT, "Hanzi" TEXT, "Hanyu_Pinyin" TEXT, "Regional_Population" INTEGER, "GDP" REAL, PRIMARY KEY ("City_ID") ) /* 2 rows from city table: City_ID City Hanzi Hanyu_Pinyin Regional_Population GDP 1 Shanghai 上海 Shànghǎi 23019148 1919.57 2 Nanjing ( Jiangsu ) 南京 Nánjīng 8004680 614.55 */ CREATE TABLE hosting_city ( "Year" INTEGER, "Match_ID" INTEGER, "Host_City" TEXT, PRIMARY KEY ("Year"), FOREIGN KEY("Match_ID") REFERENCES "match" ("Match_ID"), FOREIGN KEY("Host_City") REFERENCES city ("City_ID") ) /* 2 rows from hosting_city table: Year Match_ID Host_City 2008 1 1 2009 2 2 */ CREATE TABLE temperature ( "City_ID" INTEGER, "Jan" REAL, "Feb" REAL, "Mar" REAL, "Apr" REAL, "Jun" REAL, "Jul" REAL, "Aug" REAL, "Sep" REAL, "Oct" REAL, "Nov" REAL, "Dec" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("City_ID") REFERENCES city ("City_ID") ) /* 2 rows from temperature table: City_ID Jan Feb Mar Apr Jun Jul Aug Sep Oct Nov Dec 1 17.8 17.8 18.3 18.9 20.0 20.6 20.6 20.6 20.0 19.4 18.3 2 26.1 26.1 26.1 26.1 27.8 27.8 28.3 28.3 28.3 27.2 26.7 */
What is the city with the smallest GDP? Return the city and its GDP.
SELECT city , GDP FROM city ORDER BY GDP LIMIT 1
[{'City': 'Jinhua ( Zhejiang )', 'GDP': 244.77}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]What is the name of the district with the smallest area?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_area ASC LIMIT 1[/SQL]
[QUESTION]What is the name of the district with the smallest area?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_area ASC LIMIT 1[/SQL]
cre_Theme_park
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") )
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) /* 2 rows from Features table: Feature_ID Feature_Details 523 cafe 528 park */ CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) /* 2 rows from Hotels table: hotel_id star_rating_code pets_allowed_yn price_range other_hotel_details 123 5 1 2914989.571 None 144 4 None */ CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) /* 2 rows from Locations table: Location_ID Location_Name Address Other_Details 333 Astro Orbiter 660 Shea Crescent None 368 African Animals 254 Ottilie Junction None */ CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Museums table: Museum_ID Museum_Details 2113 Yale Center for British Art 2701 The Metropolitan Museum of Art */ CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Photos table: Photo_ID Tourist_Attraction_ID Name Description Filename Other_Details 211 8449 game1 None 702 None 280 7067 game2 None 762 None */ CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) /* 2 rows from Ref_Attraction_Types table: Attraction_Type_Code Attraction_Type_Description 2 park 3 garden */ CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) /* 2 rows from Ref_Hotel_Star_Ratings table: star_rating_code star_rating_description 1 star 2 star */ CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Royal_Family table: Royal_Family_ID Royal_Family_Details 9561 None 9919 None */ CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Shops table: Shop_ID Shop_Details 8429 soup 8449 coffee */ CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Staff table: Staff_ID Tourist_Attraction_ID Name Other_Details 170 6476 Whitney None 219 6476 Kaela None */ CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Street_Markets table: Market_ID Market_Details 6852 Broadway 7067 Fish Farm Market */ CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Theme_Parks table: Theme_Park_ID Theme_Park_Details 5265 Disney 6476 Sea World */ CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) /* 2 rows from Tourist_Attraction_Features table: Tourist_Attraction_ID Feature_ID 5076 528 5076 681 */ CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) /* 2 rows from Tourist_Attractions table: Tourist_Attraction_ID Attraction_Type_Code Location_ID How_to_Get_There Name Description Opening_Hours Other_Details 2113 2 579 bus art museum None None None 2701 6 417 walk UK gallery None None None */ CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) /* 2 rows from Visitors table: Tourist_ID Tourist_Details 164 Toney 189 Graciela */ CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") ) /* 2 rows from Visits table: Visit_ID Tourist_Attraction_ID Tourist_ID Visit_Date Visit_Details 183 6653 377 2004-08-21 03:06:14 268 5076 204 2013-08-06 05:35:51 */
For each tourist attraction, return its name and the date when the tourists named Vincent or Vivian visited there.
SELECT T1.Name , T3.Visit_Date FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" OR T2.Tourist_Details = "Vivian"
[{'Name': 'flying elephant', 'Visit_Date': '2013-08-06 05:35:51'}, {'Name': 'fun shops', 'Visit_Date': '2013-10-27 09:56:08'}, {'Name': 'fun games', 'Visit_Date': '2017-03-19 08:48:19'}, {'Name': 'parking', 'Visit_Date': '2007-09-17 10:12:45'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
music_2
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") )
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) /* 2 rows from Albums table: AId Title Year Label Type */ CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) /* 2 rows from Band table: Id Firstname Lastname */ CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) /* 2 rows from Instruments table: SongId BandmateId Instrument */ CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Performance table: SongId Bandmate StagePosition */ CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) /* 2 rows from Songs table: SongId Title */ CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) /* 2 rows from Tracklists table: AlbumId Position SongId */ CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Vocals table: SongId Bandmate Type */
What are all the labels?
SELECT DISTINCT label FROM Albums
[{'Nenhum': 'Nenhum resultado encontrado'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and descriptions of all the sections?[/QUESTION] [SQL]SELECT section_name , section_description FROM Sections[/SQL]
[QUESTION]What are the names and descriptions of all the sections?[/QUESTION] [SQL]SELECT section_name , section_description FROM Sections[/SQL]
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
What are the names and dates of races, and the names of the tracks where they are held?
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
[{'Name': 'Auto Club Speedway', 'Date': 'January 26 January 27'}, {'Name': 'Chicagoland Speedway', 'Date': 'March 29'}, {'Name': 'Chicagoland Speedway', 'Date': 'April 19'}, {'Name': 'Daytona International Speedway', 'Date': 'April 27'}, {'Name': 'Homestead-Miami Speedway', 'Date': 'May 17'}, {'Name': 'Kansas Speedway', 'Date': 'May 26'}, {'Name': 'Martinsville Speedway', 'Date': 'June 7'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?[/QUESTION] [SQL]SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015[/SQL]
formula_1
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") )
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorResults table: constructorResultsId raceId constructorId points status 1 18 1 14.0 NULL 2 18 2 8.0 NULL */ CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorStandings table: constructorStandingsId raceId constructorId points position positionText wins 1 18 1 14.0 1 1 1 2 18 2 8.0 3 3 0 */ CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from driverStandings table: driverStandingsId raceId driverId points position positionText wins 1 18 1 10.0 1 1 1 2 18 2 8.0 2 2 0 */ CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from lapTimes table: raceId driverId lap position time milliseconds */ CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from pitStops table: raceId driverId stop lap time duration milliseconds */ CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) /* 2 rows from circuits table: circuitId circuitRef name location country lat lng alt url 1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.8497 144.968 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit 2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.738 http://en.wikipedia.org/wiki/Sepang_International_Circuit */ CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) /* 2 rows from constructors table: constructorId constructorRef name nationality url 1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren 2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber */ CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) /* 2 rows from drivers table: driverId driverRef number code forename surname dob nationality url 1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton 2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld */ CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from qualifying table: qualifyId raceId driverId constructorId number position q1 q2 q3 1 18 1 1 22 1 1:26.572 1:25.187 1:26.714 2 18 9 2 4 2 1:26.103 1:25.315 1:26.869 */ CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) /* 2 rows from races table: raceId year round circuitId name date time url 1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix 2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix */ CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from results table: resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId 1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1 2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1 */ CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) /* 2 rows from seasons table: year url 1950 http://en.wikipedia.org/wiki/1950_Formula_One_season 1951 http://en.wikipedia.org/wiki/1951_Formula_One_season */ CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") ) /* 2 rows from status table: statusId status 1 Finished 2 Disqualified */
What are the forenames and surnames of drivers who participated in the races named Australian Grand Prix but not the races named Chinese Grand Prix?
SELECT T3.forename , T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = "Australian Grand Prix" EXCEPT SELECT T3.forename , T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = "Chinese Grand Prix"
[{'forename': 'Adri��n', 'surname': 'Campos'}, {'forename': 'Aguri', 'surname': 'Suzuki'}, {'forename': 'Alain', 'surname': 'Prost'}, {'forename': 'Alan', 'surname': 'Jones'}, {'forename': 'Alessandro', 'surname': 'Nannini'}, {'forename': 'Alessandro', 'surname': 'Zanardi'}, {'forename': 'Alex', 'surname': 'Caffi'}, {'forename': 'Alex', 'surname': 'Yoong'}, {'forename': 'Allan', 'surname': 'McNish'}, {'forename': 'Allen', 'surname': 'Berg'}, {'forename': 'Andrea', 'surname': 'Montermini'}, {'forename': 'Andrea', 'surname': 'de Cesaris'}, {'forename': 'Ayrton', 'surname': 'Senna'}, {'forename': 'Bernd', 'surname': 'Schneider'}, {'forename': 'Bertrand', 'surname': 'Gachot'}, {'forename': 'Christian', 'surname': 'Danner'}, {'forename': 'Christian', 'surname': 'Fittipaldi'}, {'forename': 'Cristiano', 'surname': 'da Matta'}, {'forename': 'Damon', 'surname': 'Hill'}, {'forename': 'David', 'surname': 'Brabham'}, {'forename': 'Derek', 'surname': 'Warwick'}, {'forename': 'Domenico', 'surname': 'Schiattarella'}, {'forename': 'Eddie', 'surname': 'Cheever'}, {'forename': 'Eddie', 'surname': 'Irvine'}, {'forename': 'Elio', 'surname': 'de Angelis'}, {'forename': 'Emanuele', 'surname': 'Naspetti'}, {'forename': 'Emanuele', 'surname': 'Pirro'}, {'forename': 'Enrico', 'surname': 'Bertaggia'}, {'forename': 'Enrique', 'surname': 'Bernoldi'}, {'forename': 'Eric', 'surname': 'van de Poele'}, {'forename': 'Esteban', 'surname': 'Tuero'}, {'forename': 'Franck', 'surname': 'Lagorce'}, {'forename': 'Gabriele', 'surname': 'Tarquini'}, {'forename': 'Gast�_n', 'surname': 'Mazzacane'}, {'forename': 'Gerhard', 'surname': 'Berger'}, {'forename': 'Gianni', 'surname': 'Morbidelli'}, {'forename': 'Giorgio', 'surname': 'Pantano'}, {'forename': 'Heinz-Harald', 'surname': 'Frentzen'}, {'forename': 'Hideki', 'surname': 'Noda'}, {'forename': 'Huub', 'surname': 'Rothengatter'}, {'forename': 'Ivan', 'surname': 'Capelli'}, {'forename': 'Jacques', 'surname': 'Laffite'}, {'forename': 'Jan', 'surname': 'Lammers'}, {'forename': 'Jan', 'surname': 'Magnussen'}, {'forename': 'Jean', 'surname': 'Alesi'}, {'forename': 'Jean-Denis', 'surname': 'D̩l̩traz'}, {'forename': 'Jean-Marc', 'surname': 'Gounon'}, {'forename': 'Johnny', 'surname': 'Dumfries'}, {'forename': 'Johnny', 'surname': 'Herbert'}, {'forename': 'Jonathan', 'surname': 'Palmer'}, {'forename': 'Jos', 'surname': 'Verstappen'}, {'forename': 'Julian', 'surname': 'Bailey'}, {'forename': 'Justin', 'surname': 'Wilson'}, {'forename': 'Jyrki', 'surname': 'J�_rvilehto'}, {'forename': 'Karl', 'surname': 'Wendlinger'}, {'forename': 'Keke', 'surname': 'Rosberg'}, {'forename': 'Luca', 'surname': 'Badoer'}, {'forename': 'Luciano', 'surname': 'Burti'}, {'forename': 'Luis', 'surname': 'P̩rez-Sala'}, {'forename': 'Marc', 'surname': 'Gen̩'}, {'forename': 'Marc', 'surname': 'Surer'}, {'forename': 'Mark', 'surname': 'Blundell'}, {'forename': 'Martin', 'surname': 'Brundle'}, {'forename': 'Maur�_cio', 'surname': 'Gugelmin'}, {'forename': 'Michele', 'surname': 'Alboreto'}, {'forename': 'Mika', 'surname': 'H�_kkinen'}, {'forename': 'Mika', 'surname': 'Salo'}, {'forename': 'Naoki', 'surname': 'Hattori'}, {'forename': 'Nelson', 'surname': 'Piquet'}, {'forename': 'Nicola', 'surname': 'Larini'}, {'forename': 'Nigel', 'surname': 'Mansell'}, {'forename': 'Niki', 'surname': 'Lauda'}, {'forename': 'Olivier', 'surname': 'Grouillard'}, {'forename': 'Oscar', 'surname': 'Larrauri'}, {'forename': 'Patrick', 'surname': 'Friesacher'}, {'forename': 'Patrick', 'surname': 'Tambay'}, {'forename': 'Paul', 'surname': 'Belmondo'}, {'forename': 'Pedro', 'surname': 'Diniz'}, {'forename': 'Pedro', 'surname': 'Lamy'}, {'forename': 'Philippe', 'surname': 'Alliot'}, {'forename': 'Philippe', 'surname': 'Streiff'}, {'forename': 'Piercarlo', 'surname': 'Ghinzani'}, {'forename': 'Pierluigi', 'surname': 'Martini'}, {'forename': 'Pierre-Henri', 'surname': 'Raphanel'}, {'forename': 'Ralph', 'surname': 'Firman'}, {'forename': 'Ren̩', 'surname': 'Arnoux'}, {'forename': 'Ricardo', 'surname': 'Rosset'}, {'forename': 'Riccardo', 'surname': 'Patrese'}, {'forename': 'Roberto', 'surname': 'Moreno'}, {'forename': 'Satoru', 'surname': 'Nakajima'}, {'forename': 'Shinji', 'surname': 'Nakano'}, {'forename': 'Stefan', 'surname': 'Johansson'}, {'forename': 'Stefano', 'surname': 'Modena'}, {'forename': 'Taki', 'surname': 'Inoue'}, {'forename': 'Tarso', 'surname': 'Marques'}, {'forename': 'Teo', 'surname': 'Fabi'}, {'forename': 'Thierry', 'surname': 'Boutsen'}, {'forename': 'Toranosuke', 'surname': 'Takagi'}, {'forename': 'Toshio', 'surname': 'Suzuki'}, {'forename': 'Ukyo', 'surname': 'Katayama'}, {'forename': 'Vincenzo', 'surname': 'Sospiri'}, {'forename': 'Yannick', 'surname': 'Dalmas'}, {'forename': 'Yuji', 'surname': 'Ide'}, {'forename': '��ric', 'surname': 'Bernard'}, {'forename': '��rik', 'surname': 'Comas'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
true
false
machine_repair
CREATE TABLE machine ( "Machine_ID" INTEGER, "Making_Year" INTEGER, "Class" TEXT, "Team" TEXT, "Machine_series" TEXT, value_points REAL, quality_rank INTEGER, PRIMARY KEY ("Machine_ID") ) CREATE TABLE repair ( "repair_ID" INTEGER, name TEXT, "Launch_Date" TEXT, "Notes" TEXT, PRIMARY KEY ("repair_ID") ) CREATE TABLE repair_assignment ( technician_id INTEGER, "repair_ID" INTEGER, "Machine_ID" INTEGER, PRIMARY KEY (technician_id, "repair_ID", "Machine_ID"), FOREIGN KEY("Machine_ID") REFERENCES machine ("Machine_ID"), FOREIGN KEY("repair_ID") REFERENCES repair ("repair_ID"), FOREIGN KEY(technician_id) REFERENCES technician (technician_id) ) CREATE TABLE technician ( technician_id REAL, "Name" TEXT, "Team" TEXT, "Starting_Year" REAL, "Age" INTEGER, PRIMARY KEY (technician_id) )
CREATE TABLE machine ( "Machine_ID" INTEGER, "Making_Year" INTEGER, "Class" TEXT, "Team" TEXT, "Machine_series" TEXT, value_points REAL, quality_rank INTEGER, PRIMARY KEY ("Machine_ID") ) /* 2 rows from machine table: Machine_ID Making_Year Class Team Machine_series value_points quality_rank 1 1991 125cc Hero Sports TS- Honda RS125 105.0 2 2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1 */ CREATE TABLE repair ( "repair_ID" INTEGER, name TEXT, "Launch_Date" TEXT, "Notes" TEXT, PRIMARY KEY ("repair_ID") ) /* 2 rows from repair table: repair_ID name Launch_Date Notes 1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit 2 Discoverer 1 28 Feb 2009 First object in polar orbit */ CREATE TABLE repair_assignment ( technician_id INTEGER, "repair_ID" INTEGER, "Machine_ID" INTEGER, PRIMARY KEY (technician_id, "repair_ID", "Machine_ID"), FOREIGN KEY("Machine_ID") REFERENCES machine ("Machine_ID"), FOREIGN KEY("repair_ID") REFERENCES repair ("repair_ID"), FOREIGN KEY(technician_id) REFERENCES technician (technician_id) ) /* 2 rows from repair_assignment table: technician_id repair_ID Machine_ID 1 1 1 2 2 2 */ CREATE TABLE technician ( technician_id REAL, "Name" TEXT, "Team" TEXT, "Starting_Year" REAL, "Age" INTEGER, PRIMARY KEY (technician_id) ) /* 2 rows from technician table: technician_id Name Team Starting_Year Age 1.0 Joe Sewell NYY 2012.0 37 2.0 John Brown NYY 2013.0 36 */
What are the teams with the most technicians?
SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1
[{'Team': 'CLE'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
cre_Docs_and_Epenses
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") )
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) /* 2 rows from Accounts table: Account_ID Statement_ID Account_Details 7 57 495.063 61 57 930.14 */ CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) /* 2 rows from Documents table: Document_ID Document_Type_Code Project_ID Document_Date Document_Name Document_Description Other_Details 29 CV 30 2004-08-28 06:59:19 Review on UK files None None 42 BK 105 2012-12-27 19:09:18 Review on Canadian files None None */ CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Documents_with_Expenses table: Document_ID Budget_Type_Code Document_Details 57 GV government 192 GV government */ CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) /* 2 rows from Projects table: Project_ID Project_Details 30 Society Research project 35 Internet of Things project */ CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) /* 2 rows from Ref_Budget_Codes table: Budget_Type_Code Budget_Type_Description GV Government ORG Organisation */ CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) /* 2 rows from Ref_Document_Types table: Document_Type_Code Document_Type_Name Document_Type_Description BK Book excellent CV CV excellent */ CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Statements table: Statement_ID Statement_Details 57 Open Project 192 Private Project */
What are the codes, names, and descriptions of the different document types?
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
[{'Document_Type_Code': 'BK', 'Document_Type_Name': 'Book', 'Document_Type_Description': 'excellent'}, {'Document_Type_Code': 'CV', 'Document_Type_Name': 'CV', 'Document_Type_Description': 'excellent'}, {'Document_Type_Code': 'PT', 'Document_Type_Name': 'Presentation', 'Document_Type_Description': 'very good'}, {'Document_Type_Code': 'PP', 'Document_Type_Name': 'Paper', 'Document_Type_Description': 'good'}, {'Document_Type_Code': 'FM', 'Document_Type_Name': 'Film', 'Document_Type_Description': 'fun'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the different template type codes, and how many documents use each type?[/QUESTION] [SQL]SELECT T1.template_type_code , count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code[/SQL]
[QUESTION]What are the different template type codes, and how many documents use each type?[/QUESTION] [SQL]SELECT T1.template_type_code , count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code[/SQL]
[QUESTION]What are the different template type codes, and how many documents use each type?[/QUESTION] [SQL]SELECT T1.template_type_code , count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code[/SQL]
[QUESTION]What are the different template type codes, and how many documents use each type?[/QUESTION] [SQL]SELECT T1.template_type_code , count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code[/SQL]
products_gen_characteristics
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) )
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) /* 2 rows from Characteristics table: characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details 1 Grade numquam slow None 2 Grade doloribus fast None */ CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) /* 2 rows from Product_Characteristics table: product_id characteristic_id product_characteristic_value 13 13 low 11 2 low */ CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) /* 2 rows from Products table: product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details 1 4 Spices cumin 2878.3 et None 2 2 Spices peper 352447.2874677 1892070.2803543 rerum None */ CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) /* 2 rows from Ref_Characteristic_Types table: characteristic_type_code characteristic_type_description Grade Grade Purity Purity */ CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) /* 2 rows from Ref_Colors table: color_code color_description 9 red 5 green */ CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) ) /* 2 rows from Ref_Product_Categories table: product_category_code product_category_description unit_of_measure Herbs Herbs Handful Seeds Seeds Weight - pound,kilo. */
Find the product category description of the product category with code "Spices".
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
[{'product_category_description': 'Spices'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
manufacturer
CREATE TABLE furniture ( "Furniture_ID" INTEGER, "Name" TEXT, "Num_of_Component" INTEGER, "Market_Rate" REAL, PRIMARY KEY ("Furniture_ID") ) CREATE TABLE furniture_manufacte ( "Manufacturer_ID" INTEGER, "Furniture_ID" INTEGER, "Price_in_Dollar" REAL, PRIMARY KEY ("Manufacturer_ID", "Furniture_ID"), FOREIGN KEY("Furniture_ID") REFERENCES furniture ("Furniture_ID"), FOREIGN KEY("Manufacturer_ID") REFERENCES manufacturer ("Manufacturer_ID") ) CREATE TABLE manufacturer ( "Manufacturer_ID" INTEGER, "Open_Year" REAL, "Name" TEXT, "Num_of_Factories" INTEGER, "Num_of_Shops" INTEGER, PRIMARY KEY ("Manufacturer_ID") )
CREATE TABLE furniture ( "Furniture_ID" INTEGER, "Name" TEXT, "Num_of_Component" INTEGER, "Market_Rate" REAL, PRIMARY KEY ("Furniture_ID") ) /* 2 rows from furniture table: Furniture_ID Name Num_of_Component Market_Rate 1 Billiard table 14 52.5 2 Chabudai 4 40.0 */ CREATE TABLE furniture_manufacte ( "Manufacturer_ID" INTEGER, "Furniture_ID" INTEGER, "Price_in_Dollar" REAL, PRIMARY KEY ("Manufacturer_ID", "Furniture_ID"), FOREIGN KEY("Furniture_ID") REFERENCES furniture ("Furniture_ID"), FOREIGN KEY("Manufacturer_ID") REFERENCES manufacturer ("Manufacturer_ID") ) /* 2 rows from furniture_manufacte table: Manufacturer_ID Furniture_ID Price_in_Dollar 1 3 239.0 4 2 450.0 */ CREATE TABLE manufacturer ( "Manufacturer_ID" INTEGER, "Open_Year" REAL, "Name" TEXT, "Num_of_Factories" INTEGER, "Num_of_Shops" INTEGER, PRIMARY KEY ("Manufacturer_ID") ) /* 2 rows from manufacturer table: Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops 1 1980.0 Chevrolet House 36 8 2 1990.0 IKEA 21 19 */
Find the id and number of shops for the company that produces the most expensive furniture.
SELECT t1.manufacturer_id , t1.num_of_shops FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id ORDER BY t2.Price_in_Dollar DESC LIMIT 1
[{'Manufacturer_ID': 7, 'Num_of_Shops': 4}]
Medium
false
false
false
true
true
false
false
true
false
false
false
false
false
[QUESTION]Find the city with the most number of stores.[/QUESTION] [SQL]SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Find the city with the most number of stores.[/QUESTION] [SQL]SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Find the city with the most number of stores.[/QUESTION] [SQL]SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1[/SQL]
soccer_2
CREATE TABLE "College" ( "cName" VARCHAR(20) NOT NULL, state VARCHAR(2), enr NUMERIC(5, 0), PRIMARY KEY ("cName") ) CREATE TABLE "Player" ( "pID" NUMERIC(5, 0) NOT NULL, "pName" VARCHAR(20), "yCard" VARCHAR(3), "HS" NUMERIC(5, 0), PRIMARY KEY ("pID") ) CREATE TABLE "Tryout" ( "pID" NUMERIC(5, 0), "cName" VARCHAR(20), "pPos" VARCHAR(8), decision VARCHAR(3), PRIMARY KEY ("pID", "cName"), FOREIGN KEY("pID") REFERENCES "Player" ("pID"), FOREIGN KEY("cName") REFERENCES "College" ("cName") )
CREATE TABLE "College" ( "cName" VARCHAR(20) NOT NULL, state VARCHAR(2), enr NUMERIC(5, 0), PRIMARY KEY ("cName") ) /* 2 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 */ CREATE TABLE "Player" ( "pID" NUMERIC(5, 0) NOT NULL, "pName" VARCHAR(20), "yCard" VARCHAR(3), "HS" NUMERIC(5, 0), PRIMARY KEY ("pID") ) /* 2 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 */ CREATE TABLE "Tryout" ( "pID" NUMERIC(5, 0), "cName" VARCHAR(20), "pPos" VARCHAR(8), decision VARCHAR(3), PRIMARY KEY ("pID", "cName"), FOREIGN KEY("pID") REFERENCES "Player" ("pID"), FOREIGN KEY("cName") REFERENCES "College" ("cName") ) /* 2 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes */
Which college has any student who is a goalie and succeeded in the tryout.
SELECT cName FROM tryout WHERE decision = 'yes' AND pPos = 'goalie'
[{'cName': 'ASU'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
network_2
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) )
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) /* 2 rows from Person table: name age city gender job Alice 25 new york city female student Bob 35 salt lake city male engineer */ CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) ) /* 2 rows from PersonFriend table: name friend year Alice Bob 10 Zach Dan 12 */
What are the names of everybody sorted by age in descending order?
SELECT name FROM Person ORDER BY age DESC
[{'name': 'Zach'}, {'name': 'Bob'}, {'name': 'Dan'}, {'name': 'Alice'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
device
CREATE TABLE device ( "Device_ID" INTEGER, "Device" TEXT, "Carrier" TEXT, "Package_Version" TEXT, "Applications" TEXT, "Software_Platform" TEXT, PRIMARY KEY ("Device_ID") ) CREATE TABLE shop ( "Shop_ID" INTEGER, "Shop_Name" TEXT, "Location" TEXT, "Open_Date" TEXT, "Open_Year" INTEGER, PRIMARY KEY ("Shop_ID") ) CREATE TABLE stock ( "Shop_ID" INTEGER, "Device_ID" INTEGER, "Quantity" INTEGER, PRIMARY KEY ("Shop_ID", "Device_ID"), FOREIGN KEY("Device_ID") REFERENCES device ("Device_ID"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") )
CREATE TABLE device ( "Device_ID" INTEGER, "Device" TEXT, "Carrier" TEXT, "Package_Version" TEXT, "Applications" TEXT, "Software_Platform" TEXT, PRIMARY KEY ("Device_ID") ) /* 2 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS */ CREATE TABLE shop ( "Shop_ID" INTEGER, "Shop_Name" TEXT, "Location" TEXT, "Open_Date" TEXT, "Open_Year" INTEGER, PRIMARY KEY ("Shop_ID") ) /* 2 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 */ CREATE TABLE stock ( "Shop_ID" INTEGER, "Device_ID" INTEGER, "Quantity" INTEGER, PRIMARY KEY ("Shop_ID", "Device_ID"), FOREIGN KEY("Device_ID") REFERENCES device ("Device_ID"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") ) /* 2 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 */
What are the open dates and years for the shop named Apple?
SELECT Open_Date , Open_Year FROM shop WHERE Shop_Name = "Apple"
[{'Open_Date': '10 June', 'Open_Year': 2009}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
yelp
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) )
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) /* 2 rows from business table: bid business_id name full_address city latitude longitude review_count is_open rating state */ CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from category table: id business_id category_name */ CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from checkin table: cid business_id count day */ CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from neighbourhood table: id business_id neighbourhood_name */ CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from review table: rid business_id user_id rating text year month */ CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from tip table: tip_id business_id text user_id likes year month */ CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) ) /* 2 rows from user table: uid user_id name */
How many businesses are there in the " Stone Meadows " neighbourhood in Madison ?
SELECT COUNT ( DISTINCT t1.name ) FROM neighbourhood AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id WHERE t1.city = "Madison" AND t2.neighbourhood_name = "Stone Meadows";
[{'COUNT ( DISTINCT t1.name )': 0}]
Medium
true
false
false
false
false
false
false
true
false
false
false
false
false
cre_Doc_Tracking_DB
CREATE TABLE "All_Documents" ( "Document_ID" INTEGER NOT NULL, "Date_Stored" DATETIME, "Document_Type_Code" CHAR(15) NOT NULL, "Document_Name" CHAR(255), "Document_Description" CHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Date_Stored") REFERENCES "Ref_Calendar" ("Calendar_Date") ) CREATE TABLE "Document_Locations" ( "Document_ID" INTEGER NOT NULL, "Location_Code" CHAR(15) NOT NULL, "Date_in_Location_From" DATETIME NOT NULL, "Date_in_Locaton_To" DATETIME, PRIMARY KEY ("Document_ID", "Location_Code", "Date_in_Location_From"), FOREIGN KEY("Location_Code") REFERENCES "Ref_Locations" ("Location_Code"), FOREIGN KEY("Date_in_Location_From") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Date_in_Locaton_To") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) CREATE TABLE "Documents_to_be_Destroyed" ( "Document_ID" INTEGER NOT NULL, "Destruction_Authorised_by_Employee_ID" INTEGER, "Destroyed_by_Employee_ID" INTEGER, "Planned_Destruction_Date" DATETIME, "Actual_Destruction_Date" DATETIME, "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Destroyed_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Destruction_Authorised_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Planned_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Actual_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) CREATE TABLE "Employees" ( "Employee_ID" INTEGER NOT NULL, "Role_Code" CHAR(15) NOT NULL, "Employee_Name" VARCHAR(255), "Gender_MFU" CHAR(1) NOT NULL, "Date_of_Birth" DATETIME NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Employee_ID"), FOREIGN KEY("Role_Code") REFERENCES "Roles" ("Role_Code") ) CREATE TABLE "Ref_Calendar" ( "Calendar_Date" DATETIME NOT NULL, "Day_Number" INTEGER, PRIMARY KEY ("Calendar_Date") ) CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) CREATE TABLE "Ref_Locations" ( "Location_Code" CHAR(15) NOT NULL, "Location_Name" VARCHAR(255) NOT NULL, "Location_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Location_Code") ) CREATE TABLE "Roles" ( "Role_Code" CHAR(15) NOT NULL, "Role_Name" VARCHAR(255), "Role_Description" VARCHAR(255), PRIMARY KEY ("Role_Code") )
CREATE TABLE "All_Documents" ( "Document_ID" INTEGER NOT NULL, "Date_Stored" DATETIME, "Document_Type_Code" CHAR(15) NOT NULL, "Document_Name" CHAR(255), "Document_Description" CHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Date_Stored") REFERENCES "Ref_Calendar" ("Calendar_Date") ) /* 2 rows from All_Documents table: Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details 7 1976-06-15 03:40:06 CV Robin CV None None 11 1986-10-14 17:53:39 CV Marry CV None None */ CREATE TABLE "Document_Locations" ( "Document_ID" INTEGER NOT NULL, "Location_Code" CHAR(15) NOT NULL, "Date_in_Location_From" DATETIME NOT NULL, "Date_in_Locaton_To" DATETIME, PRIMARY KEY ("Document_ID", "Location_Code", "Date_in_Location_From"), FOREIGN KEY("Location_Code") REFERENCES "Ref_Locations" ("Location_Code"), FOREIGN KEY("Date_in_Location_From") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Date_in_Locaton_To") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) /* 2 rows from Document_Locations table: Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To 7 e 2017-01-06 23:17:22 2008-06-08 12:45:38 11 x 2017-01-06 23:17:22 2012-07-03 09:48:46 */ CREATE TABLE "Documents_to_be_Destroyed" ( "Document_ID" INTEGER NOT NULL, "Destruction_Authorised_by_Employee_ID" INTEGER, "Destroyed_by_Employee_ID" INTEGER, "Planned_Destruction_Date" DATETIME, "Actual_Destruction_Date" DATETIME, "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Destroyed_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Destruction_Authorised_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Planned_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Actual_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) /* 2 rows from Documents_to_be_Destroyed table: Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details 7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None 11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None */ CREATE TABLE "Employees" ( "Employee_ID" INTEGER NOT NULL, "Role_Code" CHAR(15) NOT NULL, "Employee_Name" VARCHAR(255), "Gender_MFU" CHAR(1) NOT NULL, "Date_of_Birth" DATETIME NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Employee_ID"), FOREIGN KEY("Role_Code") REFERENCES "Roles" ("Role_Code") ) /* 2 rows from Employees table: Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details 25 HR Leo 1973-02-15 17:16:00 None 30 MG Ebba 1979-09-20 12:50:15 None */ CREATE TABLE "Ref_Calendar" ( "Calendar_Date" DATETIME NOT NULL, "Day_Number" INTEGER, PRIMARY KEY ("Calendar_Date") ) /* 2 rows from Ref_Calendar table: Calendar_Date Day_Number 1972-03-31 09:47:22 5 1976-06-15 03:40:06 7 */ CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) /* 2 rows from Ref_Document_Types table: Document_Type_Code Document_Type_Name Document_Type_Description CV CV BK Book */ CREATE TABLE "Ref_Locations" ( "Location_Code" CHAR(15) NOT NULL, "Location_Name" VARCHAR(255) NOT NULL, "Location_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Location_Code") ) /* 2 rows from Ref_Locations table: Location_Code Location_Name Location_Description b Brazil c Canada */ CREATE TABLE "Roles" ( "Role_Code" CHAR(15) NOT NULL, "Role_Name" VARCHAR(255), "Role_Description" VARCHAR(255), PRIMARY KEY ("Role_Code") ) /* 2 rows from Roles table: Role_Code Role_Name Role_Description MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur f ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos. */
What are the id of each employee and the number of document destroyed by that employee?
SELECT Destroyed_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID
[{'Destroyed_by_Employee_ID': 38, 'count(*)': 1}, {'Destroyed_by_Employee_ID': 55, 'count(*)': 1}, {'Destroyed_by_Employee_ID': 99, 'count(*)': 2}, {'Destroyed_by_Employee_ID': 136, 'count(*)': 2}, {'Destroyed_by_Employee_ID': 138, 'count(*)': 1}, {'Destroyed_by_Employee_ID': 156, 'count(*)': 1}, {'Destroyed_by_Employee_ID': 173, 'count(*)': 3}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]What is the id of every employee who has at least a salary of 100000?[/QUESTION] [SQL]SELECT eid FROM Employee WHERE salary > 100000[/SQL]
[QUESTION]What is the id of every employee who has at least a salary of 100000?[/QUESTION] [SQL]SELECT eid FROM Employee WHERE salary > 100000[/SQL]
pets_1
CREATE TABLE "Has_Pet" ( "StuID" INTEGER, "PetID" INTEGER, FOREIGN KEY("PetID") REFERENCES "Pets" ("PetID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "Pets" ( "PetID" INTEGER, "PetType" VARCHAR(20), pet_age INTEGER, weight REAL, PRIMARY KEY ("PetID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Has_Pet" ( "StuID" INTEGER, "PetID" INTEGER, FOREIGN KEY("PetID") REFERENCES "Pets" ("PetID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from Has_Pet table: StuID PetID 1001 2001 1002 2002 */ CREATE TABLE "Pets" ( "PetID" INTEGER, "PetType" VARCHAR(20), pet_age INTEGER, weight REAL, PRIMARY KEY ("PetID") ) /* 2 rows from Pets table: PetID PetType pet_age weight 2001 cat 3 12.0 2002 dog 2 13.4 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
Find the weight of the youngest dog.
SELECT weight FROM pets ORDER BY pet_age LIMIT 1
[{'weight': 9.3}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]List the last name of the owner owning the youngest dog.[/QUESTION] [SQL]SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )[/SQL]
[QUESTION]List the last name of the owner owning the youngest dog.[/QUESTION] [SQL]SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )[/SQL]
[QUESTION]List the last name of the owner owning the youngest dog.[/QUESTION] [SQL]SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )[/SQL]
[QUESTION]List the last name of the owner owning the youngest dog.[/QUESTION] [SQL]SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = ( SELECT max(age) FROM Dogs )[/SQL]
coffee_shop
CREATE TABLE happy_hour ( "HH_ID" INTEGER, "Shop_ID" INTEGER, "Month" TEXT, "Num_of_shaff_in_charge" INTEGER, PRIMARY KEY ("HH_ID", "Shop_ID", "Month"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") ) CREATE TABLE happy_hour_member ( "HH_ID" INTEGER, "Member_ID" INTEGER, "Total_amount" REAL, PRIMARY KEY ("HH_ID", "Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID") ) CREATE TABLE member ( "Member_ID" INTEGER, "Name" TEXT, "Membership_card" TEXT, "Age" INTEGER, "Time_of_purchase" INTEGER, "Level_of_membership" INTEGER, "Address" TEXT, PRIMARY KEY ("Member_ID") ) CREATE TABLE shop ( "Shop_ID" INTEGER, "Address" TEXT, "Num_of_staff" TEXT, "Score" REAL, "Open_Year" TEXT, PRIMARY KEY ("Shop_ID") )
CREATE TABLE happy_hour ( "HH_ID" INTEGER, "Shop_ID" INTEGER, "Month" TEXT, "Num_of_shaff_in_charge" INTEGER, PRIMARY KEY ("HH_ID", "Shop_ID", "Month"), FOREIGN KEY("Shop_ID") REFERENCES shop ("Shop_ID") ) /* 2 rows from happy_hour table: HH_ID Shop_ID Month Num_of_shaff_in_charge 1 1 May 10 2 1 April 12 */ CREATE TABLE happy_hour_member ( "HH_ID" INTEGER, "Member_ID" INTEGER, "Total_amount" REAL, PRIMARY KEY ("HH_ID", "Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID") ) /* 2 rows from happy_hour_member table: HH_ID Member_ID Total_amount 1 3 20.9 4 3 20.92 */ CREATE TABLE member ( "Member_ID" INTEGER, "Name" TEXT, "Membership_card" TEXT, "Age" INTEGER, "Time_of_purchase" INTEGER, "Level_of_membership" INTEGER, "Address" TEXT, PRIMARY KEY ("Member_ID") ) /* 2 rows from member table: Member_ID Name Membership_card Age Time_of_purchase Level_of_membership Address 1 Ashby, Lazale Black 29 18 5 Hartford 2 Breton, Robert White 67 41 4 Waterbury */ CREATE TABLE shop ( "Shop_ID" INTEGER, "Address" TEXT, "Num_of_staff" TEXT, "Score" REAL, "Open_Year" TEXT, PRIMARY KEY ("Shop_ID") ) /* 2 rows from shop table: Shop_ID Address Num_of_staff Score Open_Year 1 1200 Main Street 13 42.0 2010 2 1111 Main Street 19 38.0 2008 */
Which address do not have any member with the black membership card?
SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'
[{'Address': 'Cheshire'}]
Hard
false
false
false
false
false
false
false
false
false
false
false
true
false
wedding
CREATE TABLE church ( "Church_ID" INTEGER, "Name" TEXT, "Organized_by" TEXT, "Open_Date" INTEGER, "Continuation_of" TEXT, PRIMARY KEY ("Church_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Is_Male" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") ) CREATE TABLE wedding ( "Church_ID" INTEGER, "Male_ID" INTEGER, "Female_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Church_ID", "Male_ID", "Female_ID"), FOREIGN KEY("Female_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Male_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Church_ID") REFERENCES church ("Church_ID") )
CREATE TABLE church ( "Church_ID" INTEGER, "Name" TEXT, "Organized_by" TEXT, "Open_Date" INTEGER, "Continuation_of" TEXT, PRIMARY KEY ("Church_ID") ) /* 2 rows from church table: Church_ID Name Organized_by Open_Date Continuation_of 1 Pure Church of Christ Wycam Clark 1831 Church of Christ 2 Independent Church – Hoton 1832 Church of Christ */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Is_Male" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Country Is_Male Age 1 Mike Weir Canada T 34 2 Juli Hanson Sweden F 32 */ CREATE TABLE wedding ( "Church_ID" INTEGER, "Male_ID" INTEGER, "Female_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Church_ID", "Male_ID", "Female_ID"), FOREIGN KEY("Female_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Male_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Church_ID") REFERENCES church ("Church_ID") ) /* 2 rows from wedding table: Church_ID Male_ID Female_ID Year 1 1 2 2014 3 3 4 2015 */
Show the pair of male and female names in all weddings after year 2014
SELECT T2.name , T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014
[{'Name': 'Summer Duval'}, {'Name': 'Annie Mediate'}, {'Name': "Joe O'Hair"}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
products_gen_characteristics
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) )
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) /* 2 rows from Characteristics table: characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details 1 Grade numquam slow None 2 Grade doloribus fast None */ CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) /* 2 rows from Product_Characteristics table: product_id characteristic_id product_characteristic_value 13 13 low 11 2 low */ CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) /* 2 rows from Products table: product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details 1 4 Spices cumin 2878.3 et None 2 2 Spices peper 352447.2874677 1892070.2803543 rerum None */ CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) /* 2 rows from Ref_Characteristic_Types table: characteristic_type_code characteristic_type_description Grade Grade Purity Purity */ CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) /* 2 rows from Ref_Colors table: color_code color_description 9 red 5 green */ CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) ) /* 2 rows from Ref_Product_Categories table: product_category_code product_category_description unit_of_measure Herbs Herbs Handful Seeds Seeds Weight - pound,kilo. */
How many products have their color described as 'white' or have a characteristic with the name 'hot'?
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
[{'count(*)': 1}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
cinema
CREATE TABLE cinema ( "Cinema_ID" INTEGER, "Name" TEXT, "Openning_year" INTEGER, "Capacity" INTEGER, "Location" TEXT, PRIMARY KEY ("Cinema_ID") ) CREATE TABLE film ( "Film_ID" INTEGER, "Rank_in_series" INTEGER, "Number_in_season" INTEGER, "Title" TEXT, "Directed_by" TEXT, "Original_air_date" TEXT, "Production_code" TEXT, PRIMARY KEY ("Film_ID") ) CREATE TABLE schedule ( "Cinema_ID" INTEGER, "Film_ID" INTEGER, "Date" TEXT, "Show_times_per_day" INTEGER, "Price" FLOAT, PRIMARY KEY ("Cinema_ID", "Film_ID"), FOREIGN KEY("Cinema_ID") REFERENCES cinema ("Cinema_ID"), FOREIGN KEY("Film_ID") REFERENCES film ("Film_ID") )
CREATE TABLE cinema ( "Cinema_ID" INTEGER, "Name" TEXT, "Openning_year" INTEGER, "Capacity" INTEGER, "Location" TEXT, PRIMARY KEY ("Cinema_ID") ) /* 2 rows from cinema table: Cinema_ID Name Openning_year Capacity Location 1 Codling 2010 1100 County Wicklow 2 Carrowleagh 2012 368 County Cork */ CREATE TABLE film ( "Film_ID" INTEGER, "Rank_in_series" INTEGER, "Number_in_season" INTEGER, "Title" TEXT, "Directed_by" TEXT, "Original_air_date" TEXT, "Production_code" TEXT, PRIMARY KEY ("Film_ID") ) /* 2 rows from film table: Film_ID Rank_in_series Number_in_season Title Directed_by Original_air_date Production_code 1 26 1 The Case of the Mystery Weekend Bill Schreiner September 21–25, 1992 50021–50025 2 27 2 The Case of the Smart Dummy Bill Schreiner September 28–October 2, 1992 50231–50235 */ CREATE TABLE schedule ( "Cinema_ID" INTEGER, "Film_ID" INTEGER, "Date" TEXT, "Show_times_per_day" INTEGER, "Price" FLOAT, PRIMARY KEY ("Cinema_ID", "Film_ID"), FOREIGN KEY("Cinema_ID") REFERENCES cinema ("Cinema_ID"), FOREIGN KEY("Film_ID") REFERENCES film ("Film_ID") ) /* 2 rows from schedule table: Cinema_ID Film_ID Date Show_times_per_day Price 1 1 21 May 5 12.99 1 2 21 May 3 12.99 */
Find the distinct locations that has a cinema.
SELECT DISTINCT LOCATION FROM cinema
[{'Location': 'County Wicklow'}, {'Location': 'County Cork'}, {'Location': 'County Dublin'}, {'Location': 'County Clare'}, {'Location': 'County Tipperary'}, {'Location': 'County Laois'}, {'Location': 'County Louth'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
car_1
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") )
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) /* 2 rows from car_makers table: Id Maker FullName Country 1 amc American Motor Company 1 2 volkswagen Volkswagen 2 */ CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) /* 2 rows from car_names table: MakeId Model Make 1 chevrolet chevrolet chevelle malibu 2 buick buick skylark 320 */ CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) /* 2 rows from cars_data table: Id MPG Cylinders Edispl Horsepower Weight Accelerate Year 1 18 8 307.0 130 3504 12.0 1970 2 15 8 350.0 165 3693 11.5 1970 */ CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) /* 2 rows from continents table: ContId Continent 1 america 2 europe */ CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) /* 2 rows from countries table: CountryId CountryName Continent 1 usa 1 2 germany 2 */ CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") ) /* 2 rows from model_list table: ModelId Maker Model 1 1 amc 2 2 audi */
What is the horsepower of the car with the largest accelerate?
SELECT T1.horsepower FROM CARS_DATA AS T1 ORDER BY T1.accelerate DESC LIMIT 1;
[{'Horsepower': '71'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]How many cars have a larger accelerate than the car with the largest horsepower?[/QUESTION] [SQL]SELECT COUNT(*) FROM CARS_DATA WHERE Accelerate > ( SELECT Accelerate FROM CARS_DATA ORDER BY Horsepower DESC LIMIT 1 );[/SQL]
[QUESTION]How many cars have a larger accelerate than the car with the largest horsepower?[/QUESTION] [SQL]SELECT COUNT(*) FROM CARS_DATA WHERE Accelerate > ( SELECT Accelerate FROM CARS_DATA ORDER BY Horsepower DESC LIMIT 1 );[/SQL]
[QUESTION]How many cars have a larger accelerate than the car with the largest horsepower?[/QUESTION] [SQL]SELECT COUNT(*) FROM CARS_DATA WHERE Accelerate > ( SELECT Accelerate FROM CARS_DATA ORDER BY Horsepower DESC LIMIT 1 );[/SQL]
[QUESTION]How many cars have a larger accelerate than the car with the largest horsepower?[/QUESTION] [SQL]SELECT COUNT(*) FROM CARS_DATA WHERE Accelerate > ( SELECT Accelerate FROM CARS_DATA ORDER BY Horsepower DESC LIMIT 1 );[/SQL]
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
List the names of all the distinct customers who bought a keyboard.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard"
[{'customer_name': 'Jon'}, {'customer_name': 'Cordell'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]List the name of all different customers who have some loan sorted by their total loan amount.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)[/SQL]
[QUESTION]List the name of all different customers who have some loan sorted by their total loan amount.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)[/SQL]
[QUESTION]List the name of all different customers who have some loan sorted by their total loan amount.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)[/SQL]
gymnast
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") )
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) /* 2 rows from gymnast table: Gymnast_ID Floor_Exercise_Points Pommel_Horse_Points Rings_Points Vault_Points Parallel_Bars_Points Horizontal_Bar_Points Total_Points 1 9.725 9.737 9.512 9.575 9.762 9.75 58.061 2 9.7 9.625 9.625 9.65 9.587 9.737 57.924 */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Age Height Hometown 1 Paul Hamm 24.0 1.71 Santo Domingo 2 Lorraine Súarez Carmona 21.0 1.75 Bonao */
Return the hometown that is most common among gymnasts.
SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1
[{'Hometown': 'Santo Domingo'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
customers_and_addresses
CREATE TABLE "Addresses" ( address_id INTEGER, address_content VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Contact_Channels" ( customer_id INTEGER NOT NULL, channel_code VARCHAR(15) NOT NULL, active_from_date DATETIME NOT NULL, active_to_date DATETIME, contact_number VARCHAR(50) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(15) NOT NULL, order_date DATETIME, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(15), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_details VARCHAR(255), PRIMARY KEY (product_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_content VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_content city zip_postcode state_province_county country other_address_details 1 9443 Boyle Route Suite 857 Lucasville 416 Colorado USA None 2 1969 Jabari Port Suite 393 New Sabryna 721 SouthCarolina USA None */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_address_from address_type date_address_to 2 11 1985-03-29 20:31:43 Billing 1993-02-17 17:55:18 13 11 2010-08-25 04:24:35 Billing 1972-02-17 22:23:38 */ CREATE TABLE "Customer_Contact_Channels" ( customer_id INTEGER NOT NULL, channel_code VARCHAR(15) NOT NULL, active_from_date DATETIME NOT NULL, active_to_date DATETIME, contact_number VARCHAR(50) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Contact_Channels table: customer_id channel_code active_from_date active_to_date contact_number 9 Email 2017-12-07 18:18:15 2018-03-23 13:37:14 940.035.6435x0225 2 Email 2017-04-07 04:51:41 2018-03-23 01:30:52 189.449.8326x7607 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(15) NOT NULL, order_date DATETIME, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status order_date order_details 1 15 Cancelled 2018-03-21 11:20:46 None 2 3 Cancelled 2018-03-05 06:35:33 None */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method customer_name date_became_customer other_customer_details 1 Cash Dr. Julia Wuckert MD 2018-03-01 23:20:10 None 2 Cheque Tillman Ernser 2018-02-28 11:37:44 None */ CREATE TABLE "Order_Items" ( order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(15), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_id product_id order_quantity 14 2 5 5 2 9 */ CREATE TABLE "Products" ( product_id INTEGER, product_details VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_details 1 Americano 2 Dove Chocolate */
Which customers use "Cash" for payment method? Return the customer names.
SELECT customer_name FROM customers WHERE payment_method = "Cash"
[{'customer_name': 'Dr. Julia Wuckert MD'}, {'customer_name': 'Maudie Kertzmann'}, {'customer_name': 'Kitty Padberg III'}, {'customer_name': 'Prof. Ibrahim Bashirian'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
farm
CREATE TABLE city ( "City_ID" INTEGER, "Official_Name" TEXT, "Status" TEXT, "Area_km_2" REAL, "Population" REAL, "Census_Ranking" TEXT, PRIMARY KEY ("City_ID") ) CREATE TABLE competition_record ( "Competition_ID" INTEGER, "Farm_ID" INTEGER, "Rank" INTEGER, PRIMARY KEY ("Competition_ID", "Farm_ID"), FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"), FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID") ) CREATE TABLE farm ( "Farm_ID" INTEGER, "Year" INTEGER, "Total_Horses" REAL, "Working_Horses" REAL, "Total_Cattle" REAL, "Oxen" REAL, "Bulls" REAL, "Cows" REAL, "Pigs" REAL, "Sheep_and_Goats" REAL, PRIMARY KEY ("Farm_ID") ) CREATE TABLE farm_competition ( "Competition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Host_city_ID" INTEGER, "Hosts" TEXT, PRIMARY KEY ("Competition_ID"), FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID") )
CREATE TABLE city ( "City_ID" INTEGER, "Official_Name" TEXT, "Status" TEXT, "Area_km_2" REAL, "Population" REAL, "Census_Ranking" TEXT, PRIMARY KEY ("City_ID") ) /* 2 rows from city table: City_ID Official_Name Status Area_km_2 Population Census_Ranking 1 Grand Falls/Grand-Sault Town 18.06 5706.0 636 of 5008 2 Perth-Andover Village 8.89 1778.0 1442 of 5,008 */ CREATE TABLE competition_record ( "Competition_ID" INTEGER, "Farm_ID" INTEGER, "Rank" INTEGER, PRIMARY KEY ("Competition_ID", "Farm_ID"), FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"), FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID") ) /* 2 rows from competition_record table: Competition_ID Farm_ID Rank 1 8 1 1 2 2 */ CREATE TABLE farm ( "Farm_ID" INTEGER, "Year" INTEGER, "Total_Horses" REAL, "Working_Horses" REAL, "Total_Cattle" REAL, "Oxen" REAL, "Bulls" REAL, "Cows" REAL, "Pigs" REAL, "Sheep_and_Goats" REAL, PRIMARY KEY ("Farm_ID") ) /* 2 rows from farm table: Farm_ID Year Total_Horses Working_Horses Total_Cattle Oxen Bulls Cows Pigs Sheep_and_Goats 1 1927 5056.5 3900.1 8374.5 805.5 31.6 3852.1 4412.4 7956.3 2 1928 5486.9 4090.5 8604.8 895.3 32.8 3987.0 6962.9 8112.2 */ CREATE TABLE farm_competition ( "Competition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Host_city_ID" INTEGER, "Hosts" TEXT, PRIMARY KEY ("Competition_ID"), FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID") ) /* 2 rows from farm_competition table: Competition_ID Year Theme Host_city_ID Hosts 1 2013 Carnival M is back! 1 Miley Cyrus Jared Leto and Karen Mok 2 2006 Codehunters 2 Leehom Wang and Kelly Rowland */
Count the number of different statuses.
SELECT count(DISTINCT Status) FROM city
[{'count(DISTINCT Status)': 2}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Count the number of matches.[/QUESTION] [SQL]SELECT count(*) FROM matches[/SQL]
[QUESTION]Count the number of matches.[/QUESTION] [SQL]SELECT count(*) FROM matches[/SQL]
[QUESTION]Count the number of matches.[/QUESTION] [SQL]SELECT count(*) FROM matches[/SQL]
college_2
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) )
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) /* 2 rows from advisor table: s_ID i_ID 24746 19368 79352 95030 */ CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) /* 2 rows from classroom table: building room_number capacity Lamberton 134 10 Chandler 375 10 */ CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) /* 2 rows from course table: course_id title dept_name credits 787 C Programming Mech. Eng. 4 238 The Music of Donovan Mech. Eng. 3 */ CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) /* 2 rows from department table: dept_name building budget Civil Eng. Chandler 255041.46 Biology Candlestick 647610.55 */ CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) /* 2 rows from instructor table: ID name dept_name salary 63395 McKinnon Cybernetics 94333.99 78699 Pingr Statistics 59303.62 */ CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) /* 2 rows from prereq table: course_id prereq_id 376 130 760 169 */ CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) /* 2 rows from section table: course_id sec_id semester year building room_number time_slot_id 313 1 Fall 2010 Chandler 804 N 747 1 Spring 2004 Gates 314 K */ CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) /* 2 rows from student table: ID name dept_name tot_cred 24746 Schrefl History 4 79352 Rumat Finance 100 */ CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) /* 2 rows from takes table: ID course_id sec_id semester year grade 65901 401 1 Fall 2003 C- 24932 802 1 Spring 2003 B- */ CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) /* 2 rows from teaches table: ID course_id sec_id semester year 34175 747 1 Spring 2004 3199 169 1 Spring 2007 */ CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) ) /* 2 rows from time_slot table: time_slot_id day start_hr start_min end_hr end_min A M 8.0000000000 0E-10 8.0000000000 50.0000000000 A W 8.0000000000 0E-10 8.0000000000 50.0000000000 */
Give the name of the lowest earning instructor in the Statistics department.
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
[{'name': 'Gutierrez'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]What is the name of the department with the student that has the lowest GPA?[/QUESTION] [SQL]SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1[/SQL]
[QUESTION]What is the name of the department with the student that has the lowest GPA?[/QUESTION] [SQL]SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1[/SQL]
[QUESTION]What is the name of the department with the student that has the lowest GPA?[/QUESTION] [SQL]SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1[/SQL]
small_bank_1
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) )
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) /* 2 rows from ACCOUNTS table: custid name 1 Brown 2 Wang */ CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 */ CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 */
Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.
SELECT T1.name , T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT avg(balance) FROM savings)
[{'name': 'Wang', 'T2.balance + T3.balance': 1000001999.0}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]Find the name, account type, and account balance of the customer who has the highest credit score.[/QUESTION] [SQL]SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1[/SQL]
[QUESTION]Find the name, account type, and account balance of the customer who has the highest credit score.[/QUESTION] [SQL]SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1[/SQL]
[QUESTION]Find the name, account type, and account balance of the customer who has the highest credit score.[/QUESTION] [SQL]SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1[/SQL]
[QUESTION]Find the name, account type, and account balance of the customer who has the highest credit score.[/QUESTION] [SQL]SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1[/SQL]
academic
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) )
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) /* 2 rows from author table: aid homepage name oid */ CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) /* 2 rows from cite table: cited citing */ CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) /* 2 rows from conference table: cid homepage name */ CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) /* 2 rows from domain table: did name */ CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from domain_author table: aid did */ CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from domain_conference table: cid did */ CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_journal table: did jid */ CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_keyword table: did kid */ CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_publication table: did pid */ CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) /* 2 rows from journal table: homepage jid name */ CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) /* 2 rows from keyword table: keyword kid */ CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) /* 2 rows from organization table: continent homepage name oid */ CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from publication table: abstract cid citation_num jid pid reference_num title year */ CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) /* 2 rows from publication_keyword table: pid kid */ CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from writes table: aid pid */
return me the number of papers published in PVLDB in each year .
SELECT COUNT ( DISTINCT t2.title ) , t2.year FROM publication AS t2 JOIN journal AS t1 ON t2.jid = t1.jid WHERE t1.name = "PVLDB" GROUP BY t2.year;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
true
false
false
false
false
true
false
true
false
false
false
false
false
[QUESTION]return me the number of authors who have papers in PVLDB .[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB";[/SQL]
[QUESTION]return me the number of authors who have papers in PVLDB .[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB";[/SQL]
[QUESTION]return me the number of authors who have papers in PVLDB .[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB";[/SQL]
[QUESTION]return me the number of authors who have papers in PVLDB .[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB";[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
What was the first paper on deep learning written ?
SELECT DISTINCT t3.year FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid WHERE t1.keyphrasename = "deep learning" GROUP BY t3.year ORDER BY t3.year ASC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what state has the largest urban population
SELECT state_name FROM city GROUP BY state_name ORDER BY SUM ( population ) DESC LIMIT 1;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]Which district has the largest population?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]Which district has the largest population?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]Which district has the largest population?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]Which district has the largest population?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
e_learning
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) )
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) /* 2 rows from Course_Authors_and_Tutors table: author_id author_tutor_ATB login_name password personal_name middle_name family_name gender_mf address_line_1 1 331 jmckenzie c40fa148bdd0d2d45cd6e9ec1e685750fe07f81b Cathrine Ruthie Grant 0 756 Monahan Mews Spinkashire, NJ 64230-5098 2 975 heidenreich.ara 24b0ee84063c3b017ab1839e01b7280f47f7c7c2 Retha Corene Armstrong 0 98623 Huels Manor Jasttown, DE 31611 */ CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) /* 2 rows from Courses table: course_id author_id subject_id course_name course_description 1 8 1 database database 2 6 1 advanced database advanced database */ CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Enrolment table: registration_id student_id course_id date_of_enrolment date_of_completion 1 11 2 2017-10-09 07:09:02 2018-02-26 07:48:52 2 15 4 2017-11-13 12:49:33 2018-03-04 01:24:56 */ CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) /* 2 rows from Student_Tests_Taken table: registration_id date_test_taken test_result 12 2018-03-25 03:27:16 Fail 10 2018-03-25 21:50:22 Pass */ CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) /* 2 rows from Students table: student_id date_of_registration date_of_latest_logon login_name password personal_name middle_name family_name 1 2015-07-22 13:32:35 2017-10-17 22:52:26 annamae.hoppe db8765bb6f Wilson Aubrey Ward 2 2015-07-02 00:21:42 2017-06-24 22:16:27 wmiller 35faf8182a Karson Luella Jaskolski */ CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) ) /* 2 rows from Subjects table: subject_id subject_name 1 Computer Science 2 Arts */
List all the subject names.
SELECT subject_name FROM SUBJECTS
[{'subject_name': 'Computer Science'}, {'subject_name': 'Arts'}, {'subject_name': 'Language'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]List all the student details in reversed lexicographical order.[/QUESTION] [SQL]SELECT other_student_details FROM Students ORDER BY other_student_details DESC[/SQL]
concert_singer
CREATE TABLE concert ( "concert_ID" INTEGER, "concert_Name" TEXT, "Theme" TEXT, "Stadium_ID" TEXT, "Year" TEXT, PRIMARY KEY ("concert_ID"), FOREIGN KEY("Stadium_ID") REFERENCES stadium ("Stadium_ID") ) CREATE TABLE singer ( "Singer_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Song_Name" TEXT, "Song_release_year" TEXT, "Age" INTEGER, "Is_male" BOOLEAN, PRIMARY KEY ("Singer_ID") ) CREATE TABLE singer_in_concert ( "concert_ID" INTEGER, "Singer_ID" TEXT, PRIMARY KEY ("concert_ID", "Singer_ID"), FOREIGN KEY("concert_ID") REFERENCES concert ("concert_ID"), FOREIGN KEY("Singer_ID") REFERENCES singer ("Singer_ID") ) CREATE TABLE stadium ( "Stadium_ID" INTEGER, "Location" TEXT, "Name" TEXT, "Capacity" INTEGER, "Highest" INTEGER, "Lowest" INTEGER, "Average" INTEGER, PRIMARY KEY ("Stadium_ID") )
CREATE TABLE concert ( "concert_ID" INTEGER, "concert_Name" TEXT, "Theme" TEXT, "Stadium_ID" TEXT, "Year" TEXT, PRIMARY KEY ("concert_ID"), FOREIGN KEY("Stadium_ID") REFERENCES stadium ("Stadium_ID") ) /* 2 rows from concert table: concert_ID concert_Name Theme Stadium_ID Year 1 Auditions Free choice 1 2014 2 Super bootcamp Free choice 2 2 2014 */ CREATE TABLE singer ( "Singer_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Song_Name" TEXT, "Song_release_year" TEXT, "Age" INTEGER, "Is_male" BOOLEAN, PRIMARY KEY ("Singer_ID") ) /* 2 rows from singer table: Singer_ID Name Country Song_Name Song_release_year Age Is_male 1 Joe Sharp Netherlands You 1992 52 True 2 Timbaland United States Dangerous 2008 32 True */ CREATE TABLE singer_in_concert ( "concert_ID" INTEGER, "Singer_ID" TEXT, PRIMARY KEY ("concert_ID", "Singer_ID"), FOREIGN KEY("concert_ID") REFERENCES concert ("concert_ID"), FOREIGN KEY("Singer_ID") REFERENCES singer ("Singer_ID") ) /* 2 rows from singer_in_concert table: concert_ID Singer_ID 1 2 1 3 */ CREATE TABLE stadium ( "Stadium_ID" INTEGER, "Location" TEXT, "Name" TEXT, "Capacity" INTEGER, "Highest" INTEGER, "Lowest" INTEGER, "Average" INTEGER, PRIMARY KEY ("Stadium_ID") ) /* 2 rows from stadium table: Stadium_ID Location Name Capacity Highest Lowest Average 1 Raith Rovers Stark's Park 10104 4812 1294 2106 2 Ayr United Somerset Park 11998 2363 1057 1477 */
How many concerts are there in year 2014 or 2015?
SELECT count(*) FROM concert WHERE YEAR = 2014 OR YEAR = 2015
[{'count(*)': 6}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?[/QUESTION] [SQL]SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015[/SQL]
[QUESTION]What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?[/QUESTION] [SQL]SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015[/SQL]
[QUESTION]What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?[/QUESTION] [SQL]SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015[/SQL]
[QUESTION]What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?[/QUESTION] [SQL]SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name , T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015[/SQL]
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
Return the names and ids of customers who have TN in their address.
SELECT customer_name , customer_id FROM customers WHERE customer_address LIKE "%TN%"
[{'customer_name': 'Lukas', 'customer_id': 3}, {'customer_name': 'Kenya', 'customer_id': 13}]
Easy
false
true
false
false
false
false
false
false
false
false
false
false
false
program_share
CREATE TABLE broadcast ( "Channel_ID" INTEGER, "Program_ID" INTEGER, "Time_of_day" TEXT, PRIMARY KEY ("Channel_ID", "Program_ID"), FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) CREATE TABLE broadcast_share ( "Channel_ID" INTEGER, "Program_ID" INTEGER, "Date" TEXT, "Share_in_percent" REAL, PRIMARY KEY ("Channel_ID", "Program_ID"), FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) CREATE TABLE channel ( "Channel_ID" INTEGER, "Name" TEXT, "Owner" TEXT, "Share_in_percent" REAL, "Rating_in_percent" REAL, PRIMARY KEY ("Channel_ID") ) CREATE TABLE program ( "Program_ID" INTEGER, "Name" TEXT, "Origin" TEXT, "Launch" REAL, "Owner" TEXT, PRIMARY KEY ("Program_ID") )
CREATE TABLE broadcast ( "Channel_ID" INTEGER, "Program_ID" INTEGER, "Time_of_day" TEXT, PRIMARY KEY ("Channel_ID", "Program_ID"), FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) /* 2 rows from broadcast table: Channel_ID Program_ID Time_of_day 1 1 Morning 2 1 Night */ CREATE TABLE broadcast_share ( "Channel_ID" INTEGER, "Program_ID" INTEGER, "Date" TEXT, "Share_in_percent" REAL, PRIMARY KEY ("Channel_ID", "Program_ID"), FOREIGN KEY("Program_ID") REFERENCES program ("Program_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) /* 2 rows from broadcast_share table: Channel_ID Program_ID Date Share_in_percent 1 1 01,May 3.1 2 1 02,May 1.8 */ CREATE TABLE channel ( "Channel_ID" INTEGER, "Name" TEXT, "Owner" TEXT, "Share_in_percent" REAL, "Rating_in_percent" REAL, PRIMARY KEY ("Channel_ID") ) /* 2 rows from channel table: Channel_ID Name Owner Share_in_percent Rating_in_percent 1 CCTV-1 CCTV 4.9 0.54 2 Hunan Satellite TV HBS 4.81 0.53 */ CREATE TABLE program ( "Program_ID" INTEGER, "Name" TEXT, "Origin" TEXT, "Launch" REAL, "Owner" TEXT, PRIMARY KEY ("Program_ID") ) /* 2 rows from program table: Program_ID Name Origin Launch Owner 1 Aniworld Hunan 2005.0 Hunan Broadcasting System (HBS) 2 Kaku Beijing 2004.0 Beijing Television (BTV) */
find the total percentage share of all channels owned by CCTV.
SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
[{'sum(Share_in_percent)': 22.090000000000003}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
musical
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") )
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) /* 2 rows from actor table: Actor_ID Name Musical_ID Character Duration age 1 Ray Meagher 1 Alf Stewart 1988— 26 2 Tom Oliver 1 Lou Carpenter 1988, 1992— 22 */ CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") ) /* 2 rows from musical table: Musical_ID Name Year Award Category Nominee Result 1 The Phantom of the Opera 1986 Tony Award Best Book of a Musical Bob Fosse Nominated 2 Les Misérables 1986 Tony Award Best Performance by a Leading Actor in a Musical Cleavant Derricks Nominated */
How many musicals has each nominee been nominated for?
SELECT Nominee , COUNT(*) FROM musical GROUP BY Nominee
[{'Nominee': 'Bob Fosse', 'COUNT(*)': 5}, {'Nominee': 'Cleavant Derricks', 'COUNT(*)': 2}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION] [SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL]
[QUESTION]What are years of founding for orchestras that have had more than a single performance?[/QUESTION] [SQL]SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1[/SQL]
cre_Theme_park
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") )
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) /* 2 rows from Features table: Feature_ID Feature_Details 523 cafe 528 park */ CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) /* 2 rows from Hotels table: hotel_id star_rating_code pets_allowed_yn price_range other_hotel_details 123 5 1 2914989.571 None 144 4 None */ CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) /* 2 rows from Locations table: Location_ID Location_Name Address Other_Details 333 Astro Orbiter 660 Shea Crescent None 368 African Animals 254 Ottilie Junction None */ CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Museums table: Museum_ID Museum_Details 2113 Yale Center for British Art 2701 The Metropolitan Museum of Art */ CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Photos table: Photo_ID Tourist_Attraction_ID Name Description Filename Other_Details 211 8449 game1 None 702 None 280 7067 game2 None 762 None */ CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) /* 2 rows from Ref_Attraction_Types table: Attraction_Type_Code Attraction_Type_Description 2 park 3 garden */ CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) /* 2 rows from Ref_Hotel_Star_Ratings table: star_rating_code star_rating_description 1 star 2 star */ CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Royal_Family table: Royal_Family_ID Royal_Family_Details 9561 None 9919 None */ CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Shops table: Shop_ID Shop_Details 8429 soup 8449 coffee */ CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Staff table: Staff_ID Tourist_Attraction_ID Name Other_Details 170 6476 Whitney None 219 6476 Kaela None */ CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Street_Markets table: Market_ID Market_Details 6852 Broadway 7067 Fish Farm Market */ CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Theme_Parks table: Theme_Park_ID Theme_Park_Details 5265 Disney 6476 Sea World */ CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) /* 2 rows from Tourist_Attraction_Features table: Tourist_Attraction_ID Feature_ID 5076 528 5076 681 */ CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) /* 2 rows from Tourist_Attractions table: Tourist_Attraction_ID Attraction_Type_Code Location_ID How_to_Get_There Name Description Opening_Hours Other_Details 2113 2 579 bus art museum None None None 2701 6 417 walk UK gallery None None None */ CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) /* 2 rows from Visitors table: Tourist_ID Tourist_Details 164 Toney 189 Graciela */ CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") ) /* 2 rows from Visits table: Visit_ID Tourist_Attraction_ID Tourist_ID Visit_Date Visit_Details 183 6653 377 2004-08-21 03:06:14 268 5076 204 2013-08-06 05:35:51 */
What are the details and star ratings of the three hotels with the lowest price ranges?
SELECT other_hotel_details , star_rating_code FROM HOTELS ORDER BY price_range ASC LIMIT 3
[{'other_hotel_details': None, 'star_rating_code': '2'}, {'other_hotel_details': None, 'star_rating_code': '5'}, {'other_hotel_details': None, 'star_rating_code': '1'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
twitter_1
CREATE TABLE follows ( f1 INTEGER NOT NULL, f2 INTEGER NOT NULL, PRIMARY KEY (f1, f2), FOREIGN KEY(f2) REFERENCES user_profiles (uid), FOREIGN KEY(f1) REFERENCES user_profiles (uid) ) CREATE TABLE tweets ( id BIGINT NOT NULL, uid INTEGER NOT NULL, text CHAR(140) NOT NULL, createdate DATETIME DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), FOREIGN KEY(uid) REFERENCES user_profiles (uid) ) CREATE TABLE user_profiles ( uid INTEGER NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, partitionid INTEGER DEFAULT NULL, followers INTEGER DEFAULT NULL, PRIMARY KEY (uid) )
CREATE TABLE follows ( f1 INTEGER NOT NULL, f2 INTEGER NOT NULL, PRIMARY KEY (f1, f2), FOREIGN KEY(f2) REFERENCES user_profiles (uid), FOREIGN KEY(f1) REFERENCES user_profiles (uid) ) /* 2 rows from follows table: f1 f2 1 2 2 3 */ CREATE TABLE tweets ( id BIGINT NOT NULL, uid INTEGER NOT NULL, text CHAR(140) NOT NULL, createdate DATETIME DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), FOREIGN KEY(uid) REFERENCES user_profiles (uid) ) /* 2 rows from tweets table: id uid text createdate 1 1 Hello I'm Tony Stark. 2018-03-09 20:00:14 2 3 Today I have went shopping at Laffayette. 2018-03-09 20:01:02 */ CREATE TABLE user_profiles ( uid INTEGER NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, partitionid INTEGER DEFAULT NULL, followers INTEGER DEFAULT NULL, PRIMARY KEY (uid) ) /* 2 rows from user_profiles table: uid name email partitionid followers 1 Iron Man [email protected] 1 6662425 2 Mary [email protected] 2 890 */
Find the name and email of the user whose name contains the word ‘Swift’.
SELECT name , email FROM user_profiles WHERE name LIKE '%Swift%'
[{'name': 'Tyler Swift', 'email': '[email protected]\n'}]
Easy
false
true
false
false
false
false
false
false
false
false
false
false
false
store_1
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) )
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) /* 2 rows from albums table: id title artist_id 1 For Those About To Rock We Salute You 1 2 Balls to the Wall 2 */ CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from artists table: id name 1 AC/DC 2 Accept */ CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) /* 2 rows from customers table: id first_name last_name company address city state country postal_code phone fax email support_rep_id 1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 [email protected] 3 2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None [email protected] 5 */ CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) /* 2 rows from employees table: id last_name first_name title reports_to birth_date hire_date address city state country postal_code phone fax email 1 Adams Andrew General Manager None 1962-02-18 00:00:00 2002-08-14 00:00:00 11120 Jasper Ave NW Edmonton AB Canada T5K 2N1 +1 (780) 428-9482 +1 (780) 428-3457 [email protected] 2 Edwards Nancy Sales Manager 1 1958-12-08 00:00:00 2002-05-01 00:00:00 825 8 Ave SW Calgary AB Canada T2P 2T3 +1 (403) 262-3443 +1 (403) 262-3322 [email protected] */ CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from genres table: id name 1 Rock 2 Jazz */ CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from invoice_lines table: id invoice_id track_id unit_price quantity 1 1 2 0.99 1 2 1 4 0.99 1 */ CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) /* 2 rows from invoices table: id customer_id invoice_date billing_address billing_city billing_state billing_country billing_postal_code total 1 2 2007-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98 2 4 2007-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96 */ CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from media_types table: id name 1 MPEG audio file 2 Protected AAC audio file */ CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from playlist_tracks table: playlist_id track_id 1 3402 1 3389 */ CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from playlists table: id name 1 Music 2 Movies */ CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) ) /* 2 rows from tracks table: id name album_id media_type_id genre_id composer milliseconds bytes unit_price 1 For Those About To Rock (We Salute You) 1 1 1 Angus Young, Malcolm Young, Brian Johnson 343719 11170334 0.99 2 Balls to the Wall 2 2 1 None 342562 5510424 0.99 */
What is the company where Eduardo Martins is a customer?
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
[{'company': 'Woodstock Discos'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
county_public_safety
CREATE TABLE city ( "City_ID" INTEGER, "County_ID" INTEGER, "Name" TEXT, "White" REAL, "Black" REAL, "Amerindian" REAL, "Asian" REAL, "Multiracial" REAL, "Hispanic" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("County_ID") REFERENCES county_public_safety ("County_ID") ) CREATE TABLE county_public_safety ( "County_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Police_officers" INTEGER, "Residents_per_officer" INTEGER, "Case_burden" INTEGER, "Crime_rate" REAL, "Police_force" TEXT, "Location" TEXT, PRIMARY KEY ("County_ID") )
CREATE TABLE city ( "City_ID" INTEGER, "County_ID" INTEGER, "Name" TEXT, "White" REAL, "Black" REAL, "Amerindian" REAL, "Asian" REAL, "Multiracial" REAL, "Hispanic" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("County_ID") REFERENCES county_public_safety ("County_ID") ) /* 2 rows from city table: City_ID County_ID Name White Black Amerindian Asian Multiracial Hispanic 1 1 Adjuntas 93.1 3.1 0.3 0.0 3.4 99.6 2 1 Aguada 86.6 5.3 0.3 0.1 7.7 99.4 */ CREATE TABLE county_public_safety ( "County_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Police_officers" INTEGER, "Residents_per_officer" INTEGER, "Case_burden" INTEGER, "Crime_rate" REAL, "Police_force" TEXT, "Location" TEXT, PRIMARY KEY ("County_ID") ) /* 2 rows from county_public_safety table: County_ID Name Population Police_officers Residents_per_officer Case_burden Crime_rate Police_force Location 1 Abbotsford 128165 187 685 81 118.0 Abbotsford Police Department East 2 Burnaby 204320 253 808 100 123.0 RCMP East */
What is the location shared by most counties?
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
[{'Location': 'East'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]What is the name of the district with the most residents?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the district with the most residents?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the district with the most residents?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the district with the most residents?[/QUESTION] [SQL]SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1[/SQL]
hr_1
CREATE TABLE countries ( "COUNTRY_ID" VARCHAR(2) NOT NULL, "COUNTRY_NAME" VARCHAR(40) DEFAULT NULL, "REGION_ID" DECIMAL(10, 0) DEFAULT NULL, PRIMARY KEY ("COUNTRY_ID"), FOREIGN KEY("REGION_ID") REFERENCES regions ("REGION_ID") ) CREATE TABLE departments ( "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT '0' NOT NULL, "DEPARTMENT_NAME" VARCHAR(30) NOT NULL, "MANAGER_ID" DECIMAL(6, 0) DEFAULT NULL, "LOCATION_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("DEPARTMENT_ID") ) CREATE TABLE employees ( "EMPLOYEE_ID" DECIMAL(6, 0) DEFAULT '0' NOT NULL, "FIRST_NAME" VARCHAR(20) DEFAULT NULL, "LAST_NAME" VARCHAR(25) NOT NULL, "EMAIL" VARCHAR(25) NOT NULL, "PHONE_NUMBER" VARCHAR(20) DEFAULT NULL, "HIRE_DATE" DATE NOT NULL, "JOB_ID" VARCHAR(10) NOT NULL, "SALARY" DECIMAL(8, 2) DEFAULT NULL, "COMMISSION_PCT" DECIMAL(2, 2) DEFAULT NULL, "MANAGER_ID" DECIMAL(6, 0) DEFAULT NULL, "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("EMPLOYEE_ID"), FOREIGN KEY("JOB_ID") REFERENCES jobs ("JOB_ID"), FOREIGN KEY("DEPARTMENT_ID") REFERENCES departments ("DEPARTMENT_ID") ) CREATE TABLE job_history ( "EMPLOYEE_ID" DECIMAL(6, 0) NOT NULL, "START_DATE" DATE NOT NULL, "END_DATE" DATE NOT NULL, "JOB_ID" VARCHAR(10) NOT NULL, "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("EMPLOYEE_ID", "START_DATE"), FOREIGN KEY("JOB_ID") REFERENCES jobs ("JOB_ID"), FOREIGN KEY("DEPARTMENT_ID") REFERENCES departments ("DEPARTMENT_ID"), FOREIGN KEY("EMPLOYEE_ID") REFERENCES employees ("EMPLOYEE_ID") ) CREATE TABLE jobs ( "JOB_ID" VARCHAR(10) DEFAULT '' NOT NULL, "JOB_TITLE" VARCHAR(35) NOT NULL, "MIN_SALARY" DECIMAL(6, 0) DEFAULT NULL, "MAX_SALARY" DECIMAL(6, 0) DEFAULT NULL, PRIMARY KEY ("JOB_ID") ) CREATE TABLE locations ( "LOCATION_ID" DECIMAL(4, 0) DEFAULT '0' NOT NULL, "STREET_ADDRESS" VARCHAR(40) DEFAULT NULL, "POSTAL_CODE" VARCHAR(12) DEFAULT NULL, "CITY" VARCHAR(30) NOT NULL, "STATE_PROVINCE" VARCHAR(25) DEFAULT NULL, "COUNTRY_ID" VARCHAR(2) DEFAULT NULL, PRIMARY KEY ("LOCATION_ID"), FOREIGN KEY("COUNTRY_ID") REFERENCES countries ("COUNTRY_ID") ) CREATE TABLE regions ( "REGION_ID" DECIMAL(5, 0) NOT NULL, "REGION_NAME" VARCHAR(25) DEFAULT NULL, PRIMARY KEY ("REGION_ID") )
CREATE TABLE countries ( "COUNTRY_ID" VARCHAR(2) NOT NULL, "COUNTRY_NAME" VARCHAR(40) DEFAULT NULL, "REGION_ID" DECIMAL(10, 0) DEFAULT NULL, PRIMARY KEY ("COUNTRY_ID"), FOREIGN KEY("REGION_ID") REFERENCES regions ("REGION_ID") ) /* 2 rows from countries table: COUNTRY_ID COUNTRY_NAME REGION_ID AR Argentina 2 AU Australia 3 */ CREATE TABLE departments ( "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT '0' NOT NULL, "DEPARTMENT_NAME" VARCHAR(30) NOT NULL, "MANAGER_ID" DECIMAL(6, 0) DEFAULT NULL, "LOCATION_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("DEPARTMENT_ID") ) /* 2 rows from departments table: DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID 10 Administration 200 1700 20 Marketing 201 1800 */ CREATE TABLE employees ( "EMPLOYEE_ID" DECIMAL(6, 0) DEFAULT '0' NOT NULL, "FIRST_NAME" VARCHAR(20) DEFAULT NULL, "LAST_NAME" VARCHAR(25) NOT NULL, "EMAIL" VARCHAR(25) NOT NULL, "PHONE_NUMBER" VARCHAR(20) DEFAULT NULL, "HIRE_DATE" DATE NOT NULL, "JOB_ID" VARCHAR(10) NOT NULL, "SALARY" DECIMAL(8, 2) DEFAULT NULL, "COMMISSION_PCT" DECIMAL(2, 2) DEFAULT NULL, "MANAGER_ID" DECIMAL(6, 0) DEFAULT NULL, "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("EMPLOYEE_ID"), FOREIGN KEY("JOB_ID") REFERENCES jobs ("JOB_ID"), FOREIGN KEY("DEPARTMENT_ID") REFERENCES departments ("DEPARTMENT_ID") ) /* 2 rows from employees table: EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID 100 Steven King SKING 515.123.4567 1987-06-17 AD_PRES 24000.00 0.00 0 90 101 Neena Kochhar NKOCHHAR 515.123.4568 1987-06-18 AD_VP 17000.00 0.00 100 90 */ CREATE TABLE job_history ( "EMPLOYEE_ID" DECIMAL(6, 0) NOT NULL, "START_DATE" DATE NOT NULL, "END_DATE" DATE NOT NULL, "JOB_ID" VARCHAR(10) NOT NULL, "DEPARTMENT_ID" DECIMAL(4, 0) DEFAULT NULL, PRIMARY KEY ("EMPLOYEE_ID", "START_DATE"), FOREIGN KEY("JOB_ID") REFERENCES jobs ("JOB_ID"), FOREIGN KEY("DEPARTMENT_ID") REFERENCES departments ("DEPARTMENT_ID"), FOREIGN KEY("EMPLOYEE_ID") REFERENCES employees ("EMPLOYEE_ID") ) /* 2 rows from job_history table: EMPLOYEE_ID START_DATE END_DATE JOB_ID DEPARTMENT_ID 102 1993-01-13 1998-07-24 IT_PROG 60 101 1989-09-21 1993-10-27 AC_ACCOUNT 110 */ CREATE TABLE jobs ( "JOB_ID" VARCHAR(10) DEFAULT '' NOT NULL, "JOB_TITLE" VARCHAR(35) NOT NULL, "MIN_SALARY" DECIMAL(6, 0) DEFAULT NULL, "MAX_SALARY" DECIMAL(6, 0) DEFAULT NULL, PRIMARY KEY ("JOB_ID") ) /* 2 rows from jobs table: JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY AD_PRES President 20000 40000 AD_VP Administration Vice President 15000 30000 */ CREATE TABLE locations ( "LOCATION_ID" DECIMAL(4, 0) DEFAULT '0' NOT NULL, "STREET_ADDRESS" VARCHAR(40) DEFAULT NULL, "POSTAL_CODE" VARCHAR(12) DEFAULT NULL, "CITY" VARCHAR(30) NOT NULL, "STATE_PROVINCE" VARCHAR(25) DEFAULT NULL, "COUNTRY_ID" VARCHAR(2) DEFAULT NULL, PRIMARY KEY ("LOCATION_ID"), FOREIGN KEY("COUNTRY_ID") REFERENCES countries ("COUNTRY_ID") ) /* 2 rows from locations table: LOCATION_ID STREET_ADDRESS POSTAL_CODE CITY STATE_PROVINCE COUNTRY_ID 1000 1297 Via Cola di Rie 989 Roma IT 1100 93091 Calle della Testa 10934 Venice IT */ CREATE TABLE regions ( "REGION_ID" DECIMAL(5, 0) NOT NULL, "REGION_NAME" VARCHAR(25) DEFAULT NULL, PRIMARY KEY ("REGION_ID") ) /* 2 rows from regions table: REGION_ID REGION_NAME 1 Europe\r 2 Americas\r */
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara.
SELECT first_name , last_name , hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara")
[{'FIRST_NAME': 'John', 'LAST_NAME': 'Russell', 'HIRE_DATE': '1987-08-01'}, {'FIRST_NAME': 'Karen', 'LAST_NAME': 'Partners', 'HIRE_DATE': '1987-08-02'}, {'FIRST_NAME': 'Alberto', 'LAST_NAME': 'Errazuriz', 'HIRE_DATE': '1987-08-03'}, {'FIRST_NAME': 'Gerald', 'LAST_NAME': 'Cambrault', 'HIRE_DATE': '1987-08-04'}, {'FIRST_NAME': 'Eleni', 'LAST_NAME': 'Zlotkey', 'HIRE_DATE': '1987-08-05'}, {'FIRST_NAME': 'Peter', 'LAST_NAME': 'Tucker', 'HIRE_DATE': '1987-08-06'}, {'FIRST_NAME': 'David', 'LAST_NAME': 'Bernstein', 'HIRE_DATE': '1987-08-07'}, {'FIRST_NAME': 'Peter', 'LAST_NAME': 'Hall', 'HIRE_DATE': '1987-08-08'}, {'FIRST_NAME': 'Christopher', 'LAST_NAME': 'Olsen', 'HIRE_DATE': '1987-08-09'}, {'FIRST_NAME': 'Nanette', 'LAST_NAME': 'Cambrault', 'HIRE_DATE': '1987-08-10'}, {'FIRST_NAME': 'Oliver', 'LAST_NAME': 'Tuvault', 'HIRE_DATE': '1987-08-11'}, {'FIRST_NAME': 'Janette', 'LAST_NAME': 'King', 'HIRE_DATE': '1987-08-12'}, {'FIRST_NAME': 'Patrick', 'LAST_NAME': 'Sully', 'HIRE_DATE': '1987-08-13'}, {'FIRST_NAME': 'Allan', 'LAST_NAME': 'McEwen', 'HIRE_DATE': '1987-08-14'}, {'FIRST_NAME': 'Lindsey', 'LAST_NAME': 'Smith', 'HIRE_DATE': '1987-08-15'}, {'FIRST_NAME': 'Louise', 'LAST_NAME': 'Doran', 'HIRE_DATE': '1987-08-16'}, {'FIRST_NAME': 'Sarath', 'LAST_NAME': 'Sewall', 'HIRE_DATE': '1987-08-17'}, {'FIRST_NAME': 'Clara', 'LAST_NAME': 'Vishney', 'HIRE_DATE': '1987-08-18'}, {'FIRST_NAME': 'Danielle', 'LAST_NAME': 'Greene', 'HIRE_DATE': '1987-08-19'}, {'FIRST_NAME': 'Mattea', 'LAST_NAME': 'Marvins', 'HIRE_DATE': '1987-08-20'}, {'FIRST_NAME': 'David', 'LAST_NAME': 'Lee', 'HIRE_DATE': '1987-08-21'}, {'FIRST_NAME': 'Sundar', 'LAST_NAME': 'Ande', 'HIRE_DATE': '1987-08-22'}, {'FIRST_NAME': 'Amit', 'LAST_NAME': 'Banda', 'HIRE_DATE': '1987-08-23'}, {'FIRST_NAME': 'Lisa', 'LAST_NAME': 'Ozer', 'HIRE_DATE': '1987-08-24'}, {'FIRST_NAME': 'Harrison', 'LAST_NAME': 'Bloom', 'HIRE_DATE': '1987-08-25'}, {'FIRST_NAME': 'Tayler', 'LAST_NAME': 'Fox', 'HIRE_DATE': '1987-08-26'}, {'FIRST_NAME': 'William', 'LAST_NAME': 'Smith', 'HIRE_DATE': '1987-08-27'}, {'FIRST_NAME': 'Elizabeth', 'LAST_NAME': 'Bates', 'HIRE_DATE': '1987-08-28'}, {'FIRST_NAME': 'Sundita', 'LAST_NAME': 'Kumar', 'HIRE_DATE': '1987-08-29'}, {'FIRST_NAME': 'Ellen', 'LAST_NAME': 'Abel', 'HIRE_DATE': '1987-08-30'}, {'FIRST_NAME': 'Alyssa', 'LAST_NAME': 'Hutton', 'HIRE_DATE': '1987-08-31'}, {'FIRST_NAME': 'Jonathon', 'LAST_NAME': 'Taylor', 'HIRE_DATE': '1987-09-01'}, {'FIRST_NAME': 'Jack', 'LAST_NAME': 'Livingston', 'HIRE_DATE': '1987-09-02'}, {'FIRST_NAME': 'Charles', 'LAST_NAME': 'Johnson', 'HIRE_DATE': '1987-09-04'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]List the first name of all employees with job code PROF ordered by their date of birth.[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]List the first name of all employees with job code PROF ordered by their date of birth.[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]List the first name of all employees with job code PROF ordered by their date of birth.[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]List the first name of all employees with job code PROF ordered by their date of birth.[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
customers_and_invoices
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Accounts table: account_id customer_id date_account_opened account_name other_account_details 1 8 2016-07-30 22:22:24 900 Regular 2 3 2017-05-29 16:45:17 520 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_middle_initial customer_last_name gender email_address login_name login_password phone_number town_city state_county_province country 1 Dee A Larkin 1 [email protected] xhartmann 77789d292604ea04406f 241.796.1219x37862 North Nellie WestVirginia USA 2 Brennon H Weimann 0 [email protected] shayne.lesch ce97a3e4539347daab96 (943)219-4234x415 South Isabell Oklahoma USA */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) /* 2 rows from Financial_Transactions table: transaction_id account_id invoice_number transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 13 12 Payment 2018-03-15 21:13:57 613.9600 None None 2 9 1 Payment 2018-03-13 13:27:46 368.4600 None None */ CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Invoice_Line_Items table: order_item_id invoice_number product_id product_title product_quantity product_price derived_product_cost derived_vat_payable derived_total_cost 14 9 5 prod_name 4 742.3700 191.1100 None 69.8200 3 9 15 prod_name 1 814.8700 176.2900 None 59.5600 */ CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Invoices table: invoice_number order_id invoice_date 1 9 2018-03-01 16:40:48 2 9 2018-03-20 00:21:41 */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id product_quantity other_order_item_details 1 4 4 6 None 2 4 10 7 None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id date_order_placed order_details 1 12 2012-06-27 20:49:56 None 2 12 2012-08-25 07:51:54 None */ CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) /* 2 rows from Product_Categories table: production_type_code product_type_description vat_rating Food Food 15.8400 DVDs Dvd products 11.4000 */ CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) ) /* 2 rows from Products table: product_id parent_product_id production_type_code unit_price product_name product_color product_size 1 4 Food 617.9500 Coffee Bean Red Medium 2 4 Books 558.4900 Learning French Yellow Medium */
How many products were not included in any order?
SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items )
[{'count(*)': 5}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]What are the minimum and maximum number of products across all the shops?[/QUESTION] [SQL]SELECT min(Number_products) , max(Number_products) FROM shop[/SQL]
[QUESTION]What are the minimum and maximum number of products across all the shops?[/QUESTION] [SQL]SELECT min(Number_products) , max(Number_products) FROM shop[/SQL]
gymnast
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") )
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) /* 2 rows from gymnast table: Gymnast_ID Floor_Exercise_Points Pommel_Horse_Points Rings_Points Vault_Points Parallel_Bars_Points Horizontal_Bar_Points Total_Points 1 9.725 9.737 9.512 9.575 9.762 9.75 58.061 2 9.7 9.625 9.625 9.65 9.587 9.737 57.924 */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Age Height Hometown 1 Paul Hamm 24.0 1.71 Santo Domingo 2 Lorraine Súarez Carmona 21.0 1.75 Bonao */
Show the ages of gymnasts in descending order of total points.
SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC
[{'Age': 24.0}, {'Age': 21.0}, {'Age': 20.0}, {'Age': 22.0}, {'Age': 21.0}, {'Age': 20.0}, {'Age': 24.0}]
Medium
false
false
false
true
false
false
false
true
false
false
false
false
false
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
Give the different locations of tracks.
SELECT DISTINCT LOCATION FROM track
[{'Location': 'Fontana, CA'}, {'Location': 'Joliet, IL'}, {'Location': 'Darlington, SC'}, {'Location': 'Daytona Beach, FL'}, {'Location': 'Homestead, FL'}, {'Location': 'Kansas City, KS'}, {'Location': 'Ridgeway, VA'}, {'Location': 'Brooklyn, MI'}, {'Location': 'Avondale, AZ'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
network_2
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) )
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) /* 2 rows from Person table: name age city gender job Alice 25 new york city female student Bob 35 salt lake city male engineer */ CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) ) /* 2 rows from PersonFriend table: name friend year Alice Bob 10 Zach Dan 12 */
What are the names of all of Bob's friends?
SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'
[{'name': 'Alice'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the names of high schoolers who have 3 or more friends?[/QUESTION] [SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3[/SQL]
[QUESTION]What are the names of high schoolers who have 3 or more friends?[/QUESTION] [SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3[/SQL]
[QUESTION]What are the names of high schoolers who have 3 or more friends?[/QUESTION] [SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3[/SQL]
[QUESTION]What are the names of high schoolers who have 3 or more friends?[/QUESTION] [SQL]SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
journal articles by mohammad rastegari
SELECT DISTINCT t3.paperid FROM writes AS t2 JOIN author AS t1 ON t2.authorid = t1.authorid JOIN paper AS t3 ON t2.paperid = t3.paperid WHERE t1.authorname = "mohammad rastegari" AND t3.journalid >= 0;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]return me the journals, which have more than 10 papers by " H. V. Jagadish " .[/QUESTION] [SQL]SELECT t2.name FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t1.name = "H. V. Jagadish" GROUP BY t2.name HAVING COUNT ( DISTINCT t4.title ) > 10;[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
how many states are in the usa
SELECT COUNT ( state_name ) FROM state;
[{'COUNT ( state_name )': 0}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many states are there?[/QUESTION] [SQL]SELECT count(*) FROM area_code_state[/SQL]
[QUESTION]How many states are there?[/QUESTION] [SQL]SELECT count(*) FROM area_code_state[/SQL]
[QUESTION]How many states are there?[/QUESTION] [SQL]SELECT count(*) FROM area_code_state[/SQL]
[QUESTION]How many states are there?[/QUESTION] [SQL]SELECT count(*) FROM area_code_state[/SQL]
music_4
CREATE TABLE artist ( "Artist_ID" INTEGER, "Artist" TEXT, "Age" INTEGER, "Famous_Title" TEXT, "Famous_Release_date" TEXT, PRIMARY KEY ("Artist_ID") ) CREATE TABLE music_festival ( "ID" INTEGER, "Music_Festival" TEXT, "Date_of_ceremony" TEXT, "Category" TEXT, "Volume" INTEGER, "Result" TEXT, PRIMARY KEY ("ID"), FOREIGN KEY("Volume") REFERENCES volume ("Volume_ID") ) CREATE TABLE volume ( "Volume_ID" INTEGER, "Volume_Issue" TEXT, "Issue_Date" TEXT, "Weeks_on_Top" REAL, "Song" TEXT, "Artist_ID" INTEGER, PRIMARY KEY ("Volume_ID"), FOREIGN KEY("Artist_ID") REFERENCES artist ("Artist_ID") )
CREATE TABLE artist ( "Artist_ID" INTEGER, "Artist" TEXT, "Age" INTEGER, "Famous_Title" TEXT, "Famous_Release_date" TEXT, PRIMARY KEY ("Artist_ID") ) /* 2 rows from artist table: Artist_ID Artist Age Famous_Title Famous_Release_date 1 Gorgoroth 34 Bergen 1996 November 2007 2 Ophiolatry 35 Transmutation January 21, 2008 */ CREATE TABLE music_festival ( "ID" INTEGER, "Music_Festival" TEXT, "Date_of_ceremony" TEXT, "Category" TEXT, "Volume" INTEGER, "Result" TEXT, PRIMARY KEY ("ID"), FOREIGN KEY("Volume") REFERENCES volume ("Volume_ID") ) /* 2 rows from music_festival table: ID Music_Festival Date_of_ceremony Category Volume Result 1 34th England Academy Prize 18 February 2011 Best Song 1 Nominated 2 34th Japan Academy Prize 18 February 2011 Best Lyrics 2 Nominated */ CREATE TABLE volume ( "Volume_ID" INTEGER, "Volume_Issue" TEXT, "Issue_Date" TEXT, "Weeks_on_Top" REAL, "Song" TEXT, "Artist_ID" INTEGER, PRIMARY KEY ("Volume_ID"), FOREIGN KEY("Artist_ID") REFERENCES artist ("Artist_ID") ) /* 2 rows from volume table: Volume_ID Volume_Issue Issue_Date Weeks_on_Top Song Artist_ID 1 45:14 § 27 December 1986 - 10 January 3.0 The Way 1 2 45:15 17 January 1.0 Everybody Have Fun Tonight 2 */
What are the famous titles of artists who have not only had volumes that spent more than 2 weeks on top but also volumes that spent less than 2 weeks on top?
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
[{'Famous_Title': 'Bergen 1996'}]
Hard
false
false
false
false
false
false
false
false
true
false
true
false
false
[QUESTION]What are the names of the three artists who have produced the most songs, and how many works did they produce?[/QUESTION] [SQL]SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3[/SQL]
[QUESTION]What are the names of the three artists who have produced the most songs, and how many works did they produce?[/QUESTION] [SQL]SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3[/SQL]
[QUESTION]What are the names of the three artists who have produced the most songs, and how many works did they produce?[/QUESTION] [SQL]SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3[/SQL]
[QUESTION]What are the names of the three artists who have produced the most songs, and how many works did they produce?[/QUESTION] [SQL]SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3[/SQL]
election
CREATE TABLE county ( "County_Id" INTEGER, "County_name" TEXT, "Population" REAL, "Zip_code" TEXT, PRIMARY KEY ("County_Id") ) CREATE TABLE election ( "Election_ID" INTEGER, "Counties_Represented" TEXT, "District" INTEGER, "Delegate" TEXT, "Party" INTEGER, "First_Elected" REAL, "Committee" TEXT, PRIMARY KEY ("Election_ID"), FOREIGN KEY("District") REFERENCES county ("County_Id"), FOREIGN KEY("Party") REFERENCES party ("Party_ID") ) CREATE TABLE party ( "Party_ID" INTEGER, "Year" REAL, "Party" TEXT, "Governor" TEXT, "Lieutenant_Governor" TEXT, "Comptroller" TEXT, "Attorney_General" TEXT, "US_Senate" TEXT, PRIMARY KEY ("Party_ID") )
CREATE TABLE county ( "County_Id" INTEGER, "County_name" TEXT, "Population" REAL, "Zip_code" TEXT, PRIMARY KEY ("County_Id") ) /* 2 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 */ CREATE TABLE election ( "Election_ID" INTEGER, "Counties_Represented" TEXT, "District" INTEGER, "Delegate" TEXT, "Party" INTEGER, "First_Elected" REAL, "Committee" TEXT, PRIMARY KEY ("Election_ID"), FOREIGN KEY("District") REFERENCES county ("County_Id"), FOREIGN KEY("Party") REFERENCES party ("Party_ID") ) /* 2 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters */ CREATE TABLE party ( "Party_ID" INTEGER, "Year" REAL, "Party" TEXT, "Governor" TEXT, "Lieutenant_Governor" TEXT, "Comptroller" TEXT, "Attorney_General" TEXT, "US_Senate" TEXT, PRIMARY KEY ("Party_ID") ) /* 2 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer */
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2
[{'Comptroller': 'Carl McCall'}, {'Comptroller': 'Carl McCall'}, {'Comptroller': 'Carl McCall'}, {'Comptroller': 'Alan Hevesi'}, {'Comptroller': 'John Faso'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
musical
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") )
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) /* 2 rows from actor table: Actor_ID Name Musical_ID Character Duration age 1 Ray Meagher 1 Alf Stewart 1988— 26 2 Tom Oliver 1 Lou Carpenter 1988, 1992— 22 */ CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") ) /* 2 rows from musical table: Musical_ID Name Year Award Category Nominee Result 1 The Phantom of the Opera 1986 Tony Award Best Book of a Musical Bob Fosse Nominated 2 Les Misérables 1986 Tony Award Best Performance by a Leading Actor in a Musical Cleavant Derricks Nominated */
Count the number of actors.
SELECT count(*) FROM actor
[{'count(*)': 9}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the number of actors in the movie " Saving Private Ryan " ?[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM CAST AS t2 JOIN actor AS t1 ON t2.aid = t1.aid JOIN movie AS t3 ON t3.mid = t2.msid WHERE t3.title = "Saving Private Ryan";[/SQL]
[QUESTION]What is the number of actors in the movie " Saving Private Ryan " ?[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM CAST AS t2 JOIN actor AS t1 ON t2.aid = t1.aid JOIN movie AS t3 ON t3.mid = t2.msid WHERE t3.title = "Saving Private Ryan";[/SQL]
[QUESTION]What is the number of actors in the movie " Saving Private Ryan " ?[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM CAST AS t2 JOIN actor AS t1 ON t2.aid = t1.aid JOIN movie AS t3 ON t3.mid = t2.msid WHERE t3.title = "Saving Private Ryan";[/SQL]
[QUESTION]What is the number of actors in the movie " Saving Private Ryan " ?[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t1.name ) FROM CAST AS t2 JOIN actor AS t1 ON t2.aid = t1.aid JOIN movie AS t3 ON t3.mid = t2.msid WHERE t3.title = "Saving Private Ryan";[/SQL]
customers_and_invoices
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Accounts table: account_id customer_id date_account_opened account_name other_account_details 1 8 2016-07-30 22:22:24 900 Regular 2 3 2017-05-29 16:45:17 520 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_middle_initial customer_last_name gender email_address login_name login_password phone_number town_city state_county_province country 1 Dee A Larkin 1 [email protected] xhartmann 77789d292604ea04406f 241.796.1219x37862 North Nellie WestVirginia USA 2 Brennon H Weimann 0 [email protected] shayne.lesch ce97a3e4539347daab96 (943)219-4234x415 South Isabell Oklahoma USA */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) /* 2 rows from Financial_Transactions table: transaction_id account_id invoice_number transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 13 12 Payment 2018-03-15 21:13:57 613.9600 None None 2 9 1 Payment 2018-03-13 13:27:46 368.4600 None None */ CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Invoice_Line_Items table: order_item_id invoice_number product_id product_title product_quantity product_price derived_product_cost derived_vat_payable derived_total_cost 14 9 5 prod_name 4 742.3700 191.1100 None 69.8200 3 9 15 prod_name 1 814.8700 176.2900 None 59.5600 */ CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Invoices table: invoice_number order_id invoice_date 1 9 2018-03-01 16:40:48 2 9 2018-03-20 00:21:41 */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id product_quantity other_order_item_details 1 4 4 6 None 2 4 10 7 None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id date_order_placed order_details 1 12 2012-06-27 20:49:56 None 2 12 2012-08-25 07:51:54 None */ CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) /* 2 rows from Product_Categories table: production_type_code product_type_description vat_rating Food Food 15.8400 DVDs Dvd products 11.4000 */ CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) ) /* 2 rows from Products table: product_id parent_product_id production_type_code unit_price product_name product_color product_size 1 4 Food 617.9500 Coffee Bean Red Medium 2 4 Books 558.4900 Learning French Yellow Medium */
Count the number of transactions.
SELECT count(*) FROM Financial_transactions
[{'count(*)': 15}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Count the number of documents.[/QUESTION] [SQL]SELECT count(*) FROM Documents[/SQL]
[QUESTION]Count the number of documents.[/QUESTION] [SQL]SELECT count(*) FROM Documents[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
What is the year of publication of " A Switching Architecture For ISDN " ?
SELECT DISTINCT title , YEAR FROM paper WHERE title = "A Switching Architecture For ISDN";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
small_bank_1
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) )
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) /* 2 rows from ACCOUNTS table: custid name 1 Brown 2 Wang */ CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 */ CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 */
Find the name, checking balance and saving balance of all accounts in the bank.
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid
[{'balance': 200000.0, 'name': 'Brown'}, {'balance': 999999999.0, 'name': 'Wang'}, {'balance': 230000.0, 'name': "O'mahony"}, {'balance': 60.0, 'name': 'Weeks'}, {'balance': 80000.0, 'name': 'Granger'}, {'balance': 240.0, 'name': 'Porter'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]Find the name of customers who have both saving and checking account types.[/QUESTION] [SQL]SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'[/SQL]
[QUESTION]Find the name of customers who have both saving and checking account types.[/QUESTION] [SQL]SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'[/SQL]
[QUESTION]Find the name of customers who have both saving and checking account types.[/QUESTION] [SQL]SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'[/SQL]
[QUESTION]Find the name of customers who have both saving and checking account types.[/QUESTION] [SQL]SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'[/SQL]
academic
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) )
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) /* 2 rows from author table: aid homepage name oid */ CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) /* 2 rows from cite table: cited citing */ CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) /* 2 rows from conference table: cid homepage name */ CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) /* 2 rows from domain table: did name */ CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from domain_author table: aid did */ CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from domain_conference table: cid did */ CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_journal table: did jid */ CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_keyword table: did kid */ CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_publication table: did pid */ CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) /* 2 rows from journal table: homepage jid name */ CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) /* 2 rows from keyword table: keyword kid */ CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) /* 2 rows from organization table: continent homepage name oid */ CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from publication table: abstract cid citation_num jid pid reference_num title year */ CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) /* 2 rows from publication_keyword table: pid kid */ CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from writes table: aid pid */
return me the paper in VLDB conference with more than 200 citations .
SELECT t2.title FROM publication AS t2 JOIN conference AS t1 ON t2.cid = t1.cid WHERE t1.name = "VLDB" AND t2.citation_num > 200;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]return me the author who has the most number of papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the author who has the most number of papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the author who has the most number of papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the author who has the most number of papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
customers_card_transactions
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) /* 2 rows from Accounts table: account_id customer_id account_name other_account_details 1 6 338 Regular 2 14 562 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_last_name customer_address customer_phone customer_email other_customer_details 1 Aniyah Feest 55975 Theodore Estates Lake Brody, VT 57078 (673)872-5338 [email protected] None 2 Susie Wiza 6478 Moen Isle Suite 910 Schimmelmouth, VT 96364-4898 679-845-8645x94312 [email protected] None */ CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) /* 2 rows from Customers_Cards table: card_id customer_id card_type_code card_number date_valid_from date_valid_to other_card_details 1 14 Credit 4560596484842 2011-04-17 09:05:28 2018-03-07 17:06:19 5567915676420343 2 9 Credit 4859448397570735 2012-05-22 02:05:41 2018-02-25 15:43:32 4539333582760 */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) ) /* 2 rows from Financial_Transactions table: transaction_id previous_transaction_id account_id card_id transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 925 15 1 Payment 2018-03-24 06:41:41 1701.23 None None 2 494 3 2 Refund 2018-03-24 12:08:55 1931.76 None None */
What are the different card types, and how many cards are there of each?
SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code
[{'card_type_code': 'Credit', 'count(*)': 7}, {'card_type_code': 'Debit', 'count(*)': 8}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]What are the different models for the cards produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
[QUESTION]What are the different models for the cards produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
[QUESTION]What are the different models for the cards produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
[QUESTION]What are the different models for the cards produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
company_1
CREATE TABLE department ( "Dname" TEXT, "Dnumber" INTEGER, "Mgr_ssn" INTEGER, "Mgr_start_date" TEXT, PRIMARY KEY ("Dnumber") ) CREATE TABLE dependent ( "Essn" INTEGER, "Dependent_name" TEXT, "Sex" TEXT, "Bdate" TEXT, "Relationship" TEXT, PRIMARY KEY ("Essn", "Dependent_name") ) CREATE TABLE dept_locations ( "Dnumber" INTEGER, "Dlocation" TEXT, PRIMARY KEY ("Dnumber", "Dlocation") ) CREATE TABLE employee ( "Fname" TEXT, "Minit" TEXT, "Lname" TEXT, "Ssn" INTEGER, "Bdate" TEXT, "Address" TEXT, "Sex" TEXT, "Salary" INTEGER, "Super_ssn" INTEGER, "Dno" INTEGER, PRIMARY KEY ("Ssn") ) CREATE TABLE project ( "Pname" TEXT, "Pnumber" INTEGER, "Plocation" TEXT, "Dnum" INTEGER, PRIMARY KEY ("Pnumber") ) CREATE TABLE works_on ( "Essn" INTEGER, "Pno" INTEGER, "Hours" REAL, PRIMARY KEY ("Essn", "Pno") )
CREATE TABLE department ( "Dname" TEXT, "Dnumber" INTEGER, "Mgr_ssn" INTEGER, "Mgr_start_date" TEXT, PRIMARY KEY ("Dnumber") ) /* 2 rows from department table: Dname Dnumber Mgr_ssn Mgr_start_date Headquarters 1 888665555 1981-06-19 Administration 4 987654321 1995-01-01 */ CREATE TABLE dependent ( "Essn" INTEGER, "Dependent_name" TEXT, "Sex" TEXT, "Bdate" TEXT, "Relationship" TEXT, PRIMARY KEY ("Essn", "Dependent_name") ) /* 2 rows from dependent table: Essn Dependent_name Sex Bdate Relationship 333445555 Alice F 1986-04-05 Daughter 333445555 Theodore M 1983-10-25 Son */ CREATE TABLE dept_locations ( "Dnumber" INTEGER, "Dlocation" TEXT, PRIMARY KEY ("Dnumber", "Dlocation") ) /* 2 rows from dept_locations table: Dnumber Dlocation 1 Houston 4 Stafford */ CREATE TABLE employee ( "Fname" TEXT, "Minit" TEXT, "Lname" TEXT, "Ssn" INTEGER, "Bdate" TEXT, "Address" TEXT, "Sex" TEXT, "Salary" INTEGER, "Super_ssn" INTEGER, "Dno" INTEGER, PRIMARY KEY ("Ssn") ) /* 2 rows from employee table: Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno Jonh B Smith 123456789 1965-01-09 731 Fondren, Houston, TX M 30000 333445555 5 Franklin T Wong 333445555 1955-12-08 638 Voss, Houston, TX M 40000 888665555 5 */ CREATE TABLE project ( "Pname" TEXT, "Pnumber" INTEGER, "Plocation" TEXT, "Dnum" INTEGER, PRIMARY KEY ("Pnumber") ) /* 2 rows from project table: Pname Pnumber Plocation Dnum ProductX 1 Bellaire 5 ProductY 2 Sugarland 5 */ CREATE TABLE works_on ( "Essn" INTEGER, "Pno" INTEGER, "Hours" REAL, PRIMARY KEY ("Essn", "Pno") ) /* 2 rows from works_on table: Essn Pno Hours 123456789 1 32.5 123456789 2 7.5 */
Find the names of departments that are located in Houston.
SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'
[{'Dname': 'Headquarters'}, {'Dname': 'Research'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]list names of all departments ordered by their names.[/QUESTION] [SQL]SELECT dept_name FROM department ORDER BY dept_name[/SQL]
[QUESTION]list names of all departments ordered by their names.[/QUESTION] [SQL]SELECT dept_name FROM department ORDER BY dept_name[/SQL]
[QUESTION]list names of all departments ordered by their names.[/QUESTION] [SQL]SELECT dept_name FROM department ORDER BY dept_name[/SQL]
[QUESTION]list names of all departments ordered by their names.[/QUESTION] [SQL]SELECT dept_name FROM department ORDER BY dept_name[/SQL]
customers_card_transactions
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) /* 2 rows from Accounts table: account_id customer_id account_name other_account_details 1 6 338 Regular 2 14 562 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_last_name customer_address customer_phone customer_email other_customer_details 1 Aniyah Feest 55975 Theodore Estates Lake Brody, VT 57078 (673)872-5338 [email protected] None 2 Susie Wiza 6478 Moen Isle Suite 910 Schimmelmouth, VT 96364-4898 679-845-8645x94312 [email protected] None */ CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) /* 2 rows from Customers_Cards table: card_id customer_id card_type_code card_number date_valid_from date_valid_to other_card_details 1 14 Credit 4560596484842 2011-04-17 09:05:28 2018-03-07 17:06:19 5567915676420343 2 9 Credit 4859448397570735 2012-05-22 02:05:41 2018-02-25 15:43:32 4539333582760 */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) ) /* 2 rows from Financial_Transactions table: transaction_id previous_transaction_id account_id card_id transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 925 15 1 Payment 2018-03-24 06:41:41 1701.23 None None 2 494 3 2 Refund 2018-03-24 12:08:55 1931.76 None None */
What are the other account details for the account with the name 338?
SELECT other_account_details FROM Accounts WHERE account_name = "338"
[{'other_account_details': 'Regular'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and account balances of customers with the letter a in their names?[/QUESTION] [SQL]SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%'[/SQL]
[QUESTION]What are the names and account balances of customers with the letter a in their names?[/QUESTION] [SQL]SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%'[/SQL]
inn_1
CREATE TABLE "Reservations" ( "Code" INTEGER, "Room" TEXT, "CheckIn" TEXT, "CheckOut" TEXT, "Rate" REAL, "LastName" TEXT, "FirstName" TEXT, "Adults" INTEGER, "Kids" INTEGER, PRIMARY KEY ("Code"), FOREIGN KEY("Room") REFERENCES "Rooms" ("RoomId") ) CREATE TABLE "Rooms" ( "RoomId" TEXT, "roomName" TEXT, beds INTEGER, "bedType" TEXT, "maxOccupancy" INTEGER, "basePrice" INTEGER, decor TEXT, PRIMARY KEY ("RoomId") )
CREATE TABLE "Reservations" ( "Code" INTEGER, "Room" TEXT, "CheckIn" TEXT, "CheckOut" TEXT, "Rate" REAL, "LastName" TEXT, "FirstName" TEXT, "Adults" INTEGER, "Kids" INTEGER, PRIMARY KEY ("Code"), FOREIGN KEY("Room") REFERENCES "Rooms" ("RoomId") ) /* 2 rows from Reservations table: Code Room CheckIn CheckOut Rate LastName FirstName Adults Kids 10105 HBB 23-OCT-10 25-OCT-10 100.0 SELBIG CONRAD 1 0 10183 IBD 19-SEP-10 20-SEP-10 150.0 GABLER DOLLIE 2 0 */ CREATE TABLE "Rooms" ( "RoomId" TEXT, "roomName" TEXT, beds INTEGER, "bedType" TEXT, "maxOccupancy" INTEGER, "basePrice" INTEGER, decor TEXT, PRIMARY KEY ("RoomId") ) /* 2 rows from Rooms table: RoomId roomName beds bedType maxOccupancy basePrice decor RND Recluse and defiance 1 King 2 150 modern IBS Interim but salutary 1 King 2 150 traditional */
List the type of bed and name of all traditional rooms.
SELECT roomName , bedType FROM Rooms WHERE decor = "traditional";
[{'roomName': 'Interim but salutary', 'bedType': 'King'}, {'roomName': 'Abscond or bolster', 'bedType': 'Queen'}, {'roomName': 'Convoke and sanguine', 'bedType': 'King'}, {'roomName': 'Frugal not apropos', 'bedType': 'King'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
college_2
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) )
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) /* 2 rows from advisor table: s_ID i_ID 24746 19368 79352 95030 */ CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) /* 2 rows from classroom table: building room_number capacity Lamberton 134 10 Chandler 375 10 */ CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) /* 2 rows from course table: course_id title dept_name credits 787 C Programming Mech. Eng. 4 238 The Music of Donovan Mech. Eng. 3 */ CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) /* 2 rows from department table: dept_name building budget Civil Eng. Chandler 255041.46 Biology Candlestick 647610.55 */ CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) /* 2 rows from instructor table: ID name dept_name salary 63395 McKinnon Cybernetics 94333.99 78699 Pingr Statistics 59303.62 */ CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) /* 2 rows from prereq table: course_id prereq_id 376 130 760 169 */ CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) /* 2 rows from section table: course_id sec_id semester year building room_number time_slot_id 313 1 Fall 2010 Chandler 804 N 747 1 Spring 2004 Gates 314 K */ CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) /* 2 rows from student table: ID name dept_name tot_cred 24746 Schrefl History 4 79352 Rumat Finance 100 */ CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) /* 2 rows from takes table: ID course_id sec_id semester year grade 65901 401 1 Fall 2003 C- 24932 802 1 Spring 2003 B- */ CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) /* 2 rows from teaches table: ID course_id sec_id semester year 34175 747 1 Spring 2004 3199 169 1 Spring 2007 */ CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) ) /* 2 rows from time_slot table: time_slot_id day start_hr start_min end_hr end_min A M 8.0000000000 0E-10 8.0000000000 50.0000000000 A W 8.0000000000 0E-10 8.0000000000 50.0000000000 */
Which department has the lowest budget?
SELECT dept_name FROM department ORDER BY budget LIMIT 1
[{'dept_name': 'Comp. Sci.'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]Which department offers the most credits all together?[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
[QUESTION]Which department offers the most credits all together?[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
[QUESTION]Which department offers the most credits all together?[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
ship_1
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") )
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) /* 2 rows from Ship table: Ship_ID Name Type Built_Year Class Flag 1 HMS Manxman Panamax 1997.0 KR Panama 2 HMS Gorgon Panamax 1998.0 KR Panama */ CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") ) /* 2 rows from captain table: Captain_ID Name Ship_ID age Class Rank 1 Captain Sir Henry Langford 1 40 Third-rate ship of the line Midshipman 2 Captain Beves Conway 2 54 Third-rate ship of the line Midshipman */
Find the name and flag of ships that are not steered by any captain with Midshipman rank.
SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')
[{'Name': 'HMS Destiny', 'Flag': 'Panama'}, {'Name': 'HMS Trojan', 'Flag': 'Panama'}, {'Name': 'HM Sloop Sparrow', 'Flag': 'Panama'}, {'Name': 'HMS Phalarope', 'Flag': 'Panama'}, {'Name': 'HMS Undine', 'Flag': 'Malta'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what is the largest state in the us
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
music_2
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") )
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) /* 2 rows from Albums table: AId Title Year Label Type */ CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) /* 2 rows from Band table: Id Firstname Lastname */ CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) /* 2 rows from Instruments table: SongId BandmateId Instrument */ CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Performance table: SongId Bandmate StagePosition */ CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) /* 2 rows from Songs table: SongId Title */ CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) /* 2 rows from Tracklists table: AlbumId Position SongId */ CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Vocals table: SongId Bandmate Type */
Who performed the song named "Le Pop"?
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Le Pop"
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]What is the name and country of origin of the artist who released a song that has "love" in its title?[/QUESTION] [SQL]SELECT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE "%love%"[/SQL]
[QUESTION]What is the name and country of origin of the artist who released a song that has "love" in its title?[/QUESTION] [SQL]SELECT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE "%love%"[/SQL]
college_2
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) )
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) /* 2 rows from advisor table: s_ID i_ID 24746 19368 79352 95030 */ CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) /* 2 rows from classroom table: building room_number capacity Lamberton 134 10 Chandler 375 10 */ CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) /* 2 rows from course table: course_id title dept_name credits 787 C Programming Mech. Eng. 4 238 The Music of Donovan Mech. Eng. 3 */ CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) /* 2 rows from department table: dept_name building budget Civil Eng. Chandler 255041.46 Biology Candlestick 647610.55 */ CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) /* 2 rows from instructor table: ID name dept_name salary 63395 McKinnon Cybernetics 94333.99 78699 Pingr Statistics 59303.62 */ CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) /* 2 rows from prereq table: course_id prereq_id 376 130 760 169 */ CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) /* 2 rows from section table: course_id sec_id semester year building room_number time_slot_id 313 1 Fall 2010 Chandler 804 N 747 1 Spring 2004 Gates 314 K */ CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) /* 2 rows from student table: ID name dept_name tot_cred 24746 Schrefl History 4 79352 Rumat Finance 100 */ CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) /* 2 rows from takes table: ID course_id sec_id semester year grade 65901 401 1 Fall 2003 C- 24932 802 1 Spring 2003 B- */ CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) /* 2 rows from teaches table: ID course_id sec_id semester year 34175 747 1 Spring 2004 3199 169 1 Spring 2007 */ CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) ) /* 2 rows from time_slot table: time_slot_id day start_hr start_min end_hr end_min A M 8.0000000000 0E-10 8.0000000000 50.0000000000 A W 8.0000000000 0E-10 8.0000000000 50.0000000000 */
What are the ids of courses without prerequisites?
SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
[{'course_id': '101'}, {'course_id': '105'}, {'course_id': '123'}, {'course_id': '127'}, {'course_id': '130'}, {'course_id': '137'}, {'course_id': '139'}, {'course_id': '190'}, {'course_id': '192'}, {'course_id': '195'}, {'course_id': '200'}, {'course_id': '227'}, {'course_id': '235'}, {'course_id': '237'}, {'course_id': '238'}, {'course_id': '265'}, {'course_id': '267'}, {'course_id': '270'}, {'course_id': '274'}, {'course_id': '275'}, {'course_id': '278'}, {'course_id': '284'}, {'course_id': '304'}, {'course_id': '318'}, {'course_id': '319'}, {'course_id': '328'}, {'course_id': '334'}, {'course_id': '337'}, {'course_id': '340'}, {'course_id': '341'}, {'course_id': '344'}, {'course_id': '345'}, {'course_id': '348'}, {'course_id': '352'}, {'course_id': '366'}, {'course_id': '371'}, {'course_id': '377'}, {'course_id': '391'}, {'course_id': '393'}, {'course_id': '394'}, {'course_id': '396'}, {'course_id': '400'}, {'course_id': '401'}, {'course_id': '407'}, {'course_id': '408'}, {'course_id': '415'}, {'course_id': '416'}, {'course_id': '421'}, {'course_id': '426'}, {'course_id': '436'}, {'course_id': '442'}, {'course_id': '445'}, {'course_id': '451'}, {'course_id': '456'}, {'course_id': '461'}, {'course_id': '468'}, {'course_id': '476'}, {'course_id': '482'}, {'course_id': '487'}, {'course_id': '489'}, {'course_id': '493'}, {'course_id': '494'}, {'course_id': '500'}, {'course_id': '527'}, {'course_id': '539'}, {'course_id': '546'}, {'course_id': '549'}, {'course_id': '561'}, {'course_id': '571'}, {'course_id': '577'}, {'course_id': '580'}, {'course_id': '581'}, {'course_id': '584'}, {'course_id': '594'}, {'course_id': '598'}, {'course_id': '599'}, {'course_id': '604'}, {'course_id': '626'}, {'course_id': '630'}, {'course_id': '642'}, {'course_id': '659'}, {'course_id': '666'}, {'course_id': '679'}, {'course_id': '680'}, {'course_id': '681'}, {'course_id': '702'}, {'course_id': '716'}, {'course_id': '730'}, {'course_id': '731'}, {'course_id': '735'}, {'course_id': '748'}, {'course_id': '761'}, {'course_id': '762'}, {'course_id': '769'}, {'course_id': '770'}, {'course_id': '781'}, {'course_id': '787'}, {'course_id': '791'}, {'course_id': '808'}, {'course_id': '814'}, {'course_id': '818'}, {'course_id': '857'}, {'course_id': '858'}, {'course_id': '867'}, {'course_id': '887'}, {'course_id': '893'}, {'course_id': '897'}, {'course_id': '898'}, {'course_id': '919'}, {'course_id': '922'}, {'course_id': '927'}, {'course_id': '949'}, {'course_id': '959'}, {'course_id': '960'}, {'course_id': '962'}, {'course_id': '963'}, {'course_id': '966'}, {'course_id': '969'}, {'course_id': '974'}, {'course_id': '983'}, {'course_id': '984'}]
Hard
false
false
false
false
false
false
false
false
false
false
false
true
false
[QUESTION]What are the names and ids of every course with less than 2 sections?[/QUESTION] [SQL]SELECT T1.course_name , T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id HAVING count(*) <= 2[/SQL]
[QUESTION]What are the names and ids of every course with less than 2 sections?[/QUESTION] [SQL]SELECT T1.course_name , T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id HAVING count(*) <= 2[/SQL]
[QUESTION]What are the names and ids of every course with less than 2 sections?[/QUESTION] [SQL]SELECT T1.course_name , T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id HAVING count(*) <= 2[/SQL]
[QUESTION]What are the names and ids of every course with less than 2 sections?[/QUESTION] [SQL]SELECT T1.course_name , T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id HAVING count(*) <= 2[/SQL]
phone_1
CREATE TABLE chip_model ( "Model_name" TEXT, "Launch_year" REAL, "RAM_MiB" REAL, "ROM_MiB" REAL, "Slots" TEXT, "WiFi" TEXT, "Bluetooth" TEXT, PRIMARY KEY ("Model_name") ) CREATE TABLE phone ( "Company_name" TEXT, "Hardware_Model_name" TEXT, "Accreditation_type" TEXT, "Accreditation_level" TEXT, "Date" TEXT, chip_model TEXT, screen_mode TEXT, PRIMARY KEY ("Hardware_Model_name"), FOREIGN KEY(chip_model) REFERENCES chip_model ("Model_name"), FOREIGN KEY(screen_mode) REFERENCES screen_mode ("Graphics_mode") ) CREATE TABLE screen_mode ( "Graphics_mode" REAL, "Char_cells" TEXT, "Pixels" TEXT, "Hardware_colours" REAL, used_kb REAL, map TEXT, "Type" TEXT, PRIMARY KEY ("Graphics_mode") )
CREATE TABLE chip_model ( "Model_name" TEXT, "Launch_year" REAL, "RAM_MiB" REAL, "ROM_MiB" REAL, "Slots" TEXT, "WiFi" TEXT, "Bluetooth" TEXT, PRIMARY KEY ("Model_name") ) /* 2 rows from chip_model table: Model_name Launch_year RAM_MiB ROM_MiB Slots WiFi Bluetooth X5 2002.0 32.0 32.0 1CFII,1SD No No X5 high end 2002.0 64.0 48.0 1CFII,1SD No No */ CREATE TABLE phone ( "Company_name" TEXT, "Hardware_Model_name" TEXT, "Accreditation_type" TEXT, "Accreditation_level" TEXT, "Date" TEXT, chip_model TEXT, screen_mode TEXT, PRIMARY KEY ("Hardware_Model_name"), FOREIGN KEY(chip_model) REFERENCES chip_model ("Model_name"), FOREIGN KEY(screen_mode) REFERENCES screen_mode ("Graphics_mode") ) /* 2 rows from phone table: Company_name Hardware_Model_name Accreditation_type Accreditation_level Date chip_model screen_mode Sony Mobile Communications XPERIA T, XPERIA J Full joyn Hot Fixes Approved (awarded 15.11.12) X5 1 LG Electronics LG-P760 Full joyn Hot Fixes Approved (awarded 19.11.12) X51v 3 */ CREATE TABLE screen_mode ( "Graphics_mode" REAL, "Char_cells" TEXT, "Pixels" TEXT, "Hardware_colours" REAL, used_kb REAL, map TEXT, "Type" TEXT, PRIMARY KEY ("Graphics_mode") ) /* 2 rows from screen_mode table: Graphics_mode Char_cells Pixels Hardware_colours used_kb map Type 0.0 80 × 32 640 × 256 2.0 20.0 3000–7FFF Graphics 1.0 40 × 32 320 × 256 4.0 20.0 3000–7FFF Graphics */
the names of models that launched between 2002 and 2004.
SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004;
[{'Model_name': 'X5'}, {'Model_name': 'X5 high end'}, {'Model_name': 'X3 Basic'}, {'Model_name': 'X3 Advanced'}, {'Model_name': 'X3i'}, {'Model_name': 'X30 low-end'}, {'Model_name': 'X30 mid-range'}, {'Model_name': 'X30 high-end'}, {'Model_name': 'X50 Standard'}, {'Model_name': 'X50 Advanced'}, {'Model_name': 'X50v'}]
Easy
false
false
true
false
false
false
false
false
false
false
false
false
false
[QUESTION]Which distinct car models are the produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
[QUESTION]Which distinct car models are the produced after 1980?[/QUESTION] [SQL]SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980;[/SQL]
college_3
CREATE TABLE "Course" ( "CID" VARCHAR(7), "CName" VARCHAR(40), "Credits" INTEGER, "Instructor" INTEGER, "Days" VARCHAR(5), "Hours" VARCHAR(11), "DNO" INTEGER, PRIMARY KEY ("CID"), FOREIGN KEY("Instructor") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Department" ( "DNO" INTEGER, "Division" VARCHAR(2), "DName" VARCHAR(25), "Room" VARCHAR(5), "Building" VARCHAR(13), "DPhone" INTEGER, PRIMARY KEY ("DNO") ) CREATE TABLE "Enrolled_in" ( "StuID" INTEGER, "CID" VARCHAR(7), "Grade" VARCHAR(2), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("CID") REFERENCES "Course" ("CID"), FOREIGN KEY("Grade") REFERENCES "Gradeconversion" (lettergrade) ) CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) CREATE TABLE "Gradeconversion" ( lettergrade VARCHAR(2), gradepoint FLOAT, PRIMARY KEY (lettergrade) ) CREATE TABLE "Member_of" ( "FacID" INTEGER, "DNO" INTEGER, "Appt_Type" VARCHAR(15), FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Minor_in" ( "StuID" INTEGER, "DNO" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Course" ( "CID" VARCHAR(7), "CName" VARCHAR(40), "Credits" INTEGER, "Instructor" INTEGER, "Days" VARCHAR(5), "Hours" VARCHAR(11), "DNO" INTEGER, PRIMARY KEY ("CID"), FOREIGN KEY("Instructor") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Course table: CID CName Credits Instructor Days Hours DNO 600.101 COMPUTER LITERACY 3 6112 MTW 3 600 600.103 INTRODUCTION TO COMPUTER SCIENCE 1 4230 Th 4 600 */ CREATE TABLE "Department" ( "DNO" INTEGER, "Division" VARCHAR(2), "DName" VARCHAR(25), "Room" VARCHAR(5), "Building" VARCHAR(13), "DPhone" INTEGER, PRIMARY KEY ("DNO") ) /* 2 rows from Department table: DNO Division DName Room Building DPhone 10 AS History of Art 268 Mergenthaler 7117 20 AS Biology 144 Mudd 7330 */ CREATE TABLE "Enrolled_in" ( "StuID" INTEGER, "CID" VARCHAR(7), "Grade" VARCHAR(2), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("CID") REFERENCES "Course" ("CID"), FOREIGN KEY("Grade") REFERENCES "Gradeconversion" (lettergrade) ) /* 2 rows from Enrolled_in table: StuID CID Grade 1001 550.681 A- 1001 600.303 B */ CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) /* 2 rows from Faculty table: FacID Lname Fname Rank Sex Phone Room Building 1082 Giuliano Mark Instructor M 2424 224 NEB 1121 Goodrich Michael Professor M 3593 219 NEB */ CREATE TABLE "Gradeconversion" ( lettergrade VARCHAR(2), gradepoint FLOAT, PRIMARY KEY (lettergrade) ) /* 2 rows from Gradeconversion table: lettergrade gradepoint A+ 4.0 A 4.0 */ CREATE TABLE "Member_of" ( "FacID" INTEGER, "DNO" INTEGER, "Appt_Type" VARCHAR(15), FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Member_of table: FacID DNO Appt_Type 7792 600 Primary 9210 520 Primary */ CREATE TABLE "Minor_in" ( "StuID" INTEGER, "DNO" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Minor_in table: StuID DNO 1004 520 1005 550 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
What is the maximum and minimum grade point of students who live in NYC?
SELECT max(T2.gradepoint) , min(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = "NYC"
[{'max(T2.gradepoint)': 4.0, 'min(T2.gradepoint)': 2.0}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]What is the grade of each high schooler?[/QUESTION] [SQL]SELECT grade FROM Highschooler[/SQL]
[QUESTION]What is the grade of each high schooler?[/QUESTION] [SQL]SELECT grade FROM Highschooler[/SQL]
[QUESTION]What is the grade of each high schooler?[/QUESTION] [SQL]SELECT grade FROM Highschooler[/SQL]
[QUESTION]What is the grade of each high schooler?[/QUESTION] [SQL]SELECT grade FROM Highschooler[/SQL]
cre_Docs_and_Epenses
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") )
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) /* 2 rows from Accounts table: Account_ID Statement_ID Account_Details 7 57 495.063 61 57 930.14 */ CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) /* 2 rows from Documents table: Document_ID Document_Type_Code Project_ID Document_Date Document_Name Document_Description Other_Details 29 CV 30 2004-08-28 06:59:19 Review on UK files None None 42 BK 105 2012-12-27 19:09:18 Review on Canadian files None None */ CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Documents_with_Expenses table: Document_ID Budget_Type_Code Document_Details 57 GV government 192 GV government */ CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) /* 2 rows from Projects table: Project_ID Project_Details 30 Society Research project 35 Internet of Things project */ CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) /* 2 rows from Ref_Budget_Codes table: Budget_Type_Code Budget_Type_Description GV Government ORG Organisation */ CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) /* 2 rows from Ref_Document_Types table: Document_Type_Code Document_Type_Name Document_Type_Description BK Book excellent CV CV excellent */ CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Statements table: Statement_ID Statement_Details 57 Open Project 192 Private Project */
What are the ids of documents with the type code CV that do not have expenses.
SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses
[{'Document_ID': 29}]
Hard
false
false
false
false
false
false
false
false
false
false
false
true
false
[QUESTION]What are the ids for templates that are not used in any documents?[/QUESTION] [SQL]SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents[/SQL]
[QUESTION]What are the ids for templates that are not used in any documents?[/QUESTION] [SQL]SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents[/SQL]
[QUESTION]What are the ids for templates that are not used in any documents?[/QUESTION] [SQL]SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents[/SQL]
[QUESTION]What are the ids for templates that are not used in any documents?[/QUESTION] [SQL]SELECT template_id FROM Templates EXCEPT SELECT template_id FROM Documents[/SQL]
news_report
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") )
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) /* 2 rows from event table: Event_ID Date Venue Name Event_Attendance 1 13 October 2008 Marathon Olympia Games Openning 6650 2 11 October 2007 Victoria Government Hearing 369 */ CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) /* 2 rows from journalist table: journalist_ID Name Nationality Age Years_working 1 Herbert Swindells England 37 10 2 Fred Keenor Wales 27 5 */ CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") ) /* 2 rows from news_report table: journalist_ID Event_ID Work_Type 1 3 Screening 11 5 Screening */
What is the nationality of the journalist with the largest number of years working?
SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1
[{'Nationality': 'England'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
cre_Doc_Control_Systems
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Circulation_History" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, copy_number INTEGER NOT NULL, employee_id INTEGER NOT NULL, PRIMARY KEY (document_id, draft_number, copy_number, employee_id), FOREIGN KEY(document_id, draft_number, copy_number) REFERENCES "Draft_Copies" (document_id, draft_number, copy_number), FOREIGN KEY(employee_id) REFERENCES "Employees" (employee_id) ) CREATE TABLE "Document_Drafts" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, draft_details VARCHAR(255), PRIMARY KEY (document_id, draft_number), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id) ) CREATE TABLE "Documents" ( document_id INTEGER NOT NULL, document_status_code CHAR(15) NOT NULL, document_type_code CHAR(15) NOT NULL, shipping_agent_code CHAR(15), receipt_date DATETIME, receipt_number VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (document_id), FOREIGN KEY(document_type_code) REFERENCES "Ref_Document_Types" (document_type_code), FOREIGN KEY(document_status_code) REFERENCES "Ref_Document_Status" (document_status_code), FOREIGN KEY(shipping_agent_code) REFERENCES "Ref_Shipping_Agents" (shipping_agent_code) ) CREATE TABLE "Documents_Mailed" ( document_id INTEGER NOT NULL, mailed_to_address_id INTEGER NOT NULL, mailing_date DATETIME, PRIMARY KEY (document_id, mailed_to_address_id), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id), FOREIGN KEY(mailed_to_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Draft_Copies" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, copy_number INTEGER NOT NULL, PRIMARY KEY (document_id, draft_number, copy_number), FOREIGN KEY(document_id, draft_number) REFERENCES "Document_Drafts" (document_id, draft_number) ) CREATE TABLE "Employees" ( employee_id INTEGER NOT NULL, role_code CHAR(15) NOT NULL, employee_name VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (employee_id), FOREIGN KEY(role_code) REFERENCES "Roles" (role_code) ) CREATE TABLE "Ref_Document_Status" ( document_status_code CHAR(15) NOT NULL, document_status_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_status_code) ) CREATE TABLE "Ref_Document_Types" ( document_type_code CHAR(15) NOT NULL, document_type_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_type_code) ) CREATE TABLE "Ref_Shipping_Agents" ( shipping_agent_code CHAR(15) NOT NULL, shipping_agent_name VARCHAR(255) NOT NULL, shipping_agent_description VARCHAR(255) NOT NULL, PRIMARY KEY (shipping_agent_code) ) CREATE TABLE "Roles" ( role_code CHAR(15) NOT NULL, role_description VARCHAR(255), PRIMARY KEY (role_code) )
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 0 IT 1 MX */ CREATE TABLE "Circulation_History" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, copy_number INTEGER NOT NULL, employee_id INTEGER NOT NULL, PRIMARY KEY (document_id, draft_number, copy_number, employee_id), FOREIGN KEY(document_id, draft_number, copy_number) REFERENCES "Draft_Copies" (document_id, draft_number, copy_number), FOREIGN KEY(employee_id) REFERENCES "Employees" (employee_id) ) /* 2 rows from Circulation_History table: document_id draft_number copy_number employee_id 20 17 15 8 1 2 5 1 */ CREATE TABLE "Document_Drafts" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, draft_details VARCHAR(255), PRIMARY KEY (document_id, draft_number), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id) ) /* 2 rows from Document_Drafts table: document_id draft_number draft_details 1 0 e 1 2 k */ CREATE TABLE "Documents" ( document_id INTEGER NOT NULL, document_status_code CHAR(15) NOT NULL, document_type_code CHAR(15) NOT NULL, shipping_agent_code CHAR(15), receipt_date DATETIME, receipt_number VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (document_id), FOREIGN KEY(document_type_code) REFERENCES "Ref_Document_Types" (document_type_code), FOREIGN KEY(document_status_code) REFERENCES "Ref_Document_Status" (document_status_code), FOREIGN KEY(shipping_agent_code) REFERENCES "Ref_Shipping_Agents" (shipping_agent_code) ) /* 2 rows from Documents table: document_id document_status_code document_type_code shipping_agent_code receipt_date receipt_number other_details 1 working CD UP 2008-04-21 20:42:25 19 z 2 done Paper US 1974-05-08 00:00:46 34 h */ CREATE TABLE "Documents_Mailed" ( document_id INTEGER NOT NULL, mailed_to_address_id INTEGER NOT NULL, mailing_date DATETIME, PRIMARY KEY (document_id, mailed_to_address_id), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id), FOREIGN KEY(mailed_to_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Documents_Mailed table: document_id mailed_to_address_id mailing_date 2 8 1977-04-01 17:03:50 4 3 1992-11-07 15:03:41 */ CREATE TABLE "Draft_Copies" ( document_id INTEGER NOT NULL, draft_number INTEGER NOT NULL, copy_number INTEGER NOT NULL, PRIMARY KEY (document_id, draft_number, copy_number), FOREIGN KEY(document_id, draft_number) REFERENCES "Document_Drafts" (document_id, draft_number) ) /* 2 rows from Draft_Copies table: document_id draft_number copy_number 2 8 5 4 9 6 */ CREATE TABLE "Employees" ( employee_id INTEGER NOT NULL, role_code CHAR(15) NOT NULL, employee_name VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (employee_id), FOREIGN KEY(role_code) REFERENCES "Roles" (role_code) ) /* 2 rows from Employees table: employee_id role_code employee_name other_details 1 ED Koby h 2 ED Kenyon f */ CREATE TABLE "Ref_Document_Status" ( document_status_code CHAR(15) NOT NULL, document_status_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_status_code) ) /* 2 rows from Ref_Document_Status table: document_status_code document_status_description working currently working on done mailed */ CREATE TABLE "Ref_Document_Types" ( document_type_code CHAR(15) NOT NULL, document_type_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_type_code) ) /* 2 rows from Ref_Document_Types table: document_type_code document_type_description CD b Paper u */ CREATE TABLE "Ref_Shipping_Agents" ( shipping_agent_code CHAR(15) NOT NULL, shipping_agent_name VARCHAR(255) NOT NULL, shipping_agent_description VARCHAR(255) NOT NULL, PRIMARY KEY (shipping_agent_code) ) /* 2 rows from Ref_Shipping_Agents table: shipping_agent_code shipping_agent_name shipping_agent_description UP UPS g US USPS q */ CREATE TABLE "Roles" ( role_code CHAR(15) NOT NULL, role_description VARCHAR(255), PRIMARY KEY (role_code) ) /* 2 rows from Roles table: role_code role_description ED Editor PT Photo */
How many draft copies does the document with id 2 have?
SELECT count(*) FROM Draft_Copies WHERE document_id = 2;
[{'count(*)': 2}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the document id with 1 to 2 paragraphs?[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2[/SQL]
[QUESTION]What is the document id with 1 to 2 paragraphs?[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2[/SQL]
[QUESTION]What is the document id with 1 to 2 paragraphs?[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2[/SQL]
[QUESTION]What is the document id with 1 to 2 paragraphs?[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2[/SQL]
protein_institute
CREATE TABLE "Institution" ( "Institution_id" TEXT, "Institution" TEXT, "Location" TEXT, "Founded" REAL, "Type" TEXT, "Enrollment" INTEGER, "Team" TEXT, "Primary_Conference" TEXT, building_id TEXT, PRIMARY KEY ("Institution_id"), FOREIGN KEY(building_id) REFERENCES building (building_id) ) CREATE TABLE building ( building_id TEXT, "Name" TEXT, "Street_address" TEXT, "Years_as_tallest" TEXT, "Height_feet" INTEGER, "Floors" INTEGER, PRIMARY KEY (building_id) ) CREATE TABLE protein ( common_name TEXT, protein_name TEXT, divergence_from_human_lineage REAL, accession_number TEXT, sequence_length REAL, sequence_identity_to_human_protein TEXT, "Institution_id" TEXT, PRIMARY KEY (common_name), FOREIGN KEY("Institution_id") REFERENCES "Institution" ("Institution_id") )
CREATE TABLE "Institution" ( "Institution_id" TEXT, "Institution" TEXT, "Location" TEXT, "Founded" REAL, "Type" TEXT, "Enrollment" INTEGER, "Team" TEXT, "Primary_Conference" TEXT, building_id TEXT, PRIMARY KEY ("Institution_id"), FOREIGN KEY(building_id) REFERENCES building (building_id) ) /* 2 rows from Institution table: Institution_id Institution Location Founded Type Enrollment Team Primary_Conference building_id 0 Ave Maria University Ave Maria, Florida 1998.0 Private 1200 Gyrenes The Sun 1 1 Dakota State University Madison, South Dakota 1881.0 Public 3102 Trojans none 1 */ CREATE TABLE building ( building_id TEXT, "Name" TEXT, "Street_address" TEXT, "Years_as_tallest" TEXT, "Height_feet" INTEGER, "Floors" INTEGER, PRIMARY KEY (building_id) ) /* 2 rows from building table: building_id Name Street_address Years_as_tallest Height_feet Floors 0 Citizens Bank Building 701 North Franklin Street 1913–1915 145 12 1 Tampa City Hall 315 John F. Kennedy Boulevard 1915–1926 160 10 */ CREATE TABLE protein ( common_name TEXT, protein_name TEXT, divergence_from_human_lineage REAL, accession_number TEXT, sequence_length REAL, sequence_identity_to_human_protein TEXT, "Institution_id" TEXT, PRIMARY KEY (common_name), FOREIGN KEY("Institution_id") REFERENCES "Institution" ("Institution_id") ) /* 2 rows from protein table: common_name protein_name divergence_from_human_lineage accession_number sequence_length sequence_identity_to_human_protein Institution_id Tropical Clawed Frog uncharacterized protein C20orf117-like 371.2 XP_002942331.1 1584.0 39% 1 purple sea urchin uncharacterized protein LOC578090 742.9 XP_783370.2 1587.0 47% 3 */
Show institution names along with the number of proteins for each institution.
SELECT T1.institution , count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id GROUP BY T1.institution_id
[{'Institution': 'Dakota State University', 'count(*)': 1}, {'Institution': 'Haskell Indian Nations University', 'count(*)': 1}, {'Institution': 'Lindenwood University–Belleville', 'count(*)': 2}, {'Institution': 'Valley City State University', 'count(*)': 1}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
movie_1
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") )
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) /* 2 rows from Movie table: mID title year director 101 Gone with the Wind 1939 Victor Fleming 102 Star Wars 1977 George Lucas */ CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) /* 2 rows from Rating table: rID mID stars ratingDate 201 101 2 2011-01-22 201 101 4 2011-01-27 */ CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") ) /* 2 rows from Reviewer table: rID name 201 Sarah Martinez 202 Daniel Lewis */
Find the titles of all movies that have no ratings.
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
[{'title': 'Star Wars'}, {'title': 'Titanic'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find all movies produced in 2015[/QUESTION] [SQL]SELECT title FROM movie WHERE release_year = 2015;[/SQL]
[QUESTION]Find all movies produced in 2015[/QUESTION] [SQL]SELECT title FROM movie WHERE release_year = 2015;[/SQL]
farm
CREATE TABLE city ( "City_ID" INTEGER, "Official_Name" TEXT, "Status" TEXT, "Area_km_2" REAL, "Population" REAL, "Census_Ranking" TEXT, PRIMARY KEY ("City_ID") ) CREATE TABLE competition_record ( "Competition_ID" INTEGER, "Farm_ID" INTEGER, "Rank" INTEGER, PRIMARY KEY ("Competition_ID", "Farm_ID"), FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"), FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID") ) CREATE TABLE farm ( "Farm_ID" INTEGER, "Year" INTEGER, "Total_Horses" REAL, "Working_Horses" REAL, "Total_Cattle" REAL, "Oxen" REAL, "Bulls" REAL, "Cows" REAL, "Pigs" REAL, "Sheep_and_Goats" REAL, PRIMARY KEY ("Farm_ID") ) CREATE TABLE farm_competition ( "Competition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Host_city_ID" INTEGER, "Hosts" TEXT, PRIMARY KEY ("Competition_ID"), FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID") )
CREATE TABLE city ( "City_ID" INTEGER, "Official_Name" TEXT, "Status" TEXT, "Area_km_2" REAL, "Population" REAL, "Census_Ranking" TEXT, PRIMARY KEY ("City_ID") ) /* 2 rows from city table: City_ID Official_Name Status Area_km_2 Population Census_Ranking 1 Grand Falls/Grand-Sault Town 18.06 5706.0 636 of 5008 2 Perth-Andover Village 8.89 1778.0 1442 of 5,008 */ CREATE TABLE competition_record ( "Competition_ID" INTEGER, "Farm_ID" INTEGER, "Rank" INTEGER, PRIMARY KEY ("Competition_ID", "Farm_ID"), FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"), FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID") ) /* 2 rows from competition_record table: Competition_ID Farm_ID Rank 1 8 1 1 2 2 */ CREATE TABLE farm ( "Farm_ID" INTEGER, "Year" INTEGER, "Total_Horses" REAL, "Working_Horses" REAL, "Total_Cattle" REAL, "Oxen" REAL, "Bulls" REAL, "Cows" REAL, "Pigs" REAL, "Sheep_and_Goats" REAL, PRIMARY KEY ("Farm_ID") ) /* 2 rows from farm table: Farm_ID Year Total_Horses Working_Horses Total_Cattle Oxen Bulls Cows Pigs Sheep_and_Goats 1 1927 5056.5 3900.1 8374.5 805.5 31.6 3852.1 4412.4 7956.3 2 1928 5486.9 4090.5 8604.8 895.3 32.8 3987.0 6962.9 8112.2 */ CREATE TABLE farm_competition ( "Competition_ID" INTEGER, "Year" INTEGER, "Theme" TEXT, "Host_city_ID" INTEGER, "Hosts" TEXT, PRIMARY KEY ("Competition_ID"), FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID") ) /* 2 rows from farm_competition table: Competition_ID Year Theme Host_city_ID Hosts 1 2013 Carnival M is back! 1 Miley Cyrus Jared Leto and Karen Mok 2 2006 Codehunters 2 Leehom Wang and Kelly Rowland */
Return the different statuses of cities, ascending by frequency.
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
[{'Status': 'Town'}, {'Status': 'Village'}]
Easy
false
false
false
true
false
true
false
false
false
false
false
false
false
[QUESTION]Find all the distinct district names ordered by city area in descending.[/QUESTION] [SQL]SELECT DISTINCT District_name FROM district ORDER BY city_area DESC[/SQL]
[QUESTION]Find all the distinct district names ordered by city area in descending.[/QUESTION] [SQL]SELECT DISTINCT District_name FROM district ORDER BY city_area DESC[/SQL]
[QUESTION]Find all the distinct district names ordered by city area in descending.[/QUESTION] [SQL]SELECT DISTINCT District_name FROM district ORDER BY city_area DESC[/SQL]
[QUESTION]Find all the distinct district names ordered by city area in descending.[/QUESTION] [SQL]SELECT DISTINCT District_name FROM district ORDER BY city_area DESC[/SQL]
ship_mission
CREATE TABLE mission ( "Mission_ID" INTEGER, "Ship_ID" INTEGER, "Code" TEXT, "Launched_Year" INTEGER, "Location" TEXT, "Speed_knots" INTEGER, "Fate" TEXT, PRIMARY KEY ("Mission_ID"), FOREIGN KEY("Ship_ID") REFERENCES ship ("Ship_ID") ) CREATE TABLE ship ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Nationality" TEXT, "Tonnage" INTEGER, PRIMARY KEY ("Ship_ID") )
CREATE TABLE mission ( "Mission_ID" INTEGER, "Ship_ID" INTEGER, "Code" TEXT, "Launched_Year" INTEGER, "Location" TEXT, "Speed_knots" INTEGER, "Fate" TEXT, PRIMARY KEY ("Mission_ID"), FOREIGN KEY("Ship_ID") REFERENCES ship ("Ship_ID") ) /* 2 rows from mission table: Mission_ID Ship_ID Code Launched_Year Location Speed_knots Fate 1 1 VMV-1 1930 Germany 25 Decommissioned 1950 2 2 VMV-2 1930 Germany 25 Decommissioned 1950 */ CREATE TABLE ship ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Nationality" TEXT, "Tonnage" INTEGER, PRIMARY KEY ("Ship_ID") ) /* 2 rows from ship table: Ship_ID Name Type Nationality Tonnage 1 Corbridge Cargo ship United Kingdom 3687 2 Farringford Battle ship United States 3146 */
What are the type and nationality of ships?
SELECT TYPE , Nationality FROM ship
[{'Type': 'Cargo ship', 'Nationality': 'United Kingdom'}, {'Type': 'Battle ship', 'Nationality': 'United States'}, {'Type': 'Cargo ship', 'Nationality': 'United Kingdom'}, {'Type': 'Cargo ship', 'Nationality': 'United Kingdom'}, {'Type': 'Battle ship', 'Nationality': 'United Kingdom'}, {'Type': 'Cargo ship', 'Nationality': 'United States'}, {'Type': 'Battle ship', 'Nationality': 'United Kingdom'}, {'Type': 'Cargo ship', 'Nationality': 'United States'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
Find the ids of all distinct customers who made order after some orders that were Cancelled.
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled")
[{'customer_id': 1}, {'customer_id': 4}, {'customer_id': 11}, {'customer_id': 13}, {'customer_id': 8}, {'customer_id': 15}, {'customer_id': 6}, {'customer_id': 10}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
cre_Theme_park
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") )
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) /* 2 rows from Features table: Feature_ID Feature_Details 523 cafe 528 park */ CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) /* 2 rows from Hotels table: hotel_id star_rating_code pets_allowed_yn price_range other_hotel_details 123 5 1 2914989.571 None 144 4 None */ CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) /* 2 rows from Locations table: Location_ID Location_Name Address Other_Details 333 Astro Orbiter 660 Shea Crescent None 368 African Animals 254 Ottilie Junction None */ CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Museums table: Museum_ID Museum_Details 2113 Yale Center for British Art 2701 The Metropolitan Museum of Art */ CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Photos table: Photo_ID Tourist_Attraction_ID Name Description Filename Other_Details 211 8449 game1 None 702 None 280 7067 game2 None 762 None */ CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) /* 2 rows from Ref_Attraction_Types table: Attraction_Type_Code Attraction_Type_Description 2 park 3 garden */ CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) /* 2 rows from Ref_Hotel_Star_Ratings table: star_rating_code star_rating_description 1 star 2 star */ CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Royal_Family table: Royal_Family_ID Royal_Family_Details 9561 None 9919 None */ CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Shops table: Shop_ID Shop_Details 8429 soup 8449 coffee */ CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Staff table: Staff_ID Tourist_Attraction_ID Name Other_Details 170 6476 Whitney None 219 6476 Kaela None */ CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Street_Markets table: Market_ID Market_Details 6852 Broadway 7067 Fish Farm Market */ CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Theme_Parks table: Theme_Park_ID Theme_Park_Details 5265 Disney 6476 Sea World */ CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) /* 2 rows from Tourist_Attraction_Features table: Tourist_Attraction_ID Feature_ID 5076 528 5076 681 */ CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) /* 2 rows from Tourist_Attractions table: Tourist_Attraction_ID Attraction_Type_Code Location_ID How_to_Get_There Name Description Opening_Hours Other_Details 2113 2 579 bus art museum None None None 2701 6 417 walk UK gallery None None None */ CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) /* 2 rows from Visitors table: Tourist_ID Tourist_Details 164 Toney 189 Graciela */ CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") ) /* 2 rows from Visits table: Visit_ID Tourist_Attraction_ID Tourist_ID Visit_Date Visit_Details 183 6653 377 2004-08-21 03:06:14 268 5076 204 2013-08-06 05:35:51 */
How many available hotels are there in total?
SELECT count(*) FROM HOTELS
[{'count(*)': 20}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many shops are there in each location?[/QUESTION] [SQL]SELECT count(*) , LOCATION FROM shop GROUP BY LOCATION[/SQL]
[QUESTION]How many shops are there in each location?[/QUESTION] [SQL]SELECT count(*) , LOCATION FROM shop GROUP BY LOCATION[/SQL]
small_bank_1
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) )
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) /* 2 rows from ACCOUNTS table: custid name 1 Brown 2 Wang */ CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 */ CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 */
Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC
[{'balance': 999999999.0, 'name': 'Wang'}, {'balance': 230000.0, 'name': "O'mahony"}, {'balance': 200000.0, 'name': 'Brown'}, {'balance': 80000.0, 'name': 'Granger'}, {'balance': 60.0, 'name': 'Weeks'}, {'balance': 240.0, 'name': 'Porter'}]
Hard
false
false
false
true
false
false
false
false
true
false
false
false
false
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
icfp_1
CREATE TABLE "Authors" ( "authID" INTEGER, lname TEXT, fname TEXT, PRIMARY KEY ("authID") ) CREATE TABLE "Authorship" ( "authID" INTEGER, "instID" INTEGER, "paperID" INTEGER, "authOrder" INTEGER, PRIMARY KEY ("authID", "instID", "paperID"), FOREIGN KEY("authID") REFERENCES "Authors" ("authID"), FOREIGN KEY("instID") REFERENCES "Inst" ("instID"), FOREIGN KEY("paperID") REFERENCES "Papers" ("paperID") ) CREATE TABLE "Inst" ( "instID" INTEGER, name TEXT, country TEXT, PRIMARY KEY ("instID") ) CREATE TABLE "Papers" ( "paperID" INTEGER, title TEXT, PRIMARY KEY ("paperID") )
CREATE TABLE "Authors" ( "authID" INTEGER, lname TEXT, fname TEXT, PRIMARY KEY ("authID") ) /* 2 rows from Authors table: authID lname fname 50 Gibbons Jeremy 51 Hinze Ralf */ CREATE TABLE "Authorship" ( "authID" INTEGER, "instID" INTEGER, "paperID" INTEGER, "authOrder" INTEGER, PRIMARY KEY ("authID", "instID", "paperID"), FOREIGN KEY("authID") REFERENCES "Authors" ("authID"), FOREIGN KEY("instID") REFERENCES "Inst" ("instID"), FOREIGN KEY("paperID") REFERENCES "Papers" ("paperID") ) /* 2 rows from Authorship table: authID instID paperID authOrder 50 1000 200 1 51 1000 200 2 */ CREATE TABLE "Inst" ( "instID" INTEGER, name TEXT, country TEXT, PRIMARY KEY ("instID") ) /* 2 rows from Inst table: instID name country 1000 University of Oxford UK 1010 Northeastern University USA */ CREATE TABLE "Papers" ( "paperID" INTEGER, title TEXT, PRIMARY KEY ("paperID") ) /* 2 rows from Papers table: paperID title 200 Just do it: Simple Monadic Equational Reasoning 201 Proving the Unique Fixed-Point Principle Correct: An Adventure with Category Theory */
Which paper has the most authors? Give me the paper title.
SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT max(authorder) FROM authorship)
[{'title': 'Binders Unbound'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]return me the authors who have the most number of papers in PVLDB .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the authors who have the most number of papers in PVLDB .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the authors who have the most number of papers in PVLDB .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
[QUESTION]return me the authors who have the most number of papers in PVLDB .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "PVLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
party_people
CREATE TABLE member ( "Member_ID" INTEGER, "Member_Name" TEXT, "Party_ID" TEXT, "In_office" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) CREATE TABLE party ( "Party_ID" INTEGER, "Minister" TEXT, "Took_office" TEXT, "Left_office" TEXT, "Region_ID" INTEGER, "Party_name" TEXT, PRIMARY KEY ("Party_ID"), FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID") ) CREATE TABLE party_events ( "Event_ID" INTEGER, "Event_Name" TEXT, "Party_ID" INTEGER, "Member_in_charge_ID" INTEGER, PRIMARY KEY ("Event_ID"), FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) CREATE TABLE region ( "Region_ID" INTEGER, "Region_name" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT, PRIMARY KEY ("Region_ID") )
CREATE TABLE member ( "Member_ID" INTEGER, "Member_Name" TEXT, "Party_ID" TEXT, "In_office" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) /* 2 rows from member table: Member_ID Member_Name Party_ID In_office 1 Hon Tony Abbott 3 1994–present 2 Hon Dick Adams 2 1993–2013 */ CREATE TABLE party ( "Party_ID" INTEGER, "Minister" TEXT, "Took_office" TEXT, "Left_office" TEXT, "Region_ID" INTEGER, "Party_name" TEXT, PRIMARY KEY ("Party_ID"), FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID") ) /* 2 rows from party table: Party_ID Minister Took_office Left_office Region_ID Party_name 1 Dr. Kwame Nkrumah (MP) 1957 1958 1 Convention Peoples Party 2 Kojo Botsio (MP) 1958 1959 2 Progress Party */ CREATE TABLE party_events ( "Event_ID" INTEGER, "Event_Name" TEXT, "Party_ID" INTEGER, "Member_in_charge_ID" INTEGER, PRIMARY KEY ("Event_ID"), FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) /* 2 rows from party_events table: Event_ID Event_Name Party_ID Member_in_charge_ID 1 Annaual Meeting 1 4 2 Conference 1 12 */ CREATE TABLE region ( "Region_ID" INTEGER, "Region_name" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT, PRIMARY KEY ("Region_ID") ) /* 2 rows from region table: Region_ID Region_name Date Label Format Catalogue 1 United Kingdom 1 July 2002 Parlophone CD 540 3622 2 United Kingdom 1 July 2002 Parlophone 2× LP 539 9821 */
How many parties do we have?
SELECT count(DISTINCT party_name) FROM party
[{'count(DISTINCT party_name)': 5}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false