instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_43 ( george_hw_bush VARCHAR, pat_robertson VARCHAR, bob_dole VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When Pat Robertson had 19%, and Bob Dole had 26%, what did George H.W. Bush have?
SELECT george_hw_bush FROM table_name_43 WHERE pat_robertson = "19%" AND bob_dole = "26%"
sql_create_context
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home
nvbench
CREATE TABLE table_name_63 ( ihsaa_class__football_ VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Bishop Luers IHSAA class in football?
SELECT ihsaa_class__football_ FROM table_name_63 WHERE school = "bishop luers"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51200"
mimicsql_data
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
WITH Raw AS (SELECT Posts.OwnerUserId AS "user_link", SUM(CASE WHEN Votes.VoteTypeId = 1 THEN 15 WHEN Votes.VoteTypeId = 2 THEN 10 ELSE -2 END) AS EstRep FROM Posts, Votes, Users, Badges WHERE Badges.Name = 'Epic' AND Badges.TagBased = 0 AND Badges.UserId = Users.Id AND Posts.OwnerUserId = Users.Id AND Posts.PostTypeId...
sede
CREATE TABLE TRANSACTIONS ( share_count INTEGER, amount_of_transaction INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the maximum share count of transactions where the amount is smaller than 10000
SELECT MAX(share_count) FROM TRANSACTIONS WHERE amount_of_transaction < 10000
sql_create_context
CREATE TABLE table_name_82 ( height VARCHAR, stories VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How tall is the 52 story building?
SELECT height FROM table_name_82 WHERE stories = 52
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid ...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1457) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-2 year')
mimic_iii
CREATE TABLE table_name_68 ( crowd VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the listed crowd when essendon is the away squad?
SELECT COUNT(crowd) FROM table_name_68 WHERE away_team = "essendon"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51464"
mimicsql_data
CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) -- Using valid SQLite, answer the following questions fo...
SELECT Type, COUNT(*) FROM ship GROUP BY Type
nvbench
CREATE TABLE table_203_762 ( id number, "#" number, "date" text, "film" text, "gross" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the lowest grossing film listed before march 3 , 2002 ?
SELECT "film" FROM table_203_762 WHERE "date" < (SELECT "date" FROM table_203_762 WHERE "date" = 'march 3, 2002') GROUP BY "film" ORDER BY SUM("gross") LIMIT 1
squall
CREATE TABLE table_name_94 ( wins INTEGER, matches VARCHAR, no_result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of wins when there are 14 matches, and the No Result was less than 0?
SELECT AVG(wins) FROM table_name_94 WHERE matches = 14 AND no_result < 0
sql_create_context
CREATE TABLE table_name_35 ( away_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the team score of the away team at Junction Oval?
SELECT away_team AS score FROM table_name_35 WHERE venue = "junction oval"
sql_create_context
CREATE TABLE table_29141354_3 ( scores VARCHAR, episode VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many scores had an episode of 03x06?
SELECT COUNT(scores) FROM table_29141354_3 WHERE episode = "03x06"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Other and unspecified alcohol dependence, unspecified" AND prescriptions.route = "PR"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.icd9_code = "14"
mimicsql_data
CREATE TABLE table_name_68 ( date VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Date has a Record of 4 2 0?
SELECT date FROM table_name_68 WHERE record = "4–2–0"
sql_create_context
CREATE TABLE table_name_70 ( bronze INTEGER, gold VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest Bronze which has a Gold larger than 2 and a Rank of total?
SELECT MAX(bronze) FROM table_name_70 WHERE gold > 2 AND rank = "total"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'naloxone 0.4 mg/1 ml sdv inj' AND patient.uniquepid = '030-30152' AND DATETIME(medication.drugstarttime, 'start of year')...
eicu
CREATE TABLE table_30310 ( "Year Location" text, "Mens Singles" text, "Womens Singles" text, "Mens Doubles" text, "Womens Doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many year locations are there for the womens doubles in jing junhon...
SELECT COUNT("Year Location") FROM table_30310 WHERE "Womens Doubles" = 'Jing Junhong Li Jiawei'
wikisql
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Facilities ( apt_id I...
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female" ORDER BY COUNT(booking_start_date)
nvbench
CREATE TABLE table_name_19 ( country VARCHAR, total VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Country, when Total is less than 148, and when Player is 'Gary Player'?
SELECT country FROM table_name_19 WHERE total < 148 AND player = "gary player"
sql_create_context
CREATE TABLE table_43990 ( "Name" text, "Rating" real, "Comp" real, "Long" real, "Yds/game" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest Comp which has a Yds/game larger than 0, bostick, and a Rating smaller than 91.77?
SELECT MAX("Comp") FROM table_43990 WHERE "Yds/game" > '0' AND "Name" = 'bostick' AND "Rating" < '91.77'
wikisql
CREATE TABLE table_name_68 ( overall_rank INTEGER, heat_rank VARCHAR, lane VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the highest overall rank for heat rank more than 4 and lane less than 2
SELECT MAX(overall_rank) FROM table_name_68 WHERE heat_rank > 4 AND lane < 2
sql_create_context
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id number ) CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text,...
SELECT * FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '27139108' AND hz_info.YLJGDM = '7709781' AND NOT mzjzjlb.JZZDSM LIKE '%(%'
css
CREATE TABLE table_name_22 ( overall INTEGER, name VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Overall, when Name is 'Tim Smiley', and when Round is less than 5?
SELECT SUM(overall) FROM table_name_22 WHERE name = "tim smiley" AND round < 5
sql_create_context
CREATE TABLE grants ( grant_id number, organisation_id number, grant_amount number, grant_start_date time, grant_end_date time, other_details text ) CREATE TABLE organisation_types ( organisation_type text, organisation_type_description text ) CREATE TABLE research_outcomes ( outco...
SELECT staff_details FROM research_staff ORDER BY staff_details
spider
CREATE TABLE table_62140 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT MIN("Goal Difference") FROM table_62140 WHERE "Club" = 'real betis' AND "Wins" < '18'
wikisql
CREATE TABLE table_204_798 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times did imamura place at least 5th ?
SELECT COUNT(*) FROM table_204_798 WHERE "position" <= 5
squall
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE icustays ( ro...
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE table_name_88 ( democrat VARCHAR, lead_margin VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Democrat: Carl Levin, when Lead Margin is 22?
SELECT democrat AS :_carl_levin FROM table_name_88 WHERE lead_margin = 22
sql_create_context
CREATE TABLE table_14754471_1 ( asian___percentage_ VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of Asians are there in the year 2004?
SELECT asian___percentage_ FROM table_14754471_1 WHERE year = 2004
sql_create_context
CREATE TABLE round ( Round_ID int, Member_ID int, Decoration_Theme text, Rank_in_Round int ) CREATE TABLE college ( College_ID int, Name text, Leader_Name text, College_Location text ) CREATE TABLE member ( Member_ID int, Name text, Country text, College_ID int ) -- U...
SELECT Country, COUNT(Country) FROM member GROUP BY Country
nvbench
CREATE TABLE Project_outcomes ( project_id VARCHAR ) CREATE TABLE Projects ( organisation_id VARCHAR, project_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List the organisation id with the maximum outcome count, and the count.
SELECT T1.organisation_id, COUNT(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE table_29775 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What a...
SELECT "High points" FROM table_29775 WHERE "Date" = 'December 10'
wikisql
CREATE TABLE table_name_9 ( construction_completed VARCHAR, listed VARCHAR, deleted VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was construction completed that was listed on 09/21/1984 and a Deleted of 11/04/1999?
SELECT construction_completed FROM table_name_9 WHERE listed = "09/21/1984" AND deleted = "11/04/1999"
sql_create_context
CREATE TABLE torrents ( groupname text, totalsnatched number, artist text, groupyear number, releasetype text, groupid number, id number ) CREATE TABLE tags ( index number, id number, tag text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT groupname, artist FROM torrents
whatcdhiphop
CREATE TABLE table_name_29 ( experience VARCHAR, year_at_cu VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The graduate assistant who was in the 1st year at CU has what experience?
SELECT experience FROM table_name_29 WHERE year_at_cu = "1st" AND position = "graduate assistant"
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_i...
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1561) AND prescriptions.drug = 'ondansetron' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND ...
mimic_iii
CREATE TABLE table_62637 ( "Club" text, "Head Coach" text, "City" text, "Stadium" text, "2002-2003 season" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Head Coach casemiro mior is at which Club?
SELECT "Club" FROM table_62637 WHERE "Head Coach" = 'casemiro mior'
wikisql
CREATE TABLE table_203_2 ( id number, "name" text, "mineral" text, "opened" text, "closed" text, "years connected" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the ffestiniog railway serviced at most how many slate quarries ?...
SELECT COUNT(*) FROM table_203_2 WHERE "mineral" = 'slate'
squall
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE requirement ( requiremen...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'GREEKMOD' AND course.number = 201 AND semester.semester = 'WN' AND semester.semester_id = course...
advising
CREATE TABLE table_49692 ( "Product" text, "Vendor" text, "Edition" text, "Release date" text, "Java EE compatibility" text, "License" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the release date for Eclipse Foundation?
SELECT "Release date" FROM table_49692 WHERE "Vendor" = 'eclipse foundation'
wikisql
CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, wind_speed_mph int ) CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE train ( id int, train_number int, name text, origin text,...
SELECT services, COUNT(services) FROM station GROUP BY services ORDER BY services
nvbench
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-13920'...
eicu
CREATE TABLE table_name_87 ( overall INTEGER, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Overall is the lowest one that has a Round of 3?
SELECT MIN(overall) FROM table_name_87 WHERE round = 3
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.long_title = "Initial insertion of dual-chamber device"
mimicsql_data
CREATE TABLE table_20038 ( "Position" real, "Team" text, "Points" real, "Played" real, "Won" real, "Drawn" real, "Lost" real, "For" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What the highes...
SELECT MAX("Position") FROM table_20038 WHERE "Against" = '28'
wikisql
CREATE TABLE table_65872 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of gold for the country ranked 19?
SELECT SUM("Gold") FROM table_65872 WHERE "Rank" = '19'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDSM = '病理性赌博' AND jyjgzbb.JCZBDM = '294608' UNION SELECT jyjgzbb.CKZFWXX,...
css
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, ...
SELECT Score, ViewCount / '##dV##' AS "views" FROM Posts WHERE PostTypeId = 1 AND Score >= '##S1##' AND Score < '##S2##' AND ViewCount < '##V2##'
sede
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CI...
atis
CREATE TABLE table_37392 ( "Surname" text, "First" text, "D.O.B." text, "Bats" text, "Throws" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Throws have a Position of 3b/rhp?
SELECT "Throws" FROM table_37392 WHERE "Position" = '3b/rhp'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT c.Id AS "comment_link" FROM Comments AS c JOIN Posts AS p ON (p.Id = PostId) WHERE NOT AcceptedAnswerId IS NULL AND c.Score IS NULL AND p.Score > 2 AND (CAST(GETUTCDATE() - c.CreationDate AS INT) > 7) ORDER BY NEWID() LIMIT 10
sede
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Transplant Self Medication Program"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, ...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'pneumothorax - traumatic')
eicu
CREATE TABLE table_29296103_10 ( tournament VARCHAR, week_of VARCHAR, champion VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tournament was on the week of 24 october and champion is matt doyle 1 6, 6 1, 6 2?
SELECT tournament FROM table_29296103_10 WHERE week_of = "24 October" AND champion = "Matt Doyle 1–6, 6–1, 6–2"
sql_create_context
CREATE TABLE table_17326 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What w...
SELECT "Series" FROM table_17326 WHERE "Game" = '5'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "3343"
mimicsql_data
CREATE TABLE table_33956 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What record has a score of 111-96?
SELECT "Record" FROM table_33956 WHERE "Score" = '111-96'
wikisql
CREATE TABLE table_name_31 ( partner VARCHAR, score_in_the_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the partner for the match with a score in the final of 4 6, 6 7?
SELECT partner FROM table_name_31 WHERE score_in_the_final = "4–6, 6–7"
sql_create_context
CREATE TABLE table_21994729_2 ( written_by VARCHAR, prod_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who wore the episode with the production code of 1apx11?
SELECT written_by FROM table_21994729_2 WHERE prod_code = "1APX11"
sql_create_context
CREATE TABLE table_8773 ( "Song" text, "Original Name" text, "Country" text, "Language" text, "Singer(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the original name of the song performed in Swedish?
SELECT "Original Name" FROM table_8773 WHERE "Language" = 'swedish'
wikisql
CREATE TABLE table_name_38 ( erp_w VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If the call sign is w291ch what's the ERP W corresponding to that sign?
SELECT erp_w FROM table_name_38 WHERE call_sign = "w291ch"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patient...
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-39354') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE table_27884 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" real, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which settlement...
SELECT "Settlement" FROM table_27884 WHERE "Cyrillic Name Other Names" = 'Војводинци (Romanian: Voivodinţ)'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465')) AND treatment.treatmentname = 'administration of saline solutio...
eicu
CREATE TABLE table_name_13 ( nationality VARCHAR, pick__number VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Nationality has a Pick # smaller than 130 and a Player of tyler bunz? Question 1
SELECT nationality FROM table_name_13 WHERE pick__number < 130 AND player = "tyler bunz"
sql_create_context
CREATE TABLE table_name_25 ( nor_2 VARCHAR, nor_1 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the nor 2 that has nor 1 as nor 1?
SELECT nor_2 FROM table_name_25 WHERE nor_1 = "nor 1"
sql_create_context
CREATE TABLE table_name_83 ( time VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the time of the NJKF Titans Neo X event?
SELECT time FROM table_name_83 WHERE event = "njkf titans neo x"
sql_create_context
CREATE TABLE table_27545 ( "Authority" text, "Rate or precept" text, "Budget limit (\u00a3m)" text, "Budget plans (\u00a3m)" text, "Rate limit (p)" text, "Rate change (%)" text, "Desired rate (p)" text, "Desired rate change (%)" text ) -- Using valid SQLite, answer the following questi...
SELECT "Rate limit (p)" FROM table_27545 WHERE "Desired rate (p)" = '162'
wikisql
CREATE TABLE table_204_401 ( id number, "rank" number, "lane" number, "name" text, "nationality" text, "react" number, "time" number, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how long did it take elin backman to finish the ...
SELECT "time" FROM table_204_401 WHERE "name" = 'elin backman'
squall
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructo...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NAVARCH' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fal...
advising
CREATE TABLE table_36517 ( "Result" text, "Opponent" text, "Method" text, "Event" text, "Date" text, "Round" text, "Time" text, "Location" text, "Rules" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Opponent has a Round of 3, ...
SELECT "Opponent" FROM table_36517 WHERE "Round" = '3' AND "Time" = 'n/a' AND "Rules" = 'n/a'
wikisql
CREATE TABLE table_name_41 ( jobbik VARCHAR, fidesz VARCHAR, others VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Jobbik percentage with a Fidesz of 61% and others of 2%?
SELECT jobbik FROM table_name_41 WHERE fidesz = "61%" AND others = "2%"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE p...
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE table_23014685_1 ( no INTEGER, area_damaged VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number missile led to damage to the Islamic University campus?
SELECT MIN(no) FROM table_23014685_1 WHERE area_damaged = "Islamic University campus"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '022-30957' AND DATETIME(patient.hospitaldischargetime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.hospitaldischargetime DESC LIMIT 1
eicu
CREATE TABLE table_49431 ( "Date" text, "Time" text, "Home" text, "Geust" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the home of the match with a 0:2 result on 21.10.07?
SELECT "Home" FROM table_49431 WHERE "Result" = '0:2' AND "Date" = '21.10.07'
wikisql
CREATE TABLE table_31703 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rounds did the IFL: Oakland event have?
SELECT SUM("Round") FROM table_31703 WHERE "Event" = 'ifl: oakland'
wikisql
CREATE TABLE table_37907 ( "Celebrity" text, "Famous for" text, "Entered" text, "Exited" text, "Finished" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did camilla dallerup finish?
SELECT "Finished" FROM table_37907 WHERE "Celebrity" = 'camilla dallerup'
wikisql
CREATE TABLE table_18342 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many incumbents are there in district Louisiana 5?
SELECT COUNT("Incumbent") FROM table_18342 WHERE "District" = 'Louisiana 5'
wikisql
CREATE TABLE table_22174 ( "Episodes" text, "Monday" text, "Tuesday" text, "Wednesday" text, "Thursday" text, "Friday" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Tuesday episode if theThursday episode was 196 Buried?
SELECT "Tuesday" FROM table_22174 WHERE "Thursday" = '196 Buried'
wikisql
CREATE TABLE table_35926 ( "Game #" real, "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date does visiting team Minnesota score higher than 47 points?
SELECT "Date" FROM table_35926 WHERE "Points" > '47' AND "Visitor" = 'minnesota'
wikisql
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, X...
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM jybgb JOIN jyjgzbb ON jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE jybgb.JZLSH = '42183982937' AND jyjgzbb.JCRXM LIKE '尤%'
css
CREATE TABLE table_26492 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided a...
SELECT "Original air date" FROM table_26492 WHERE "Production code" = '216'
wikisql
CREATE TABLE stock ( shop_id number, device_id number, quantity number ) CREATE TABLE device ( device_id number, device text, carrier text, package_version text, applications text, software_platform text ) CREATE TABLE shop ( shop_id number, shop_name text, location tex...
SELECT shop_name FROM shop ORDER BY open_year DESC LIMIT 1
spider
CREATE TABLE table_29626583_3 ( mls_team VARCHAR, position VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team has a midfielder of konrad warzycha?
SELECT mls_team FROM table_29626583_3 WHERE position = "Midfielder" AND player = "Konrad Warzycha"
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.short_title = "Enthesopathy of hip"
mimicsql_data
CREATE TABLE table_name_42 ( stream_s__and___or_lake_s_ VARCHAR, date_founded VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the stream(s) and / or lake(s) when the date founded is 1959?
SELECT stream_s__and___or_lake_s_ FROM table_name_42 WHERE date_founded = 1959
sql_create_context
CREATE TABLE table_43653 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent in a week below 3 on September 23, 1960?
SELECT "Opponent" FROM table_43653 WHERE "Week" < '3' AND "Date" = 'september 23, 1960'
wikisql
CREATE TABLE table_30181 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who wrote the episode titl...
SELECT "Written by" FROM table_30181 WHERE "Title" = 'Red''s Birthday'
wikisql
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 ) CREATE TABLE university ( Scho...
SELECT Team_Name, School_ID FROM basketball_match ORDER BY Team_Name DESC
nvbench
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text...
SELECT YR_WK, COUNT(*) AS NumActiveExperts FROM (SELECT (TIME_TO_STR(p.CreationDate, '%y') + (TIME_TO_STR(p.CreationDate, '%W') - 1) / 52.0) AS YR_WK, u.Id AS UID, COUNT(*) AS NumAnswers FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id AND p.PostTypeId = 2 AND p.Score > 0 GROUP BY (TIME_TO_STR(p.CreationDa...
sede
CREATE TABLE table_name_60 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game on 19/3/00?
SELECT score FROM table_name_60 WHERE date = "19/3/00"
sql_create_context
CREATE TABLE table_203_116 ( id number, "no." number, "player" text, "birth date" text, "weight" number, "height" number, "position" text, "current club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many players are middle blockers...
SELECT COUNT("player") FROM table_203_116 WHERE "position" = 'middle blocker'
squall
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostHistory ( Id number, ...
SELECT u.Id AS "user_link", COUNT(p.Id) AS Questions FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE p.PostTypeId = 1 AND NOT EXISTS(SELECT q.Id FROM Posts AS q WHERE q.OwnerUserId = u.Id AND NOT q.AcceptedAnswerId IS NULL) GROUP BY u.Id ORDER BY COUNT(p.Id) DESC
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '李高飞' AND gwyjzb.MED_SER_ORG_NO = '5668122' AND gwyjzb.OUT_DIAG_DIS_NM LIKE '%硬化性%' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '李高飞' AND fgwyjzb.MED_SER_ORG_NO = '5668122' AND fgwyjzb.OUT_DIAG_DIS_NM LIKE '%硬化性%'
css
CREATE TABLE table_name_39 ( internet_explorer VARCHAR, firefox VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of browsers were using Internet Explorer during the period in which 27.85% were using Firefox?
SELECT internet_explorer FROM table_name_39 WHERE firefox = "27.85%"
sql_create_context