instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'anterior rect resect nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82235)
mimic_iii
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, require...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'RCLANG' AND course.number = 191 AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2013
advising
CREATE TABLE table_46186 ( "Fin. Pos" text, "Car No." text, "Driver" text, "Team" text, "Laps" text, "Time/Retired" text, "Grid" text, "Laps Led" text, "Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What grid did the team ra...
SELECT "Grid" FROM table_46186 WHERE "Team" = 'racing professionals'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
SELECT T1.FIRST_NAME, T1.MANAGER_ID FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.EMPLOYEE_ID = T2.MANAGER_ID ORDER BY T1.MANAGER_ID
nvbench
CREATE TABLE table_44598 ( "Region" text, "Date" text, "Label" text, "Catalog" text, "Format" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the catalog when the label was frontiers records?
SELECT "Catalog" FROM table_44598 WHERE "Label" = 'frontiers records'
wikisql
CREATE TABLE table_2768 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the episode where the season number...
SELECT "Title" FROM table_2768 WHERE "No. in season" = '13'
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.days_stay > "5"
mimicsql_data
CREATE TABLE table_41626 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Bike with a grid more than 4 and the rider is Michel Fabrizio?
SELECT "Bike" FROM table_41626 WHERE "Grid" > '4' AND "Rider" = 'michel fabrizio'
wikisql
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 DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = 'alt (sgpt)')
eicu
CREATE TABLE table_203_621 ( id number, "player" text, "games played" number, "minutes played" number, "minutes played per game" number, "rebounds" number, "rebounds per game" number, "assists" number, "assists per game" number, "field goal %" number, "free throw %" number, ...
SELECT "player" FROM table_203_621 WHERE "player" IN ('larry johnson', 'charlie ward') ORDER BY "points" DESC LIMIT 1
squall
CREATE TABLE table_29939 ( "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 i...
SELECT "Record" FROM table_29939 WHERE "Date" = 'January 7'
wikisql
CREATE TABLE table_7708 ( "Draw" real, "Artist" text, "Song" text, "Televote" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What draw average has a televote less than 633 and Vilma Voroblevait as artist and the place is greater than 1...
SELECT AVG("Draw") FROM table_7708 WHERE "Televote" < '633' AND "Artist" = 'vilma voroblevaitė' AND "Place" > '14'
wikisql
CREATE TABLE table_name_19 ( opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent on November 12, 1972?
SELECT opponent FROM table_name_19 WHERE date = "november 12, 1972"
sql_create_context
CREATE TABLE table_name_12 ( years_as_tallest VARCHAR, street_address VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the Years as tallest with a Street address of 324 E. 11th Street?
SELECT years_as_tallest FROM table_name_12 WHERE street_address = "324 e. 11th street"
sql_create_context
CREATE TABLE projects ( code text, name text, hours number ) CREATE TABLE scientists ( ssn number, name text ) CREATE TABLE assignedto ( scientist number, project text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the names of project...
SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)
spider
CREATE TABLE table_15011 ( "Category" text, "Film" text, "Director(s)" text, "Producer(s)" text, "Writer(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what category is for tom shankland, director?
SELECT "Category" FROM table_15011 WHERE "Director(s)" = 'tom shankland'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.IN_HOSP_DAYS FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '43389483198'
css
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT PER_EXP FROM t_kc24 WHERE MED_CLINIC_ID = '34278260566'
css
CREATE TABLE table_40446 ( "Season" text, "Games" real, "Lost" real, "Tied" text, "Points" real, "Pct %" real, "Goals for" real, "Goals against" real, "Penalty minutes" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many goals ag...
SELECT SUM("Goals against") FROM table_40446 WHERE "Games" = '64' AND "Lost" < '12' AND "Points" > '107'
wikisql
CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40),...
SELECT Investor_details, COUNT(Investor_details) FROM Investors GROUP BY Investor_details ORDER BY COUNT(Investor_details) DESC
nvbench
CREATE TABLE table_name_20 ( engine VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 0-100km/h (62mph) of the supercharged 5.4l v8 engine?
SELECT 0 AS _100km_h__62mph_ FROM table_name_20 WHERE engine = "supercharged 5.4l v8"
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number, subject_id number, ...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9299) AND microbiologyevents.spec_type_desc = 'stool' AND NOT microbiologyevents.org_name IS NULL AND STRFTIME('%y-%m', microbiologyevents.charttime) >= '2103-03' ORDE...
mimic_iii
CREATE TABLE table_204_866 ( id number, "name" text, "lifetime" text, "nationality" text, "notable as" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who is the first pop musician on this list ?
SELECT "name" FROM table_204_866 WHERE "notable as" = 'pop musician' ORDER BY id LIMIT 1
squall
CREATE TABLE table_203_308 ( id number, "athlete" text, "nation" text, "olympics" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who has won more medals ? shaun white or ke...
SELECT "athlete" FROM table_203_308 WHERE "athlete" IN ('shaun white', 'kelly clark') ORDER BY "total" DESC LIMIT 1
squall
CREATE TABLE table_1701371_2 ( char_cells VARCHAR, hardware_colours VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If hardware colours is 8 what would the char cells be?
SELECT char_cells FROM table_1701371_2 WHERE hardware_colours = 8
sql_create_context
CREATE TABLE table_22472 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" text, "Water (sqmi)" text, "Latitude" text, "Longitude" text, "GEO ID" real, "ANSI code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT MAX("Pop. (2010)") FROM table_22472 WHERE "Latitude" = '48.676125'
wikisql
CREATE TABLE table_name_41 ( player VARCHAR, years_for_rockets VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player played for the Rockets in 2002-03?
SELECT player FROM table_name_41 WHERE years_for_rockets = "2002-03"
sql_create_context
CREATE TABLE table_name_81 ( game VARCHAR, location VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which game is located in Boston Garden and has a record of 49-17?
SELECT game FROM table_name_81 WHERE location = "boston garden" AND record = "49-17"
sql_create_context
CREATE TABLE table_72692 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text, "Pictorials" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the Kymberly Paige the Centerfold?
SELECT "Date" FROM table_72692 WHERE "Centerfold model" = 'Kymberly Paige'
wikisql
CREATE TABLE table_name_2 ( engine VARCHAR, team VARCHAR, year VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What engine was used by Curb Motorsports after 1982 that had 11 points?
SELECT engine FROM table_name_2 WHERE year > 1982 AND points = 11 AND team = "curb motorsports"
sql_create_context
CREATE TABLE table_203_77 ( id number, "album title" text, "format" text, "year" number, "original label" text, "chart positions" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many albums garnered chart positions ?
SELECT COUNT("album title") FROM table_203_77 WHERE NOT "chart positions" IS NULL
squall
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id ...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20862) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents...
mimic_iii
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id 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, ...
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '孙咏歌' AND hz_info.YLJGDM = '0919539' AND NOT mzjzjlb.JZZDSM LIKE '%抽动%'
css
CREATE TABLE table_75727 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" text, "Acquisition via" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What season had Marcio Lassiter?
SELECT "Season" FROM table_75727 WHERE "Name" = 'marcio lassiter'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "54" AND prescriptions.drug = "Sodium Chloride 0.9% Flush"
mimicsql_data
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labev...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE STRFTIME('%y', inputevents_cv.charttime) = '2100' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 3)
mimic_iii
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE month ( ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((days.day_name = 'THURSDAY' AND flight.departure_time < 1200 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code A...
atis
CREATE TABLE table_63641 ( "Model number" text, "sSpec number" text, "Frequency" text, "Turbo" text, "Cores" real, "L2 cache" text, "L3 cache" text, "I/O bus" text, "Mult." text, "Memory" text, "Voltage" text, "Socket" text, "Release date" text, "Part number(s)" t...
SELECT "Release date" FROM table_63641 WHERE "sSpec number" = 'slbeq(d0)'
wikisql
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number ...
SELECT COUNT(DISTINCT course.course_id) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_lab = 'Y' AND program_course.category LIKE '%ULCS%'
advising
CREATE TABLE table_3034 ( "Borough" text, "County" text, "Franchise type" text, "Members" real, "Voters in 1800" real, "Times contested" real, "Fate in 1832" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of members that h...
SELECT COUNT("Members") FROM table_3034 WHERE "Borough" = 'Bandon Bridge'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT demographic.admission_location, prescriptions.drug_type FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "81254"
mimicsql_data
CREATE TABLE table_name_8 ( end_date VARCHAR, governor VARCHAR, term VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the end date of the term for Governor of richard j. oglesby, and a Term of 1885 1889?
SELECT end_date FROM table_name_8 WHERE governor = "richard j. oglesby" AND term = "1885–1889"
sql_create_context
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT MED_ORG_DEPT_CD, IN_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '9224891' GROUP BY MED_ORG_DEPT_CD, IN_DIAG_DIS_NM
css
CREATE TABLE table_name_52 ( home_team VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE HOME TEAM ON APRIL 25?
SELECT home_team FROM table_name_52 WHERE date = "april 25"
sql_create_context
CREATE TABLE table_19061741_1 ( season VARCHAR, duration VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When day 8-36 is the duration what is the season?
SELECT season FROM table_19061741_1 WHERE duration = "Day 8-36"
sql_create_context
CREATE TABLE table_59489 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the status for the opposing team South Africa?
SELECT "Status" FROM table_59489 WHERE "Opposing Teams" = 'south africa'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE lab ( labid numbe...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-188709')) AND NOT vitalperiodic.sao2 IS NULL AN...
eicu
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc24.t_kc21_MED_ORG_DEPT_CD, t_kc24.t_kc21_IN_DIAG_DIS_CD, MIN(t_kc24.ILL_PAY) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '1518558' GROUP BY t_kc24.t_kc21_MED_ORG_DEPT_CD, t_kc24.t_kc21_IN_DIAG_DIS_CD
css
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number, ...
SELECT t1.culturesite FROM (SELECT microlab.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microlab GROUP BY microlab.culturesite) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE program ( Program_ID int, Name text, Origin text, Launch real, Owner text ) CREATE TABLE broadcast_share ( Channel_ID int, Program_ID int, Date text, Share_in_percent real ) CREATE TABLE channel ( Channel_ID int, Name text, Owner text, Share_in_percent ...
SELECT Owner, SUM(Rating_in_percent) FROM channel GROUP BY Owner ORDER BY SUM(Rating_in_percent)
nvbench
CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE affected_region ( region_id number, storm_id nu...
SELECT name, damage_millions_usd FROM storm ORDER BY max_speed DESC
spider
CREATE TABLE table_name_82 ( origin VARCHAR, owner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the origin for the item with an owner of Hunan Broadcasting System (HBS)?
SELECT origin FROM table_name_82 WHERE owner = "hunan broadcasting system (hbs)"
sql_create_context
CREATE TABLE table_6689 ( "Average population (x 1000)" text, "Live births" text, "Deaths" text, "Natural change" text, "Crude birth rate (per 1000)" real, "Crude death rate (per 1000)" real, "Natural change (per 1000)" real ) -- Using valid SQLite, answer the following questions for the t...
SELECT "Live births" FROM table_6689 WHERE "Natural change (per 1000)" < '14.3' AND "Deaths" = '104 000'
wikisql
CREATE TABLE table_name_71 ( ihsaa_football_class VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which IHSAA Football Class has a School of wood memorial?
SELECT ihsaa_football_class FROM table_name_71 WHERE school = "wood memorial"
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, Rejecti...
SELECT Id, TagName FROM Tags
sede
CREATE TABLE county_public_safety ( County_ID int, Name text, Population int, Police_officers int, Residents_per_officer int, Case_burden int, Crime_rate real, Police_force text, Location text ) CREATE TABLE city ( City_ID int, County_ID int, Name text, White real, ...
SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force ORDER BY COUNT(*)
nvbench
CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) ) CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ...
SELECT Project_ID, COUNT(*) FROM Documents GROUP BY Project_ID
nvbench
CREATE TABLE table_name_73 ( fa_cup_apps VARCHAR, league_apps VARCHAR, total_goals VARCHAR, league_cup_goals VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the FA Cup Apps when total goals is smaller than 4, League Cup Goals is 0, and League ...
SELECT fa_cup_apps FROM table_name_73 WHERE total_goals < 4 AND league_cup_goals = 0 AND league_apps = "8 (10)"
sql_create_context
CREATE TABLE table_7624 ( "Sign" text, "Element" text, "Qualities" text, "Season: North" text, "Season: South" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the south season of the scorpio sign, which has cold & wet qualities?
SELECT "Season: South" FROM table_7624 WHERE "Qualities" = 'cold & wet' AND "Sign" = 'scorpio'
wikisql
CREATE TABLE exhibition ( ticket_price INTEGER, YEAR INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.
SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009
sql_create_context
CREATE TABLE table_3240 ( "Name of Bowl" text, "Record" text, "Appearances" real, "Last Appearance" text, "Winning %" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the last appearance for music city bowl
SELECT "Last Appearance" FROM table_3240 WHERE "Name of Bowl" = 'Music City Bowl'
wikisql
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND...
css
CREATE TABLE table_name_47 ( oppose VARCHAR, unsure VARCHAR, poll_source VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of people were opposed to the candidate based on the WNBC/Marist poll that showed 8% of people were unsure?
SELECT oppose FROM table_name_47 WHERE unsure = "8%" AND poll_source = "wnbc/marist poll"
sql_create_context
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE fare ( fa...
SELECT DISTINCT city.city_code FROM airport, airport_service, city WHERE airport.airport_code = 'MCO' AND airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code
atis
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admityear < "2182"
mimicsql_data
CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE city ( city_code varchar, ...
SELECT DISTINCT aircraft_code FROM aircraft WHERE basic_type = 'F28'
atis
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM txmzjzjlb JOIN jybgb JOIN jyjgzbb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE txmzjzjlb.JZZDSM = '口齿病(龋齿病)' AND jyjgzbb.JCZBDM = '559847' UNION SELECT jyjgzbb.CKZFW...
css
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "UNKNOWN/NOT SPECIFIED" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE"
mimicsql_data
CREATE TABLE table_14858 ( "Round" real, "Overall" real, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What round did the overall pick of 91 occur in the 1982 NFL draft?
SELECT MIN("Round") FROM table_14858 WHERE "Overall" = '91'
wikisql
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4284766' AND gwyjzb.IN_HOSP_DATE BETWEEN '2001-10-30' AND '2003-12-06' AND gwyjzb.REMOTE_SETTLE_FLG = '异地1' OR gwyjzb.REMOTE_SETTLE_FLG = '异地2' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4284766' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2001-10...
css
CREATE TABLE table_15831 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-25" real, "Events" real, "Cuts made" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the top-5 when the tournament is totals and the top-25 is more than 4?
SELECT AVG("Top-5") FROM table_15831 WHERE "Tournament" = 'totals' AND "Top-25" > '4'
wikisql
CREATE TABLE table_5350 ( "Nation" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Third has a Lead of zanda bik e?
SELECT "Third" FROM table_5350 WHERE "Lead" = 'zanda bikše'
wikisql
CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER ) CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) CREATE TABLE Parts (...
SELECT skill_description, COUNT(skill_description) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY other_details, skill_description ORDER BY skill_description DESC
nvbench
CREATE TABLE table_203_754 ( id number, "no." number, "player" text, "position" text, "career" text, "date no. retired" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how long was gretzky 's career ?
SELECT "career" - "career" FROM table_203_754 WHERE "player" = 'wayne gretzky'
squall
CREATE TABLE table_70562 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest points value for 1962, in the 125cc class, and with 0 wins?
SELECT MAX("Points") FROM table_70562 WHERE "Year" = '1962' AND "Class" = '125cc' AND "Wins" < '0'
wikisql
CREATE TABLE table_63268 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Dolphins points" real, "Opponents" real, "Record" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Opponents in the game w...
SELECT MIN("Opponents") FROM table_63268 WHERE "Date" = 'nov. 25'
wikisql
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "SDH"
mimicsql_data
CREATE TABLE table_62917 ( "Date Released" text, "Institute" text, "Social Democratic" text, "Socialist" text, "Green-Communist" text, "People's Party" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Green-Communist ...
SELECT "Green-Communist" FROM table_62917 WHERE "Socialist" = '41.0%'
wikisql
CREATE TABLE table_13702 ( "Year" real, "Labour" real, "Lib Dem" real, "Green" real, "IWCA" real, "Independent" real, "Conservative" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest Labour with Lib Dem larger than 21?
SELECT MAX("Labour") FROM table_13702 WHERE "Lib Dem" > '21'
wikisql
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 COUNT(*) FROM gwyjzb WHERE gwyjzb.PERSON_ID = '46058434' AND gwyjzb.IN_HOSP_DATE BETWEEN '2013-02-11' AND '2014-03-22' AND gwyjzb.CLINIC_TYPE = '住院' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '46058434' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2013-02-11' AND '2014-03-22' AND fgwyjzb.CLINIC_TYPE = '住院...
css
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "MORP0.5-4"
mimicsql_data
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) 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 re...
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex
nvbench
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
mimic_iii
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD...
SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc21_t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4152205' AND t_kc21.IN_DIAG_DIS_NM = '精神分裂症')
css
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '63342045' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2007-08-10')
css
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.label = "pCO2"
mimicsql_data
CREATE TABLE table_13803 ( "Year" text, "Game" text, "Genre" text, "Platform(s)" text, "Developer(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the genre is fighting what is the game?
SELECT "Game" FROM table_13803 WHERE "Genre" = 'fighting'
wikisql
CREATE TABLE table_123462_2 ( _number_of_total_votes INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest # of total votes?
SELECT MIN(_number_of_total_votes) FROM table_123462_2
sql_create_context
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT zzmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zzmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE person_info.XM = '韦坚秉' AND NOT zzmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2001-02-2...
css
CREATE TABLE table_name_24 ( position VARCHAR, points VARCHAR, drawn VARCHAR, lost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number for the position that has less than 2 draws, less than 9 losses and more than 24?
SELECT COUNT(position) FROM table_name_24 WHERE drawn < 2 AND lost < 9 AND points > 24
sql_create_context
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '姜淑华' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 2959.88)
css
CREATE TABLE table_203_481 ( id number, "n\u00b0" number, "name" text, "position" text, "date of birth" text, "nationality" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total names are listed as having french nationality ?
SELECT COUNT("name") FROM table_203_481 WHERE "nationality" = 'france'
squall
CREATE TABLE table_32069 ( "Place" real, "Team" text, "Wins" real, "Ties" real, "Losses" real, "Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the sum of place with ties larger than 0 and point sof 7 qc and losses more than 2
SELECT SUM("Place") FROM table_32069 WHERE "Ties" > '0' AND "Points" = '7 qc' AND "Losses" > '2'
wikisql
CREATE TABLE table_46514 ( "Event" text, "Score" real, "Name" text, "Nation" text, "Games" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total score for the 36 arrow finals event?
SELECT COUNT("Score") FROM table_46514 WHERE "Event" = '36 arrow finals'
wikisql
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, ...
WITH FirstPosts AS (SELECT P.*, (CASE WHEN P.PostTypeId = 1 THEN 1 ELSE 0 END) AS "isquestion", (CASE WHEN P.Tags LIKE @Pattern THEN 1 ELSE 0 END) AS "isid" FROM Users AS U INNER JOIN Posts AS P ON P.OwnerUserId = U.Id AND (P.PostTypeId = 1 OR P.PostTypeId = 2) AND NOT EXISTS(SELECT * FROM Posts AS Q WHERE Q.OwnerUserI...
sede
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_57815 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent in the final on a hard surface with a score of 6 3 7 6(5)?
SELECT "Opponent in the final" FROM table_57815 WHERE "Surface" = 'hard' AND "Score" = '6–3 7–6(5)'
wikisql
CREATE TABLE table_36930 ( "Name" text, "GP-GS" text, "Effic" real, "Cmp-Att-Int" text, "Avg/G" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Effic is the average one that has an Avg/G larger than 3.7, and a GP-GS of 13, and a Cmp-Att-Int of ...
SELECT AVG("Effic") FROM table_36930 WHERE "Avg/G" > '3.7' AND "GP-GS" = '13' AND "Cmp-Att-Int" = '318-521-15'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Name, MIN(Price) FROM Products GROUP BY Name ORDER BY Name
nvbench