Dataset Viewer
Auto-converted to Parquet Duplicate
db_id
stringclasses
146 values
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringclasses
133 values
bike_1
SELECT zip_code , count(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code
For each zip code, return how many times max wind speed reached 25?
CREATE TABLE station ( id INTEGER PRIMARY KEY, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT); CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY (station_id) REF...
college_2
SELECT min(salary) , dept_name FROM instructor GROUP BY dept_name HAVING avg(salary) > (SELECT avg(salary) FROM instructor)
Find the minimum salary for the departments whose average salary is above the average payment of all instructors.
null
college_2
SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
Find courses that ran in Fall 2009 but not in Spring 2010.
null
scholar
SELECT DISTINCT t4.citedpaperid , COUNT ( t4.citedpaperid ) FROM paper AS t3 JOIN cite AS t4 ON t3.paperid = t4.citedpaperid JOIN writes AS t2 ON t2.paperid = t3.paperid JOIN author AS t1 ON t2.authorid = t1.authorid WHERE t1.authorname = "ohad shamir" GROUP BY t4.citedpaperid ORDER BY COUNT ( t4.citedpaperid...
What is the highest cited paper by ohad shamir ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
cre_Docs_and_Epenses
SELECT count(*) FROM Documents
Count the number of documents.
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_Budget_Codes ( Budget_Type_Code CHAR(15) NOT NULL, Budget_Type_Description VARCHAR(255) NOT NULL, PRIMAR...
perpetrator
SELECT count(*) FROM perpetrator
How many perpetrators are there?
CREATE TABLE "perpetrator" ( "Perpetrator_ID" int, "People_ID" int, "Date" text, "Year" real, "Location" text, "Country" text, "Killed" int, "Injured" int, PRIMARY KEY ("Perpetrator_ID"), FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Name" text, "Height" real, "...
scholar
SELECT DISTINCT COUNT ( DISTINCT t2.paperid ) , t1.authorid FROM venue AS t3 JOIN paper AS t2 ON t3.venueid = t2.venueid JOIN writes AS t1 ON t1.paperid = t2.paperid WHERE t3.venuename = "chi" GROUP BY t1.authorid ORDER BY COUNT ( DISTINCT t2.paperid ) DESC;
who published the most at chi
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
flight_4
SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*) > 3)
What is the count of cities with more than 3 airports?
null
bike_1
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
What are the dates in which the mean sea level pressure was between 30.3 and 31?
CREATE TABLE station ( id INTEGER PRIMARY KEY, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT); CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY (station_id) REF...
scholar
SELECT DISTINCT COUNT ( t1.paperid ) FROM venue AS t2 JOIN paper AS t1 ON t2.venueid = t1.venueid WHERE t2.venuename = "sigir";
how many papers does sigir have ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
customers_card_transactions
SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id
What are the different customer ids, and how many cards does each one hold?
CREATE TABLE `Accounts` ( `account_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `account_name` VARCHAR(50), `other_account_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_first_name` VARCHAR(20), `customer_last_name` VARCHAR(20), `customer_address` VARCHAR(25...
swimming
SELECT count(*) FROM stadium
How many stadiums are there?
CREATE TABLE "swimmer" ( "ID" int, "name" text, "Nationality" text, "meter_100" real, "meter_200" text, "meter_300" text, "meter_400" text, "meter_500" text, "meter_600" text, "meter_700" text, "Time" text, PRIMARY KEY ("ID") ); CREATE TABLE "stadium" ( "ID" int, "name" text, "Capacity" int, "City" text, "Country" text...
academic
SELECT t5.title FROM writes AS t3 JOIN author AS t2 ON t3.aid = t2.aid JOIN publication AS t5 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t5.pid JOIN author AS t1 ON t4.aid = t1.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Divesh Srivastava" AND t5.year < 2000;
return me the papers written by " H. V. Jagadish " and " Divesh Srivastava " before 2000 .
CREATE TABLE "author" ( "aid" int, "homepage" text, "name" text, "oid" int, primary key("aid") ); CREATE TABLE "conference" ( "cid" int, "homepage" text, "name" text, primary key ("cid") ); CREATE TABLE "domain" ( "did" int, "name" text, primary key ("did") ); CREATE TABLE "domain_author" ( "aid" int, "did" int, prima...
farm
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
What are the official names of cities that have hosted more than one competition?
CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real, "Cows" real, "Pigs...
formula_1
SELECT count(DISTINCT driverId) FROM results WHERE raceId NOT IN( SELECT raceId FROM races WHERE YEAR != 2009 )
How many drivers did not participate in the races held in 2009?
null
cre_Docs_and_Epenses
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
Give the ids of documents with expenses that have the budget code 'SF'.
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_Budget_Codes ( Budget_Type_Code CHAR(15) NOT NULL, Budget_Type_Description VARCHAR(255) NOT NULL, PRIMAR...
academic
SELECT t1.keyword FROM publication_keyword AS t4 JOIN keyword AS t1 ON t4.kid = t1.kid JOIN publication AS t2 ON t2.pid = t4.pid JOIN journal AS t3 ON t2.jid = t3.jid WHERE t3.name = "PVLDB" GROUP BY t1.keyword ORDER BY COUNT ( DISTINCT t2.title ) DESC LIMIT 1;
return me the keyword, which have been contained by the most number of papers in PVLDB .
CREATE TABLE "author" ( "aid" int, "homepage" text, "name" text, "oid" int, primary key("aid") ); CREATE TABLE "conference" ( "cid" int, "homepage" text, "name" text, primary key ("cid") ); CREATE TABLE "domain" ( "did" int, "name" text, primary key ("did") ); CREATE TABLE "domain_author" ( "aid" int, "did" int, prima...
department_store
SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details
List the name and phone number of all suppliers in the alphabetical order of their addresses.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `address_details` VARCHAR(255) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_gender` VARCHAR(1), `staff_name` VARCHAR(80) ); CREATE TABLE `Suppliers` ( `supplier_id` INTEGER PRIMARY KEY, `supplier_name` VARCHAR(80), `supplier_phone` VARCHAR...
scholar
SELECT DISTINCT MAX ( t3.year ) 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 = "Mary Crainie";
When was the last time Mary Crainie published a paper ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
cre_Drama_Workshop_Groups
SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY count(*) DESC LIMIT 1
What is the most frequent status of bookings?
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ); CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(2...
insurance_and_eClaims
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Find the type code of the most frequently used policy.
CREATE TABLE Customers ( Customer_ID INTEGER NOT NULL, Customer_Details VARCHAR(255) NOT NULL, PRIMARY KEY (Customer_ID) ); CREATE TABLE Staff ( Staff_ID INTEGER NOT NULL, Staff_Details VARCHAR(255) NOT NULL, PRIMARY KEY (Staff_ID) ); CREATE TABLE Policies ( Policy_ID INTEGER NOT NULL, Customer_ID INTEGER NOT NULL, Pol...
scholar
SELECT DISTINCT t1.paperid FROM venue AS t2 JOIN paper AS t1 ON t2.venueid = t1.venueid WHERE t1.year = 2015 AND t2.venuename = "pldi";
papers in pldi 2015
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
scholar
SELECT DISTINCT t1.authorid , t3.paperid FROM paperkeyphrase AS t2 JOIN keyphrase AS t5 ON t2.keyphraseid = t5.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN writes AS t4 ON t4.paperid = t3.paperid JOIN author AS t1 ON t4.authorid = t1.authorid WHERE t1.authorname = "brian curless" AND t5.keyp...
What papers has brian curless written about convolution ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
manufactory_1
SELECT name FROM manufacturers EXCEPT SELECT T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T1.name = 'DVD drive'
Find the name of companies that do not make DVD drive.
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255) NOT NULL, Headquarter VARCHAR(255) NOT NULL, Founder VARCHAR(255) NOT NULL, Revenue REAL, PRIMARY KEY (Code) ); CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255) NOT NULL , Price DECIMAL NOT NULL , Manufacturer INTEGER NOT NULL, ...
college_2
SELECT count(DISTINCT dept_name) FROM course
Count the number of departments which offer courses.
null
game_injury
SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
What are the ids, scores, and dates of the games which caused at least two injury accidents?
CREATE TABLE "stadium" ( "id" int, "name" text, "Home_Games" int, "Average_Attendance" real, "Total_Attendance" real, "Capacity_Percentage" real, primary key ("id") ); CREATE TABLE "game" ( "stadium_id" int, "id" int, "Season" int, "Date" text, "Home_team" text, "Away_team" text, "Score" text, "Competition" text, prima...
performance_attendance
SELECT LOCATION , COUNT(*) FROM performance GROUP BY LOCATION
Show different locations and the number of performances at each location.
CREATE TABLE "member" ( "Member_ID" text, "Name" text, "Nationality" text, "Role" text, PRIMARY KEY ("Member_ID") ); CREATE TABLE "performance" ( "Performance_ID" real, "Date" text, "Host" text, "Location" text, "Attendance" int, PRIMARY KEY ("Performance_ID") ); CREATE TABLE...
game_1
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
What are the ids of all female students who play football?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Video_Games ( Ga...
chinook_1
SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"
What is the average unit price of rock tracks?
null
geo
SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state );
what state is the largest in population
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` double DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` double DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL...
match_season
SELECT POSITION , COUNT(*) FROM match_season GROUP BY POSITION
Show the position of players and the corresponding number of players.
CREATE TABLE "country" ( "Country_id" int, "Country_name" text, "Capital" text, "Official_native_language" text, PRIMARY KEY ("Country_id") ); CREATE TABLE `team` ( `Team_id` int, `Name` text, PRIMARY KEY (`Team_id`) ) ; CREATE TABLE "match_season" ( "Season" real, "Player"...
candidate_poll
SELECT name FROM people ORDER BY date_of_birth
What are the names of all people, ordered by their date of birth?
CREATE TABLE "candidate" ( "Candidate_ID" int, "People_ID" int, "Poll_Source" text, "Date" text, "Support_rate" real, "Consider_rate" real, "Oppose_rate" real, "Unsure_rate" real, PRIMARY KEY ("Candidate_ID"), FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Sex" t...
sakila_1
SELECT count(*) FROM inventory WHERE store_id = 1
Count the number of items store 1 has in stock.
CREATE TABLE actor ( actor_id SMALLINT UNSIGNED NOT NULL, first_name VARCHAR(45) NOT NULL, last_name VARCHAR(45) NOT NULL, last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (actor_id) ); CREATE TABLE address ( address_id SMALLINT UNSIGNED NOT NULL, address VARCHAR(50) NOT NULL, addr...
student_assessment
SELECT course_name FROM courses ORDER BY course_name
List the names of courses in alphabetical order?
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 People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), ...
e_government
SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3
Find the payment method code used by more than 3 parties.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `town_city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Services` ( `service_id` INTEGER PRIMARY KEY, `service_type_code` VARCHAR(15) NOT NULL, `ser...
movie_1
SELECT name FROM Reviewer UNION SELECT title FROM Movie
What are the names of all the reviewers and movie names?
create table Movie( mID int primary key, title text, year int, director text ); create table Reviewer( rID int primary key, name text); create table Rating( rID int, mID int, stars int, ratingDate date, FOREIGN KEY (mID) references Movie(mID), FOREIGN KEY (rID) references Reviewer(rID) );
geo
SELECT border FROM border_info WHERE state_name = "kentucky";
what states neighbor kentucky
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` double DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` double DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL...
network_2
SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'
How many friends does Dan have?
CREATE TABLE Person ( name varchar(20) PRIMARY KEY, age INTEGER, city TEXT, gender TEXT, job TEXT ); CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER, FOREIGN KEY (name) REFERENCES Person(name), FOREIGN KEY (friend) REFERENCES Person(name) );
party_host
SELECT T3.Location , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age
Show the locations of parties and the names of the party hosts in ascending order of the age of the host.
CREATE TABLE "party" ( "Party_ID" int, "Party_Theme" text, "Location" text, "First_year" text, "Last_year" text, "Number_of_hosts" int, PRIMARY KEY ("Party_ID") ); CREATE TABLE "host" ( "Host_ID" int, "Name" text, "Nationality" text, "Age" text, PRIMARY KEY ("Host_ID") ); CREATE TABLE "party_host" ( "Party_ID" int, "Ho...
college_2
SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000
What are the names of the instructors in the Comp. Sci. department who earn more than 80000?
null
scholar
SELECT DISTINCT t3.paperid 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 = "Question Answering";
papers published in the area of Question Answering
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
customers_and_addresses
SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona"
What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `address_content` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50), `other_address_details` VARCHAR(255) ); CREATE TABLE `Products` ( `product_id` INTEGER PRIMARY KEY, `product_details` VA...
activity_1
SELECT rank , count(*) FROM Faculty GROUP BY rank
For each faculty rank, show the number of faculty members who have it.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER,...
cre_Theme_park
SELECT Location_Name FROM LOCATIONS WHERE Location_Name LIKE "%film%"
Find all the locations whose names contain the word "film".
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 Locations ( Location_ID INTEGER NOT NULL, Location_Name VARCHAR(255), Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Lo...
document_management
SELECT document_type_code FROM documents WHERE document_name = "David CV"
What is the type of the document named "David CV"?
CREATE TABLE `Roles` ( `role_code` VARCHAR(15) PRIMARY KEY, `role_description` VARCHAR(80) ); CREATE TABLE `Users` ( `user_id` INTEGER PRIMARY KEY, `role_code` VARCHAR(15) NOT NULL, `user_name` VARCHAR(40), `user_login` VARCHAR(40), `password` VARCHAR(40), FOREIGN KEY (`role_code` ) REFERENCES `Roles`(`role_code` ) ); ...
club_1
SELECT count(*) FROM club
Count the total number of clubs.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ...
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University"
Find the number of papers published by authors from the institution "Tokohu University".
null
coffee_shop
SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*) > 5
Which membership card has more than 5 members?
CREATE TABLE "shop" ( "Shop_ID" int, "Address" text, "Num_of_staff" text, "Score" real, "Open_Year" text, PRIMARY KEY ("Shop_ID") ); CREATE TABLE "member" ( "Member_ID" int, "Name" text, "Membership_card" text, "Age" int, "Time_of_purchase" int, "Level_of_membership" int, "Address" text, PRIMARY KEY ("Member_ID") ); CR...
hospital_1
SELECT name FROM physician WHERE POSITION LIKE '%senior%'
Find the name of physicians whose position title contains the word 'senior'.
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 Department ( DepartmentID INTEGER NOT NULL, Name VARCHAR(30) NOT NULL, Head INTEGER NOT NULL, CONSTRAIN...
student_1
SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
What are the first and last names of the first-grade students who are NOT taught by teacher OTHA MOYER?
null
network_2
SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE friend = 'Alice')
What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time?
CREATE TABLE Person ( name varchar(20) PRIMARY KEY, age INTEGER, city TEXT, gender TEXT, job TEXT ); CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER, FOREIGN KEY (name) REFERENCES Person(name), FOREIGN KEY (friend) REFERENCES Person(name) );
activity_1
SELECT FacID FROM Faculty WHERE Sex = 'M'
Show ids for all the male faculty.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER,...
train_station
SELECT DISTINCT LOCATION FROM station
What are all locations of train stations?
CREATE TABLE "station" ( "Station_ID" int, "Name" text, "Annual_entry_exit" real, "Annual_interchanges" real, "Total_Passengers" real, "Location" text, "Main_Services" text, "Number_of_Platforms" int, PRIMARY KEY ("Station_ID") ); CREATE TABLE "train" ( "Train_ID" int, "Name" text, "Time" text, "Service" text, PRIMARY ...
musical
SELECT T1.Name , T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID
What are the names of actors and the musicals that they are in?
CREATE TABLE "musical" ( "Musical_ID" int, "Name" text, "Year" int, "Award" text, "Category" text, "Nominee" text, "Result" text, PRIMARY KEY ("Musical_ID") ); CREATE TABLE "actor" ( "Actor_ID" int, "Name" text, "Musical_ID" int, "Character" text, "Duration" text, "age" int, PRIMARY KEY ("Actor_ID"), FOREIGN KEY ("Musi...
scholar
SELECT DISTINCT t3.journalid , t4.venueid FROM venue AS t4 JOIN paper AS t3 ON t4.venueid = t3.venueid JOIN writes AS t2 ON t2.paperid = t3.paperid JOIN author AS t1 ON t2.authorid = t1.authorid WHERE t1.authorname = "Peter Mertens";
in what venues does Peter Mertens publish ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
product_catalog
SELECT t1.attribute_name , t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0
Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.
CREATE TABLE `Attribute_Definitions` ( `attribute_id` INTEGER PRIMARY KEY, `attribute_name` VARCHAR(30), `attribute_data_type` VARCHAR(10) ); CREATE TABLE `Catalogs` ( `catalog_id` INTEGER PRIMARY KEY, `catalog_name` VARCHAR(50), `catalog_publisher` VARCHAR(80), `date_of_publication` DATETIME, `date_of_latest_revision`...
geo
SELECT population FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "alaska" ) AND state_name = "alaska";
how large is the largest city in alaska
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` double DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` double DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL...
activity_1
SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Which faculty members are playing either Canoeing or Kayaking? Tell me their first names.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER,...
network_2
SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name != 'Alice'
Find Alice's friends of friends.
CREATE TABLE Person ( name varchar(20) PRIMARY KEY, age INTEGER, city TEXT, gender TEXT, job TEXT ); CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER, FOREIGN KEY (name) REFERENCES Person(name), FOREIGN KEY (friend) REFERENCES Person(name) );
geo
SELECT state_name FROM highlow WHERE highest_elevation > ( SELECT highest_elevation FROM highlow WHERE state_name = "colorado" );
which states have points that are higher than the highest point in colorado
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` double DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` double DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL...
customers_and_invoices
SELECT order_id , count(*) FROM Invoices GROUP BY order_id
How many invoices correspond to each order id?
CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `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` VAR...
customers_and_invoices
SELECT DISTINCT product_color FROM Products
What are the different product colors?
CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `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` VAR...
music_1
SELECT count(*) , formats FROM files GROUP BY formats
For each file format, return the number of artists who released songs in that format.
create table genre( g_name varchar2(20) not null, rating varchar2(10), most_popular_in varchar2(50), primary key(g_name) ); create table artist( artist_name varchar2(50) not null, country varchar2(20), gender varchar2(20), preferred_genre varchar2(50), constraint a_name primary key(artist_name), foreign key(p...
hr_1
SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2
What are the employee ids for employees who have held two or more jobs?
CREATE TABLE IF NOT EXISTS `regions` ( `REGION_ID` decimal(5,0) NOT NULL, `REGION_NAME` varchar(25) DEFAULT NULL, PRIMARY KEY (`REGION_ID`) ); CREATE TABLE IF NOT EXISTS `countries` ( `COUNTRY_ID` varchar(2) NOT NULL, `COUNTRY_NAME` varchar(40) DEFAULT NULL, `REGION_ID` decimal(10,0) DEFAULT NULL, PRIMARY...
college_2
SELECT count(*) , building FROM classroom WHERE capacity > 50 GROUP BY building
How many rooms in each building have a capacity of over 50?
null
college_2
SELECT name , dept_name FROM student ORDER BY tot_cred
What are the names of students and their respective departments, ordered by number of credits from least to greatest?
null
scholar
SELECT DISTINCT COUNT ( t2.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 = "michael i. jordan" AND t3.year = 2016;
How many papers did michael i. jordan publish in 2016
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
university_basketball
SELECT max(Enrollment) FROM university
What is the maximum enrollment across all schools?
CREATE TABLE "basketball_match" ( "Team_ID" int, "School_ID" int, "Team_Name" text, "ACC_Regular_Season" text, "ACC_Percent" text, "ACC_Home" text, "ACC_Road" text, "All_Games" text, "All_Games_Percent" int, "All_Home" text, "All_Road" text, "All_Neutral" text, PRIMARY KEY ("Team_ID"), FOREIGN KEY (`School_ID`) REFEREN...
dorm_1
SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1
Find the name of the dorm with the largest capacity.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Dorm ( dormid I...
sakila_1
SELECT title , rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1
Which film has the highest rental rate? And what is the rate?
CREATE TABLE actor ( actor_id SMALLINT UNSIGNED NOT NULL, first_name VARCHAR(45) NOT NULL, last_name VARCHAR(45) NOT NULL, last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (actor_id) ); CREATE TABLE address ( address_id SMALLINT UNSIGNED NOT NULL, address VARCHAR(50) NOT NULL, addr...
formula_1
SELECT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds LIMIT 1
What is the forename and surname of the driver with the shortest laptime?
null
customers_and_products_contacts
SELECT min(product_price) , max(product_price) , avg(product_price) FROM products
Show the minimum, maximum, average price for all products.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Products` ( `product_id` INTEGER PRIMARY KEY, `product_type_code` VARCHAR(15), `product_name` VAR...
climbing
SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000
What are the names of mountains that have a height of over 5000 or a prominence of over 1000?
CREATE TABLE "mountain" ( "Mountain_ID" int, "Name" text, "Height" real, "Prominence" real, "Range" text, "Country" text, PRIMARY KEY ("Mountain_ID") ); CREATE TABLE "climber" ( "Climber_ID" int, "Name" text, "Country" text, "Time" text, "Points" real, "Mountain_ID" int, PRIMARY KEY ("Climber_ID"), FOREIGN KEY ("Mounta...
medicine_enzyme_interaction
SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'
What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?
CREATE TABLE "medicine" ( "id" int, "name" text, "Trade_Name" text, "FDA_approved" text, primary key ("id") ); CREATE TABLE "enzyme" ( "id" int, "name" text, "Location" text, "Product" text, "Chromosome" text, "OMIM" int, "Porphyria" text, primary key ("id") ); CREATE TABLE "medicine_enzyme_interaction" ( "enzyme_id" i...
voter_2
SELECT count(*) FROM VOTING_RECORD
Find the number of voting records in total.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
imdb
SELECT t4.title FROM CAST AS t5 JOIN actor AS t1 ON t5.aid = t1.aid JOIN movie AS t4 ON t4.mid = t5.msid JOIN directed_by AS t2 ON t4.mid = t2.msid JOIN director AS t3 ON t3.did = t2.did WHERE t1.name = "Taraneh Alidoosti" AND t3.name = "Asghar Farhadi";
Find all movies directed by " Asghar Farhadi " and featuring " Taraneh Alidoosti "
CREATE TABLE "actor" ( "aid" int, "gender" text, "name" text, "nationality" text, "birth_city" text, "birth_year" int, primary key("aid") ); CREATE TABLE "copyright" ( "id" int, "msid" int, "cid" int, primary key("id") ); CREATE TABLE "cast" ( "id" int, "msid" int, "aid" int, "role" int, primary key("id"), foreign key(...
music_2
SELECT TYPE FROM vocals GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
Which vocal type is the most frequently appearring type?
CREATE TABLE "Songs" ( "SongId" INTEGER PRIMARY KEY, "Title" TEXT ); CREATE TABLE "Albums" ( "AId" INTEGER PRIMARY KEY, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT ); CREATE TABLE "Band" ( "Id" INTEGER PRIMARY KEY, "Firstname" TEXT, "Lastname" TEXT ); CREATE TABLE "Instruments" ( "Son...
insurance_policies
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
CREATE TABLE Customers ( Customer_ID INTEGER NOT NULL, Customer_Details VARCHAR(255) NOT NULL, PRIMARY KEY (Customer_ID) ); CREATE TABLE Customer_Policies ( Policy_ID INTEGER NOT NULL, Customer_ID INTEGER NOT NULL, Policy_Type_Code CHAR(15) NOT NULL, Start_Date DATE, End_Date DATE, PRIMARY KEY (Policy_ID), FOREIGN KEY ...
hr_1
SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct != "null" OR department_id != 40
Return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40.
CREATE TABLE IF NOT EXISTS `regions` ( `REGION_ID` decimal(5,0) NOT NULL, `REGION_NAME` varchar(25) DEFAULT NULL, PRIMARY KEY (`REGION_ID`) ); CREATE TABLE IF NOT EXISTS `countries` ( `COUNTRY_ID` varchar(2) NOT NULL, `COUNTRY_NAME` varchar(40) DEFAULT NULL, `REGION_ID` decimal(10,0) DEFAULT NULL, PRIMARY...
college_3
SELECT T3.Fname , T3.LName , T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID
What are the full names and gradepoints for all enrollments?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID ...
restaurants
SELECT t3.house_number , t1.name FROM restaurant AS t1 JOIN geographic AS t2 ON t1.city_name = t2.city_name JOIN LOCATION AS t3 ON t1.id = t3.restaurant_id WHERE t2.region = "yosemite and mono lake area" AND t1.food_type = "french" AND t1.rating > 2.5;
give me some restaurants good for french food in the yosemite and mono lake area ?
CREATE TABLE "GEOGRAPHIC" ( "CITY_NAME" text, "COUNTY" text, "REGION" text, primary key("CITY_NAME") ); CREATE TABLE "RESTAURANT" ( "ID" int, "NAME" text, "FOOD_TYPE" text, "CITY_NAME" text, "RATING" real, primary key("ID"), foreign key ("CITY_NAME") references `GEOGRAPHIC`("CITY_NAME") ); CREATE TABLE "LOCATION" ( "RE...
voter_2
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18
What are the first names and last names of the students who are 18 years old and have vice president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
company_employee
SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2
Show the headquarters that have at least two companies.
CREATE TABLE "people" ( "People_ID" int, "Age" int, "Name" text, "Nationality" text, "Graduation_College" text, PRIMARY KEY ("People_ID") ); CREATE TABLE "company" ( "Company_ID" real, "Name" text, "Headquarters" text, "Industry" text, "Sales_in_Billion" real, "Profits_in...
college_1
SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
null
geo
SELECT highest_elevation FROM highlow WHERE state_name = "delaware";
what is the highest elevation in delaware
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` double DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` double DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL...
store_1
SELECT T1.name , COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
How many tracks does each genre have and what are the names of the top 5?
CREATE TABLE artists ( id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(120) ); CREATE TABLE albums ( id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, FOREIGN KEY (artist_id) REFERENCES artists (id) ON DELETE NO ACTION ON UPDATE NO ACTION ); ...
student_assessment
SELECT T1.student_id , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id
For every student who is registered for some course, how many courses are they registered for?
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 People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), ...
scholar
SELECT DISTINCT t3.paperid FROM writes AS t3 JOIN author AS t2 ON t3.authorid = t2.authorid JOIN writes AS t4 ON t4.paperid = t3.paperid JOIN author AS t1 ON t4.authorid = t1.authorid WHERE t2.authorname = "Peter Mertens" AND t1.authorname = "Dina Barbian";
Which papers have Peter Mertens and Dina Barbian as co-authors ?
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
flight_4
SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1
Which countries has the most number of airlines?
null
tracking_orders
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_name` VARCHAR(80), `customer_details` VARCHAR(255) ); CREATE TABLE `Invoices` ( `invoice_number` INTEGER PRIMARY KEY, `invoice_date` DATETIME, `invoice_details` VARCHAR(255) ); CREATE TABLE `Orders` ( `order_id` INTEGER PRIMARY KEY, `customer_id` I...
allergy_1
SELECT DISTINCT Major FROM Student
Show all majors.
create table Allergy_Type ( Allergy VARCHAR(20) PRIMARY KEY, AllergyType VARCHAR(20) ); create table Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy) ); create tabl...
cre_Theme_park
SELECT DISTINCT Location_Name FROM LOCATIONS
What are the distinct location names?
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 Locations ( Location_ID INTEGER NOT NULL, Location_Name VARCHAR(255), Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Lo...
inn_1
SELECT count(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids;
How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
null
academic
SELECT COUNT ( DISTINCT name ) FROM organization WHERE continent = "North America";
return me the number of the organizations in " North America " .
CREATE TABLE "author" ( "aid" int, "homepage" text, "name" text, "oid" int, primary key("aid") ); CREATE TABLE "conference" ( "cid" int, "homepage" text, "name" text, primary key ("cid") ); CREATE TABLE "domain" ( "did" int, "name" text, primary key ("did") ); CREATE TABLE "domain_author" ( "aid" int, "did" int, prima...
activity_1
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of professors who are not playing Canoeing or Kayaking.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER,...
dorm_1
SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY count(*) DESC LIMIT 1
What is the most common amenity in the dorms?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Dorm ( dormid I...
cre_Drama_Workshop_Groups
SELECT T1.State_County FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Marketing_Region_Code = "CA"
Find the states or counties where the stores with marketing region code "CA" are located.
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ); CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(2...
gas_company
SELECT LOCATION , count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
For each location, how many gas stations are there in order?
CREATE TABLE "company" ( "Company_ID" int, "Rank" int, "Company" text, "Headquarters" text, "Main_Industry" text, "Sales_billion" real, "Profits_billion" real, "Assets_billion" real, "Market_Value" real, PRIMARY KEY ("Company_ID") ); CREATE TABLE "gas_station" ( "Station_ID" int, "Open_Year" int, "Location" text, "Mana...
flight_4
SELECT avg(elevation) , country FROM airports GROUP BY country
For each country, what is the average elevation of that country's airports?
null
scholar
SELECT DISTINCT t3.paperid FROM paperdataset AS t2 JOIN dataset AS t1 ON t2.datasetid = t1.datasetid JOIN paper AS t3 ON t3.paperid = t2.paperid WHERE t1.datasetname = "WebKB";
papers using WebKB
CREATE TABLE `venue` ( `venueId` integer NOT NULL , `venueName` varchar(100) DEFAULT NULL , PRIMARY KEY (`venueId`) ); CREATE TABLE `author` ( `authorId` integer NOT NULL , `authorName` varchar(50) DEFAULT NULL , PRIMARY KEY (`authorId`) ); CREATE TABLE `dataset` ( `datasetId` integer NOT NULL , `datasetName...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
3