instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '7999719' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_D...
css
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_ci...
SELECT product_name, COUNT(*) FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name
nvbench
CREATE TABLE table_42289 ( "Rank" real, "Player" text, "Country" text, "Earnings( $ )" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest rank which earned 24,920,665?
SELECT MIN("Rank") FROM table_42289 WHERE "Earnings( $ )" = '24,920,665'
wikisql
CREATE TABLE table_22282917_26 ( dates VARCHAR, control_site_condition_owner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When is every date that control site condition or owner is machine shop on Martin Dr.?
SELECT dates FROM table_22282917_26 WHERE control_site_condition_owner = "machine shop on Martin Dr."
sql_create_context
CREATE TABLE operate_company ( id int, name text, Type text, Principal_activities text, Incorporated_in text, Group_Equity_Shareholding real ) CREATE TABLE airport ( id int, City text, Country text, IATA text, ICAO text, name text ) CREATE TABLE flight ( id int, ...
SELECT Country, COUNT(*) FROM airport GROUP BY Country ORDER BY Country
nvbench
CREATE TABLE table_52488 ( "Driver" text, "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the chassis for entrant of ecurie lutetia
SELECT "Chassis" FROM table_52488 WHERE "Entrant" = 'ecurie lutetia'
wikisql
CREATE TABLE table_51340 ( "Record" text, "Hard" text, "Clay" text, "Grass" text, "Carpet" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which clay has a Record of 2 0, and a Hard 1 0?
SELECT "Clay" FROM table_51340 WHERE "Record" = '2–0' AND "Hard" = '1–0'
wikisql
CREATE TABLE table_68801 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In 2010, who was the Women's Singles player?
SELECT "Women's singles" FROM table_68801 WHERE "Year" = '2010'
wikisql
CREATE TABLE table_name_96 ( location VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is the location of a team with a 3-2 record?
SELECT location FROM table_name_96 WHERE record = "3-2"
sql_create_context
CREATE TABLE table_name_87 ( loss VARCHAR, avg_g INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Loss has an Avg/G larger than 129.2?
SELECT COUNT(loss) FROM table_name_87 WHERE avg_g > 129.2
sql_create_context
CREATE TABLE table_204_117 ( id number, "season" number, "level" text, "division" text, "section" text, "position" text, "movements" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is division 2 listed as the division ?
SELECT COUNT(*) FROM table_204_117 WHERE "division" = 'division 2'
squall
CREATE TABLE table_name_63 ( avg_g INTEGER, effic VARCHAR, cmp_att_int VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Avg/G has an Effic larger than 129.73, and a Cmp-Att-Int of 333-500-13?
SELECT SUM(avg_g) FROM table_name_63 WHERE effic > 129.73 AND cmp_att_int = "333-500-13"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'immune thr...
mimic_iii
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT MIN(OwnerUserId), MIN(Id) AS QuestionId FROM Posts WHERE PostTypeId = 1 GROUP BY OwnerUserId
sede
CREATE TABLE school_bus ( School_ID int, Driver_ID int, Years_Working int, If_full_time bool ) CREATE TABLE driver ( Driver_ID int, Name text, Party text, Home_city text, Age int ) CREATE TABLE school ( School_ID int, Grade text, School text, Location text, Type...
SELECT Name, Age FROM driver ORDER BY Name
nvbench
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE diagnoses ( 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 demographic.gender, prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_name_42 ( lost INTEGER, name VARCHAR, drawn VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many losses did ev bruckberg have when the drawn was more than 1?
SELECT SUM(lost) FROM table_name_42 WHERE name = "ev bruckberg" AND drawn > 1
sql_create_context
CREATE TABLE table_74604 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people in the crowd with north melbourn...
SELECT SUM("Crowd") FROM table_74604 WHERE "Away team" = 'north melbourne'
wikisql
CREATE TABLE table_train_272 ( "id" int, "fasting_plasma_glucose_fpg" float, "creatinine_clearance_cl" float, "baseline_hemoglobin_hgb" float, "sensitization_on_pra" bool, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- ...
SELECT * FROM table_train_272 WHERE creatinine_clearance_cl < 60
criteria2sql
CREATE TABLE table_name_30 ( time_retired VARCHAR, driver VARCHAR, constructor VARCHAR, grid VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the time/retired of Driver Masten Gregory Carroll Shelby when the constructor was Ma...
SELECT time_retired FROM table_name_30 WHERE grid > 10 AND laps > 2 AND constructor = "maserati" AND driver = "masten gregory carroll shelby"
sql_create_context
CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) ) CREATE TABLE Students ( stud...
SELECT author_tutor_ATB, gender_mf FROM Course_Authors_and_Tutors ORDER BY personal_name
nvbench
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "HYDROmorphone (Dilaudid)" AND prescriptions.route = "PO"
mimicsql_data
CREATE TABLE table_29587 ( "Represent" real, "Contestant" text, "Age" real, "Sizes" text, "Height" text, "Hometown" text, "Agency" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which company has a person that can wear clothing in 33-23-36
SELECT "Agency" FROM table_29587 WHERE "Sizes" = '33-23-36'
wikisql
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 cost ( costid number, uniquepid text,...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
eicu
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 WHERE demographic.gender = "M" AND demographic.days_stay > "4"
mimicsql_data
CREATE TABLE table_14206 ( "Candidate" text, "Background" text, "Original Team" text, "Hometown" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Original Team of the Clothing Company Owner Candidate?
SELECT "Original Team" FROM table_14206 WHERE "Background" = 'clothing company owner'
wikisql
CREATE TABLE table_name_58 ( authority VARCHAR, gender VARCHAR, area VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What authority is the coed school in pinehaven?
SELECT authority FROM table_name_58 WHERE gender = "coed" AND area = "pinehaven"
sql_create_context
CREATE TABLE table_name_91 ( april_28 VARCHAR, final VARCHAR, mar_17 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the April 28th rank when the Final is 20, and Mar 17 is 22?
SELECT april_28 FROM table_name_91 WHERE final = "20" AND mar_17 = "22"
sql_create_context
CREATE TABLE table_42081 ( "Team" text, "Tries for" real, "Tries against" real, "Try diff" text, "Points for" real, "Points against" real, "Points diff" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Points against has Tries for sma...
SELECT AVG("Points against") FROM table_42081 WHERE "Tries for" < '14' AND "Team" = 'llanelli'
wikisql
CREATE TABLE table_13057 ( "Season" text, "League" text, "Teams" text, "Home" text, "Away" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the away when the home is 3-2, and the season is 1959-60?
SELECT "Away" FROM table_13057 WHERE "Home" = '3-2' AND "Season" = '1959-60'
wikisql
CREATE TABLE table_name_83 ( period_active VARCHAR, release_year_of_first_charted_record VARCHAR, genre VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the period of a rock album released in 1973?
SELECT period_active FROM table_name_83 WHERE release_year_of_first_charted_record = 1973 AND genre = "rock"
sql_create_context
CREATE TABLE table_11162 ( "Difficulty Value" text, "1d10 Resolution (+5)" real, "3d6 or 1d20 Resolution (+10)" real, "+1d6-1d6 or +1d10-1d10 (+0)" real, "+1d12 (6)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest +1d12 (6) with a ...
SELECT MIN("+1d12 (6)") FROM table_11162 WHERE "Difficulty Value" = 'competent (dv 8)' AND "1d10 Resolution (+5)" > '13'
wikisql
CREATE TABLE table_name_65 ( opponent_in_the_final VARCHAR, score_in_the_final VARCHAR, surface VARCHAR, outcome VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Opponent in the final has an Outcome of winner, and a Date larger ...
SELECT opponent_in_the_final FROM table_name_65 WHERE outcome = "winner" AND date > 1992 AND surface = "clay" AND score_in_the_final = "3–6, 6–2, 6–1"
sql_create_context
CREATE TABLE table_204_737 ( id number, "year" number, "order" text, "quantity" number, "ger nos." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- were there more n31 or e34 ordered ?
SELECT "order" FROM table_204_737 WHERE "order" IN ('n31', 'e34') ORDER BY "quantity" DESC LIMIT 1
squall
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12410) AND microbiologyevents.spec_type_desc = 'sputum' ORDER BY microbiologyevents.charttime LIMIT 1
mimic_iii
CREATE TABLE table_name_28 ( date VARCHAR, serial VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which date has serial of 11c?
SELECT date FROM table_name_28 WHERE serial = "11c"
sql_create_context
CREATE TABLE table_2671 ( "Event" text, "Season" text, "Compulsory Dance (CD)" text, "Original Dance (OD)" text, "Free Dance (FD)" text, "Combined Total Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what event was the compulsory dance...
SELECT "Event" FROM table_2671 WHERE "Compulsory Dance (CD)" = '28.12'
wikisql
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DETROIT' AND ground_service.city_code = city.city_code
atis
CREATE TABLE gymnast ( Gymnast_ID int, Floor_Exercise_Points real, Pommel_Horse_Points real, Rings_Points real, Vault_Points real, Parallel_Bars_Points real, Horizontal_Bar_Points real, Total_Points real ) CREATE TABLE people ( People_ID int, Name text, Age real, Height ...
SELECT Hometown, COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY Hometown DESC
nvbench
CREATE TABLE table_55445 ( "Name" text, "Latitude" real, "Longitude" real, "Diameter (km)" real, "Named after" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What in Xenia's Diameter in km, with a latitude of 14 and a longitude of 249.4?
SELECT COUNT("Diameter (km)") FROM table_55445 WHERE "Latitude" < '14' AND "Name" = 'xenia' AND "Longitude" > '249.4'
wikisql
CREATE TABLE table_27095 ( "Week" real, "Date" text, "Kickoff" text, "Opponent" text, "Final score" text, "Team record" text, "Game site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the final score on Satur...
SELECT "Final score" FROM table_27095 WHERE "Date" = 'Saturday, May 25'
wikisql
CREATE TABLE table_54802 ( "PRR Class" text, "Builder\u2019s Model" text, "Build date" text, "Total produced" real, "Wheel arrangement" text, "Service" text, "Power output" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the model fo...
SELECT "Builder\u2019s Model" FROM table_54802 WHERE "Service" = 'freight' AND "PRR Class" = 'gf28a'
wikisql
CREATE TABLE table_71890 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record of the match that had a time of...
SELECT "Record" FROM table_71890 WHERE "Time" = '1:44'
wikisql
CREATE TABLE table_1342256_32 ( candidates VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who are the contenders In the New York 19 polling area race?
SELECT candidates FROM table_1342256_32 WHERE district = "New York 19"
sql_create_context
CREATE TABLE table_16575609_3 ( cfl_team VARCHAR, pick__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many cfl teams had pick # 21?
SELECT COUNT(cfl_team) FROM table_16575609_3 WHERE pick__number = 21
sql_create_context
CREATE TABLE table_24177 ( "Episode" text, "Broadcast date" text, "Run time" text, "Viewers (in millions)" text, "Archive" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the broadcast date of run time being 24:14
SELECT "Broadcast date" FROM table_24177 WHERE "Run time" = '24:14'
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 T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC
nvbench
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
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, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_pro...
mimic_iii
CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_sal...
SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> "null" GROUP BY department_id
spider
CREATE TABLE product_categories ( production_type_code text, product_type_description text, vat_rating number ) CREATE TABLE accounts ( account_id number, customer_id number, date_account_opened time, account_name text, other_account_details text ) CREATE TABLE orders ( order_id nu...
SELECT T1.account_id, T2.account_name FROM financial_transactions AS T1 JOIN accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING COUNT(*) >= 4
spider
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH te...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jybgb_jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JY...
css
CREATE TABLE table_70268 ( "Name" text, "League" real, "Play-offs" real, "FA Cup" real, "League Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the highest League Cup with an FA Cup thats larger than 2?
SELECT MAX("League Cup") FROM table_70268 WHERE "FA Cup" > '2'
wikisql
CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int ) -- Using valid SQLite, answer the following questions ...
SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID ORDER BY T2.Height DESC
nvbench
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
SELECT DISTINCT name, number FROM course WHERE credits = 14 AND department = 'EECS'
advising
CREATE TABLE employees ( department_id VARCHAR, salary INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- display the department id and the total salary for those departments which contains at least two employees.
SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) >= 2
sql_create_context
CREATE TABLE made_by ( id int, msid int, pid int ) CREATE TABLE directed_by ( id int, msid int, did int ) CREATE TABLE classification ( id int, msid int, gid int ) CREATE TABLE tv_series ( sid int, title text, release_year int, num_of_seasons int, num_of_episod...
SELECT movie.title FROM directed_by, director, movie WHERE director.birth_city = 'Los Angeles' AND director.did = directed_by.did AND movie.mid = directed_by.msid
imdb
CREATE TABLE table_30593 ( "Version" text, "Release" text, "Release date" text, "End of maintenance" text, "Requirement" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the number of the 1.0.9 release version?
SELECT COUNT("Version") FROM table_30593 WHERE "Release" = '1.0.9'
wikisql
CREATE TABLE table_name_67 ( episode VARCHAR, segment_b VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which episode's segment b is s hacksaw?
SELECT episode FROM table_name_67 WHERE segment_b = "s hacksaw"
sql_create_context
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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), ...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(MANAGER_ID) DESC
nvbench
CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, state_province text, country_id text ) CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE countries ( country_id text, countr...
SELECT employee_id, MAX(end_date) FROM job_history GROUP BY employee_id
spider
CREATE TABLE table_name_12 ( margin_of_victory VARCHAR, runner_s__up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the margin of victory for Isao Aoki when he was a runner-up?
SELECT margin_of_victory FROM table_name_12 WHERE runner_s__up = "isao aoki"
sql_create_context
CREATE TABLE table_8076 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Road Team in the game with a Result of 105-95?
SELECT "Road Team" FROM table_8076 WHERE "Result" = '105-95'
wikisql
CREATE TABLE table_77834 ( "Goal" real, "Date" text, "Venue" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result in oakland?
SELECT "Result" FROM table_77834 WHERE "Venue" = 'oakland'
wikisql
CREATE TABLE Prescribes ( Patient VARCHAR, Medication VARCHAR ) CREATE TABLE patient ( SSN VARCHAR ) CREATE TABLE Medication ( name VARCHAR, Code VARCHAR ) CREATE TABLE stay ( Patient VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the...
SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111
sql_create_context
CREATE TABLE table_7986 ( "Frequency" text, "Call sign" text, "Branding" text, "Format" text, "Owner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which call sign has a frequency of FM 105.3?
SELECT "Call sign" FROM table_7986 WHERE "Frequency" = 'fm 105.3'
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 COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-25577' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hosp...
eicu
CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int ) CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text ) -- Using valid SQLite, answer the following questions ...
SELECT Country, COUNT(*) FROM climber GROUP BY Country ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_7603 ( "Publication" text, "Country" text, "Accolade" text, "Year" real, "Rank" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Rank, when Publication is Dagsavisen, and when Year is less than 2005?
SELECT MAX("Rank") FROM table_7603 WHERE "Publication" = 'dagsavisen' AND "Year" < '2005'
wikisql
CREATE TABLE table_60940 ( "Line Name" text, "Date Closed" text, "NIMT Junction" text, "Terminus" text, "Length" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What line has Newmarket Junction terminus?
SELECT "Line Name" FROM table_60940 WHERE "Terminus" = 'newmarket junction'
wikisql
CREATE TABLE table_66574 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is reserved for Jawad?
SELECT "Reserved for ( SC / ST /None)" FROM table_66574 WHERE "Name" = 'jawad'
wikisql
CREATE TABLE table_name_48 ( air_date VARCHAR, demo VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When is the air date that demo-ed at 1.6/5?
SELECT air_date FROM table_name_48 WHERE demo = "1.6/5"
sql_create_context
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE T...
SELECT pl.PostId AS "post_link", pl.RelatedPostId AS "post_link" FROM PostLinks AS pl JOIN Posts AS p ON (pl.RelatedPostId = p.Id) WHERE NOT p.ClosedDate IS NULL ORDER BY pl.PostId DESC LIMIT 100
sede
CREATE TABLE table_29744 ( "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 "Date" FROM table_29744 WHERE "High assists" = 'Jameer Nelson (10)'
wikisql
CREATE TABLE table_4861 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the final score for Aguilar when he played Hans Podlipnik on clay and was ...
SELECT "Score" FROM table_4861 WHERE "Surface" = 'clay' AND "Opponent" = 'hans podlipnik' AND "Outcome" = 'runner-up'
wikisql
CREATE TABLE table_name_92 ( date VARCHAR, viewers VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date, when Viewers is 4.4 million?
SELECT date FROM table_name_92 WHERE viewers = "4.4 million"
sql_create_context
CREATE TABLE table_25318033_1 ( races INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest amount of races?
SELECT MIN(races) FROM table_25318033_1
sql_create_context
CREATE TABLE table_train_144 ( "id" int, "retinal_dystrophy" bool, "mini_mental_state_examination_mmse" int, "memory_box" float, "body_weight" float, "neutrophil_count" int, "moca_score" int, "severe_dementia" bool, "dementia" bool, "macular_degeneration" bool, "diabetic_reti...
SELECT * FROM table_train_144 WHERE clinical_dementia_rating_cdr = 0.5 AND memory_box > 0.5
criteria2sql
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNT...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY) DESC
nvbench
CREATE TABLE table_name_51 ( year VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the year when Scuderia Lancia Corse competed?
SELECT COUNT(year) FROM table_name_51 WHERE team = "scuderia lancia corse"
sql_create_context
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CRE...
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ...
sede
CREATE TABLE table_14582 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most overall for dwight freeney with round less than 1
SELECT MAX("Overall") FROM table_14582 WHERE "Name" = 'dwight freeney' AND "Round" < '1'
wikisql
CREATE TABLE table_52094 ( "Round" real, "Pick" real, "Name" text, "Position" text, "School" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of rounds that UCLA has?
SELECT COUNT("Round") FROM table_52094 WHERE "School" = 'ucla'
wikisql
CREATE TABLE table_name_61 ( round INTEGER, player VARCHAR, draft VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average round of player dave pulkkinen, who had a draft after 1969?
SELECT AVG(round) FROM table_name_61 WHERE player = "dave pulkkinen" AND draft > 1969
sql_create_context
CREATE TABLE table_37196 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Score on January 30?
SELECT "Score" FROM table_37196 WHERE "Date" = 'january 30'
wikisql
CREATE TABLE table_17632217_1 ( number_of_clubs VARCHAR, runners_up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many values for number of clubs have Shandong as the runner-up?
SELECT COUNT(number_of_clubs) FROM table_17632217_1 WHERE runners_up = "Shandong"
sql_create_context
CREATE TABLE table_name_96 ( year VARCHAR, number INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Year with a Number that is larger than 34?
SELECT year FROM table_name_96 WHERE number > 34
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(SALARY)
nvbench
CREATE TABLE table_60810 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What party has the South Carolina 2 district?
SELECT "Party" FROM table_60810 WHERE "District" = 'south carolina 2'
wikisql
CREATE TABLE table_38431 ( "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 Total of kyrgyzstan with a Silver smaller than 0?
SELECT AVG("Total") FROM table_38431 WHERE "Nation" = 'kyrgyzstan' AND "Silver" < '0'
wikisql
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, ...
SELECT t.Year, t.Month, AVG(t.Reputation) AS AvgReputation, MAX(t.Reputation) AS MaxReputation FROM (SELECT TIME_TO_STR(CreationDate, '%Y') AS Year, TIME_TO_STR(CreationDate, '%m') AS Month, TIME_TO_STR(CreationDate, '%d') AS Day, Reputation FROM Users WHERE Reputation >= 15) AS t GROUP BY YEAR, Month ORDER BY YEAR DES...
sede
CREATE TABLE fgwyjzb ( 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 JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '袁文栋' AND t_kc22.STA_DATE BETWEEN '2004-09-29' AND '2021-10-04' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22....
css
CREATE TABLE table_20750731_1 ( others_number VARCHAR, mccain_percentage VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When McCain% was 64.8%, what is the Others#?
SELECT others_number FROM table_20750731_1 WHERE mccain_percentage = "64.8%"
sql_create_context
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, Pos...
SELECT COUNT(*) AS PostCount, YEAR(P.CreationDate), MONTH(P.CreationDate) FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE ('%lisp%') GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY 2 DESC, 3 DESC
sede
CREATE TABLE table_48008 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the ...
SELECT COUNT("Lost") FROM table_48008 WHERE "Goal Difference" = '+13' AND "Drawn" > '12'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chronic cholecystitis')) AND DATETIME(cost.chargetime, 'start o...
mimic_iii
CREATE TABLE table_58107 ( "Number" text, "Builder" text, "Type" text, "Date" text, "Works number" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Builder has a Works Number of 16272?
SELECT "Builder" FROM table_58107 WHERE "Works number" = '16272'
wikisql
CREATE TABLE table_name_22 ( sacks INTEGER, team VARCHAR, tackles VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the value for lowest Sacks, when the Team is New Orleans Saints, and when the value for Tackles is 132?
SELECT MIN(sacks) FROM table_name_22 WHERE team = "new orleans saints" AND tackles = "132"
sql_create_context
CREATE TABLE table_name_58 ( attendance INTEGER, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Attendance has an Opponent of oxford united?
SELECT SUM(attendance) FROM table_name_58 WHERE opponent = "oxford united"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, Crea...
SELECT *, (VoteTable.UpVotes * (CASE VoteTable.PostType WHEN 1 THEN 5 ELSE 10 END) - VoteTable.DownVotes * 2) AS Reputation FROM (SELECT TagName, Posts.PostTypeId AS PostType, SUM(CASE VoteTypeId WHEN 2 THEN 1 ELSE 0 END) AS UpVotes, SUM(CASE VoteTypeId WHEN 3 THEN 1 ELSE 0 END) AS DownVotes FROM Posts INNER JOIN PostT...
sede