table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_203_519 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number )
charles zwolsman acquired the same number of points as who ?
SELECT "driver" FROM table_203_519 WHERE "driver" <> 'charles zwolsman' AND "points" = (SELECT "points" FROM table_203_519 WHERE "driver" = 'charles zwolsman')
CREATE TABLE table_8376 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Which Score has a Visitor of toronto st. pats, and a Home of montreal canadiens, and a Record of 3 2 0?
SELECT "Score" FROM table_8376 WHERE "Visitor" = 'toronto st. pats' AND "Home" = 'montreal canadiens' AND "Record" = '3–2–0'
CREATE TABLE table_21565 ( "1391 Carelia" text, "1398 Donnera" text, "1405 Sibelius" text, "1406 Komppa" text, "1407 Lindel\u00f6f" text )
what is the 1405 sibelius of asteroid which 1407 lindel f is 2020 ukko
SELECT "1405 Sibelius" FROM table_21565 WHERE "1407 Lindel\u00f6f" = '2020 Ukko'
CREATE TABLE table_11132 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
Who was the opponent on December 10, 2000?
SELECT "Opponent" FROM table_11132 WHERE "Date" = 'december 10, 2000'
CREATE TABLE table_name_45 ( played INTEGER, points VARCHAR, position VARCHAR )
What is the mean number of played when there are less than 18 points and the position is less than 8?
SELECT AVG(played) FROM table_name_45 WHERE points < 18 AND position < 8
CREATE TABLE table_dev_14 ( "id" int, "anemia" bool, "pulmonary_disease" bool, "c_peptide_level" float, "hemoglobin_a1c_hba1c" float, "renal_disease" bool, "cardiovascular_disease" bool, "estimated_glomerular_filtration_rate_egfr" int, "fasting_c_peptide" float, "organ_failure" b...
fasting c _ peptide greater than or equal to 0.8 ng / ml.
SELECT * FROM table_dev_14 WHERE fasting_c_peptide >= 0.8
CREATE TABLE table_name_47 ( start_source VARCHAR, started VARCHAR )
what is the start source when started on 2 february?
SELECT start_source FROM table_name_47 WHERE started = "2 february"
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
how much is the change of systemicsystolic in patient 006-66713 last measured on the first intensive care unit visit compared to the first value measured on the first intensive care unit visit?
SELECT (SELECT vitalperiodic.systemicsystolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-66713') AND NOT patient.unitdischarget...
CREATE TABLE table_41819 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" text, "Record" text )
What is the score of the competition on November 10?
SELECT "Score" FROM table_41819 WHERE "Date" = 'november 10'
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) )...
Show me a scatter plot of destroyed by employee id and the total number for .
SELECT Destroyed_by_Employee_ID, COUNT(*) FROM Documents_to_be_Destroyed GROUP BY Destroyed_by_Employee_ID
CREATE TABLE table_55145 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What's the region for an item on November 10, 2007 that's a cd?
SELECT "Region" FROM table_55145 WHERE "Date" = 'november 10, 2007' AND "Format" = 'cd'
CREATE TABLE Plays_games ( gameid VARCHAR ) CREATE TABLE Video_games ( gameid VARCHAR )
Show all game names played by at least 1000 hours.
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING SUM(hours_played) >= 1000
CREATE TABLE table_17093 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
who are all the players for armwood high school
SELECT "Player" FROM table_17093 WHERE "School" = 'Armwood High School'
CREATE TABLE table_name_13 ( points VARCHAR, draws VARCHAR, wins VARCHAR, goal_difference VARCHAR )
How many points have more than 14 wins, a goal difference of 14, and more than 6 draws?
SELECT COUNT(points) FROM table_name_13 WHERE wins > 14 AND goal_difference = 14 AND draws > 6
CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, PrimaryAffiliation BOOLEAN ) CREATE TABLE Procedures ( Code INTEGER, Name VARCHAR(30), Cost REAL ) CREATE TABLE Department ( DepartmentID INTEGER, Name VARCHAR(30), Head INTEGER ) CREATE TABLE On_Call ( Nurs...
Find the number of the physicians who are trained in a procedure that costs more than 5000, order by the Y from high to low.
SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name ORDER BY COUNT(T1.Name) DESC
CREATE TABLE table_name_24 ( record VARCHAR, game VARCHAR )
What is Record, when Game is '24'?
SELECT record FROM table_name_24 WHERE game = 24
CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int,...
show me ground transportation information for SAN FRANCISCO
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'SAN FRANCISCO' AND ground_service.city_code = city.city_code
CREATE TABLE table_41383 ( "Year" real, "Award" text, "Category" text, "Nominee" text, "Result" text )
What year was best costume design the award category?
SELECT "Year" FROM table_41383 WHERE "Category" = 'best costume design'
CREATE TABLE table_48522 ( "Game" real, "Date" text, "Team" text, "Score" text, "Record" text, "Streak" text )
What is Score when Team is @ Kansas City-Omaha Kings?
SELECT "Score" FROM table_48522 WHERE "Team" = '@ kansas city-omaha kings'
CREATE TABLE table_18600760_20 ( ansi_code VARCHAR, latitude VARCHAR )
How many ansi codes are there for latitude 48.142938?
SELECT COUNT(ansi_code) FROM table_18600760_20 WHERE latitude = "48.142938"
CREATE TABLE table_67337 ( "Call sign" text, "Frequency MHz" text, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
What is the name of call sign that uses a Frequency MHz of 91.1 fm?
SELECT "Call sign" FROM table_67337 WHERE "Frequency MHz" = '91.1 fm'
CREATE TABLE table_name_96 ( date VARCHAR, opponent VARCHAR )
Which date featured the Boston Patriots as the opponent?
SELECT date FROM table_name_96 WHERE opponent = "boston patriots"
CREATE TABLE table_40834 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
In the Phoenix Open, what was the winning score?
SELECT "Winning score" FROM table_40834 WHERE "Tournament" = 'phoenix open'
CREATE TABLE table_name_52 ( rec INTEGER, yards VARCHAR, s_touchdown VARCHAR )
Which rec has Yards of 192, and a Touchdown smaller than 1?
SELECT AVG(rec) FROM table_name_52 WHERE yards = 192 AND s_touchdown < 1
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost numb...
did any phenytoin (suspension) ever been prescribed to patient 77980 until 4 years ago?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 77980) AND prescriptions.drug = 'phenytoin (suspension)' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year')
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Before ANTHRCUL 461 , which courses do I need to take ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
CREATE TABLE table_204_357 ( id number, "year" number, "div." text, "pos." text, "cup" text, "top scorer (league)" text, "score" number )
how many years was shodiev the top scorer ?
SELECT COUNT("year") FROM table_204_357 WHERE "top scorer (league)" = 'vokhid shodiev'
CREATE TABLE actor ( aid int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE writer ( wid int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE director ( did int, gender text, ...
Find all movies written and produced by ' Woody Allen
SELECT movie.title FROM made_by, movie, producer, writer, written_by WHERE movie.mid = made_by.msid AND producer.name = 'Woody Allen' AND producer.pid = made_by.pid AND writer.name = 'Woody Allen' AND written_by.msid = movie.mid AND written_by.wid = writer.wid
CREATE TABLE table_1341568_14 ( district VARCHAR, elected VARCHAR )
What district had elections in 1964?
SELECT district FROM table_1341568_14 WHERE elected = 1964
CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, ...
Show the proportion of each party in a pie chart.
SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party
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 ...
give me the number of patients whose insurance is medicare and diagnoses long title is body mass index less than 19, adult?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.long_title = "Body Mass Index less than 19, adult"
CREATE TABLE table_train_130 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "right_bundle_branch_block" bool, "space_occupying_cerebral_lesion" bool, "huntington_disease" bool, "psychiatric_disease" bool, "mental_illness" bool, "treatment_regimen" bool, "psychoti...
alt and / or ast levels that are twice the upper limit of normal; bilirubin levels that exceed 2 mg / dl; serum creatinine > 1.5 mg / dl in male or > 1.4 mg / dl in female .
SELECT * FROM table_train_130 WHERE bilirubin > 2 OR ((gender = 'male' AND serum_creatinine > 1.5) OR (gender = 'female' AND serum_creatinine > 1.4))
CREATE TABLE table_168274_1 ( index_weighting___percentage__at_17_january_2013 VARCHAR, company VARCHAR )
Name the total number of index weighting % at 17 january 2013 for bouygues
SELECT COUNT(index_weighting___percentage__at_17_january_2013) FROM table_168274_1 WHERE company = "Bouygues"
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...
How many of the patients with parent infus nutrit sub were transferred to a cancer/children hospital?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" AND procedures.short_title = "Parent infus nutrit sub"
CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, ...
A pie chart about how many male and female assistant professors do we have?
SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex
CREATE TABLE table_64088 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
Who are the opponents in the February 19, 1996 final?
SELECT "Opponents in the final" FROM table_64088 WHERE "Date" = 'february 19, 1996'
CREATE TABLE table_63202 ( "Position" real, "Gymnast" text, "A score" real, "B score" real, "Total" real )
What is the total when the A score was less than 6.6, and the B score was 8.925?
SELECT "Total" FROM table_63202 WHERE "A score" < '6.6' AND "B score" = '8.925'
CREATE TABLE table_23066 ( "Draw" real, "Artist" text, "Original" text, "English Meaning" text, "Language" text, "Authors" text )
Who was the artist for the origin Shake it, Europe?
SELECT "Artist" FROM table_23066 WHERE "Original" = 'Shake It, Europe'
CREATE TABLE table_46991 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real )
Can you tell me the Player that has the Country of united states, and the Score of 77-72-72=221?
SELECT "Player" FROM table_46991 WHERE "Country" = 'united states' AND "Score" = '77-72-72=221'
CREATE TABLE table_23274514_9 ( record VARCHAR, team VARCHAR )
What was the record when they played golden state?
SELECT record FROM table_23274514_9 WHERE team = "Golden State"
CREATE TABLE table_17058178_8 ( team VARCHAR, date VARCHAR )
Who did the Trail Blazers play on January 2?
SELECT team FROM table_17058178_8 WHERE date = "January 2"
CREATE TABLE table_15187735_5 ( netflix VARCHAR, segment_b VARCHAR )
When marshmallow cookies is segment b what episode is it on netflix?
SELECT netflix FROM table_15187735_5 WHERE segment_b = "Marshmallow Cookies"
CREATE TABLE table_22165661_3 ( head_coach VARCHAR, score VARCHAR )
Who is the head coach for the score of 4-3?
SELECT head_coach FROM table_22165661_3 WHERE score = "4-3"
CREATE TABLE table_name_37 ( to_par INTEGER, place VARCHAR, country VARCHAR )
What is the highest to par with a place of t8 and West Germany as the country?
SELECT MAX(to_par) FROM table_name_37 WHERE place = "t8" AND country = "west germany"
CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) )
What are the names and number of hours spent training for each player who trains for less than 1500 hours Visualize by bar chart, rank y axis in descending order.
SELECT pName, HS FROM Player WHERE HS < 1500 ORDER BY HS DESC
CREATE TABLE enzyme ( id int, name text, Location text, Product text, Chromosome text, OMIM int, Porphyria text ) CREATE TABLE medicine_enzyme_interaction ( enzyme_id int, medicine_id int, interaction_type text ) CREATE TABLE medicine ( id int, name text, Trade_Name...
Show me a bar chart for what are the ids and trade names of the medicine that can interact with at least 3 enzymes?, sort y-axis in desc order.
SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY id DESC
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 ReviewRejectionReasons ( Id number, N...
What is the percentage of down voting users?.
WITH DownVoterCount AS (SELECT DownVoterCount = CAST(COUNT(*) AS FLOAT) FROM Users WHERE Users.DownVotes > 0), UserCount AS (SELECT UserCount = CAST(COUNT(*) AS FLOAT) FROM Users), DownVoterPercentage AS (SELECT ROUND(((SELECT DownVoterCount FROM DownVoterCount) / (SELECT UserCount FROM UserCount)) * 100, 2) AS DownVot...
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
what is the daily maximum value of patient 017-83812's o2 sat (%) in 2105?
SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-83812')) AND lab.labname = 'o2 sat (%)' AND STRFTIME('%y', lab.labresulttime) ...
CREATE TABLE table_name_90 ( points INTEGER, opponent VARCHAR, january VARCHAR )
Which Points have an Opponent of calgary flames, and a January larger than 22?
SELECT AVG(points) FROM table_name_90 WHERE opponent = "calgary flames" AND january > 22
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
give me the number of patients whose diagnoses long title is other chronic pain and lab test abnormal status is abnormal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Other chronic pain" AND lab.flag = "abnormal"
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...
provide the number of patients whose marital status is divorced and lab test name is ph?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "pH"
CREATE TABLE table_name_86 ( hits VARCHAR, year INTEGER )
Name the hits for years before 1883
SELECT hits FROM table_name_86 WHERE year < 1883
CREATE TABLE table_51486 ( "Year" real, "Organisation" text, "Award" text, "Nominated Work Title" text, "Result" text )
what is the organisation when the nominated work title is n/a in the year 2005?
SELECT "Organisation" FROM table_51486 WHERE "Nominated Work Title" = 'n/a' AND "Year" = '2005'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
what was the average daily number of patients who were diagnosed with platelet dysfunction until 2104?
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'platelet dysfunction' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104' GROUP BY STRFTIME('%y-%m-%d', diagnosis.diagnosistime)) AS t1
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, ...
on 11 23 what flights are available between BOSTON and DENVER
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 23 AND date_day.month_number = 11 AND d...
CREATE TABLE table_train_138 ( "id" int, "mini_mental_state_examination_mmse" int, "stroke" bool, "body_weight" float, "cranial_neurosurgery" bool, "first_degree_relative" bool, "seizure_disorder" bool, "alcohol_abuse" bool, "body_mass_index_bmi" float, "aneurysm" bool, "NOUS...
subjects with history of stroke , aneurysm, or cranial neurosurgery
SELECT * FROM table_train_138 WHERE stroke = 1 OR aneurysm = 1 OR cranial_neurosurgery = 1
CREATE TABLE table_50135 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What method was used in the match that went to round 1, and had a 6-3-1 record?
SELECT "Method" FROM table_50135 WHERE "Round" = '1' AND "Record" = '6-3-1'
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 patient ( uniquep...
how many days have it been since patient 006-195316's last prescription of furosemide 40 mg tab in the current hospital visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195...
CREATE TABLE table_204_398 ( id number, "title" text, "year" number, "publisher" text, "developer" text, "platforms" text )
what is the total number of lord of the rings games released since 1982 ?
SELECT COUNT("title") FROM table_204_398 WHERE "year" > 1982
CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_cit...
List the name for storms and the number of affected regions for each storm with a bar chart.
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID
CREATE TABLE trained_in ( physician number, treatment number, certificationdate time, certificationexpires time ) CREATE TABLE patient ( ssn number, name text, address text, phone text, insuranceid number, pcp number ) CREATE TABLE nurse ( employeeid number, name text, ...
Count the number of patients who stayed in room 112.
SELECT COUNT(patient) FROM stay WHERE room = 112
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases IN...
What are the wines that have prices lower than 50 and have appelations in Monterey county, and count them by a bar chart, rank total number from low to high order.
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name)
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,...
give me the number of patients whose marital status is divorced and lab test name is alkaline phosphatase?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Alkaline Phosphatase"
CREATE TABLE table_name_42 ( high_rebounds VARCHAR, date VARCHAR )
Who had the highest number of rebounds on February 14?
SELECT high_rebounds FROM table_name_42 WHERE date = "february 14"
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...
how many patients whose admission type is newborn and diagnoses long title is loss of weight?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "NEWBORN" AND diagnoses.long_title = "Loss of weight"
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 ...
has patient 73075 had any surgeries since 2103?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73075) AND STRFTIME('%y', procedures_icd.charttime) >= '2103'
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
How often is reprex, mcve, mwe, sscce, mvce, example used in comments on SO?.
SELECT COUNT(sel.Id) FROM (SELECT c.Id FROM Comments AS c WHERE YEAR(c.CreationDate) >= 2019) AS sel
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
what is the name of drug that patient 3369 was prescribed within 2 days after being diagnosed with alcohol cirrhosis liver until 58 months ago?
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 3369 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'alcohol...
CREATE TABLE table_76531 ( "Date" text, "Opponent" text, "Score" text, "Result" text, "Record" text )
What is the Opponent of the game with a Score of 74-66?
SELECT "Opponent" FROM table_76531 WHERE "Score" = '74-66'
CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARC...
A line chart shows the change of the sum of monthly_rental over date_address_to , and group by attribute date_address_to
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY date_address_to ORDER BY monthly_rental DESC
CREATE TABLE table_10706961_2 ( rd VARCHAR, name VARCHAR )
Which Rd took place at the Indianapolis 500?
SELECT rd FROM table_10706961_2 WHERE name = "Indianapolis 500"
CREATE TABLE Student_Addresses ( student_id INTEGER, address_id INTEGER, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL(19,4), other_details VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middl...
Give me a pie chart to reflect the proportion of other_details and the sum of monthly_rental.
SELECT other_details, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
CREATE TABLE table_2285 ( "Type" text, "Beam height (mm)" real, "Flange width (mm)" real, "Web thickness (mm)" text, "Flange thickness (mm)" text, "Weight (kg/m)" text, "Cross-section area (cm 2 )" text, "Moment of inertia in torsion (J) (cm 4 )" text )
What is the weight with a cross section area of 25.3?
SELECT "Weight (kg/m)" FROM table_2285 WHERE "Cross-section area (cm 2 )" = '25.3'
CREATE TABLE table_name_36 ( home_team VARCHAR, road_team VARCHAR, date VARCHAR )
Who was the home team on April 20 against Boston?
SELECT home_team FROM table_name_36 WHERE road_team = "boston" AND date = "april 20"
CREATE TABLE table_57093 ( "car plates (since 1937)" text, "Voivodeship Separate city" text, "Capital" text, "Area in 1000km\u00b2 (1930)" text, "Population in 1000 (1931)" text )
what is the capital with the Voivodeship Separate city of bia ostockie?
SELECT "Capital" FROM table_57093 WHERE "Voivodeship Separate city" = 'białostockie'
CREATE TABLE table_9574 ( "Year" real, "Character" text, "Title" text, "Author" text, "Artist" text, "Imprint" text )
who is the character when the artist is take and the year is before 2006?
SELECT "Character" FROM table_9574 WHERE "Artist" = 'take' AND "Year" < '2006'
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, ...
what is the discharge location and time of the patient melinda miers?
SELECT demographic.discharge_location, demographic.dischtime FROM demographic WHERE demographic.name = "Melinda Miers"
CREATE TABLE table_12406 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Who is the player with a 68-67-75=210 score?
SELECT "Player" FROM table_12406 WHERE "Score" = '68-67-75=210'
CREATE TABLE table_204_28 ( id number, "election" text, "name of the party/alliance" text, "number of votes" number, "percentage" text, "seats in the parliament" number )
which party/alliance has more than 300,000 votes ?
SELECT "name of the party/alliance" FROM table_204_28 WHERE "number of votes" > 300000
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...
how many patients whose admission type is urgent and diagnoses short title is hemochromatos-rbc trans?
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 = "Hemochromatos-rbc trans"
CREATE TABLE table_name_52 ( city_of_license VARCHAR, frequency_mhz VARCHAR, call_sign VARCHAR )
What city of license has a Frequency under 107.7, and a call sign of w247aq?
SELECT city_of_license FROM table_name_52 WHERE frequency_mhz < 107.7 AND call_sign = "w247aq"
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id...
Unanswered, uncommented and unclosed questions.
SELECT Id AS "post_link", CreationDate, Score, ViewCount FROM Posts WHERE PostTypeId = 1 AND AnswerCount = 0 AND CommentCount = 0 AND ClosedDate IS NULL ORDER BY ViewCount
CREATE TABLE table_59153 ( "Aircraft" text, "1990" real, "destroyed" real, "damaged" real, "to Iran" real, "survived" real )
What's the average destroyed with a 1990 over 12, more than 1 damaged, 6 survivors, and a to Iran less than 4?
SELECT AVG("destroyed") FROM table_59153 WHERE "1990" > '12' AND "damaged" > '1' AND "to Iran" < '4' AND "survived" = '6'
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...
provide the number of patients with the item id 50902 and who were born before 2109.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2109" AND lab.itemid = "50902"
CREATE TABLE table_name_45 ( team__number1 VARCHAR, round VARCHAR )
What is team 1 in group h?
SELECT team__number1 FROM table_name_45 WHERE round = "group h"
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId numb...
Reputation and Percentile Rank.
WITH Rankings AS (SELECT Id, DisplayName, Reputation, Ranking = ROW_NUMBER() OVER (ORDER BY Reputation DESC) FROM Users), Counts AS (SELECT Count = COUNT(*) FROM Users WHERE Reputation > 100) SELECT Id, DisplayName, Reputation, CAST(Ranking AS FLOAT(20, 5)) / (SELECT Count FROM Counts) AS Percentile FROM Rankings
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
when on the current hospital visit did patient 005-87465 receive a prescription for the first time?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465' AND patient.hospitaldischargetime IS NULL)) ORDER B...
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 diagnosis ( diagn...
when was patient 007-11182 for the first time prescribed a drug?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-11182')) ORDER BY medication.drugstarttime LIMIT 1
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 procedures ( ...
how many of the patients aged below 81 were treated with drug code prismab32k25000?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "81" AND prescriptions.formulary_drug_cd = "PRISMAB32K25000"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, ...
count the number of times sodium chloride 0.9 % iv solp had been prescribed to patient 010-37499.
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 = '010-37499')) AND medication.drugname = 'sodium chloride 0.9 % iv solp'
CREATE TABLE table_40972 ( "Player" text, "Nationality" text, "Position" text, "Years in Orlando" text, "School/Club Team" text )
Who is the Player for School/Club Team Illinois?
SELECT "Player" FROM table_40972 WHERE "School/Club Team" = 'illinois'
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABL...
what is the fare on 11 7 going one way from DALLAS to SAN FRANCISCO
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 C...
CREATE TABLE table_name_35 ( finish INTEGER, year VARCHAR )
What was Jeff's finish in 2011?
SELECT SUM(finish) FROM table_name_35 WHERE year = 2011
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, ...
how many patients are admitted before the year 2190 and tested in lab for abnormal status?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2190" AND lab.flag = "abnormal"
CREATE TABLE table_name_23 ( lost INTEGER, games INTEGER )
What's the total Lost with Games that's less than 4?
SELECT SUM(lost) FROM table_name_23 WHERE games < 4
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
what were the top three most common diagnoses for patients of the 30s since 2100?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', diagnosis.diagnosistime) >= '2100' GROUP BY diagnosis....
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABL...
how many patients have expired after they have been diagnosed with crnry athrscl natve vssl within the same hospital visit since 2103?
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime, t1.hadm_id FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FRO...
CREATE TABLE table_24938621_3 ( production_code VARCHAR, written_by VARCHAR )
What is the production code of the episode written by Cathryn Humphris?
SELECT production_code FROM table_24938621_3 WHERE written_by = "Cathryn Humphris"
CREATE TABLE table_5674 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
How many points have @ new york islanders as the opponent, with a game greater than 35?
SELECT COUNT("Points") FROM table_5674 WHERE "Opponent" = '@ new york islanders' AND "Game" > '35'
CREATE TABLE table_name_71 ( part_number_s_ VARCHAR, l3_cache VARCHAR, sspec_number VARCHAR )
Which Part number(s) has a L3 cache of 8 mb and a sSpec number of sr0pl(e1)?
SELECT part_number_s_ FROM table_name_71 WHERE l3_cache = "8 mb" AND sspec_number = "sr0pl(e1)"