table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
on the first intensive care unit visit, what was first respiration for patient 007-1517?
SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517') AND NOT patient.unitdischargetime IS NULL OR...
CREATE TABLE table_27821 ( "Position" real, "Sail Number" text, "Yacht" text, "State/Country" text, "Yacht Type" text, "LOA (Metres)" text, "Skipper" text, "Elapsed Time d:hh:mm:ss" text )
How many times are provided for the boat with LOA of 20.49?
SELECT COUNT("Elapsed Time d:hh:mm:ss") FROM table_27821 WHERE "LOA (Metres)" = '20.49'
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
a month before, list the daily minimum heartrate of patient 005-73237.
SELECT MIN(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237')) AND NOT vitalperiodic.heartrate IS NULL...
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, ...
fare code Y what does that mean
SELECT DISTINCT booking_class FROM class_of_service WHERE booking_class = 'Y'
CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) )
What is minimum hours of the students playing in different position. Plot them as bar chart.
SELECT pPos, MIN(T2.HS) FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID GROUP BY pPos
CREATE TABLE table_22795 ( "Year" real, "Host" text, "1st Place" text, "2nd Place" text, "3rd Place" text, "4th Place" text, "5th Place" text )
Who was in 4th place when Missouri finished in 3rd place?
SELECT "4th Place" FROM table_22795 WHERE "3rd Place" = 'Missouri'
CREATE TABLE table_32525 ( "Year" real, "Name" text, "Date" text, "Stages" text, "Distance" text, "Winner" text, "Time" text )
Who won the Fedex tour of Calabarzon?
SELECT "Winner" FROM table_32525 WHERE "Name" = 'fedex tour of calabarzon'
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients whose diagnoses short title is react-oth vasc dev/graft 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.short_title = "React-oth vasc dev/graft" AND lab.flag = "abnormal"
CREATE TABLE table_38083 ( "Rank" real, "Club" text, "Seasons" real, "Played" real, "Drew" real, "Lost" real, "Points" real, "Avg. Points" real, "Goals for" real, "Goals against" real, "Goal diff" real )
Which Drew has a Rank of 5, and a Played larger than 30?
SELECT COUNT("Drew") FROM table_38083 WHERE "Rank" = '5' AND "Played" > '30'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
did patient 031-13920 get a non-invasive testing for dvt procedure in some other hospital this year?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '031-13920' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '031-13920' AND patient.hospitaldischargetime IS NULL)) AND tr...
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE T...
Accepted answer rate per tag.
SELECT COUNT(*) AS Total, COUNT(p.AcceptedAnswerId) AS Answered, (CAST(COUNT(p.AcceptedAnswerId) AS FLOAT) / COUNT(*) * 100) AS Percentage FROM Posts AS p JOIN PostTags AS pt ON p.Id = pt.PostId JOIN Tags AS t ON pt.TagId = t.Id WHERE t.TagName = @TagName AND p.PostTypeId = 1
CREATE TABLE table_204_939 ( id number, "year" number, "chassis" text, "engine" text, "start" text, "finish" text )
did 1979 or 1985 have the larger finish place ?
SELECT "year" FROM table_204_939 WHERE "year" IN (1979, 1985) ORDER BY "finish" DESC 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 newborn patients were admitted to the hospital with a main drug type.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "NEWBORN" AND prescriptions.drug_type = "MAIN"
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 cost ( costid num...
what lab testing was given to patient 010-16572 on their current hospital visit for the first time?
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-16572' AND patient.hospitaldischargetime IS NULL)) ORDER BY lab.labresulttime LIMIT 1
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
A bar chart shows the distribution of Date_of_Birth and Height , list by the y-axis in desc.
SELECT Date_of_Birth, Height FROM people ORDER BY Height DESC
CREATE TABLE table_53826 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
Who was the Runner(s)-up on the Date 4 Oct 2009?
SELECT "Runner(s)-up" FROM table_53826 WHERE "Date" = '4 oct 2009'
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 diagnoses ( ...
Among the patients admitted before the year 2172, how many had contact dermatitis and other eczema with an unspecified cause?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2172" AND diagnoses.long_title = "Contact dermatitis and other eczema, unspecified cause"
CREATE TABLE Discount_Coupons ( coupon_amount VARCHAR, coupon_id VARCHAR ) CREATE TABLE customers ( coupon_id VARCHAR, good_or_bad_customer VARCHAR )
What are the coupon amount of the coupons owned by both good and bad customers?
SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'
CREATE TABLE table_52982 ( "Season" text, "Pyramid Level" text, "Regular Season 1" text, "Playoffs 1" text, "Regular Season 2" text, "Playoffs 2" text, "Copa M\u00e9xico" text, "CONCACAF" text )
What is the regular season 1 result of the season when the Copa M xico was no longer played, the pyramid level was 2, and the regular season 2 result was 15th?
SELECT "Regular Season 1" FROM table_52982 WHERE "Copa M\u00e9xico" = 'no longer played' AND "Pyramid Level" = '2' AND "Regular Season 2" = '15th'
CREATE TABLE table_name_21 ( position VARCHAR, height_in_ft VARCHAR )
What is Position, when Height in Ft. is 6-10?
SELECT position FROM table_name_21 WHERE height_in_ft = "6-10"
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
retrieve patient ids of patients who are diagnosed with cerebral subdural hematoma - secondary to trauma until 4 years ago.
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'cerebral subdural hematoma - secondary to trauma' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-4 year'))
CREATE TABLE table_name_4 ( tournament VARCHAR, outcome VARCHAR, surface VARCHAR )
Which Tournament has an Outcome of winner, and a Surface of hard (i)?
SELECT tournament FROM table_name_4 WHERE outcome = "winner" AND surface = "hard (i)"
CREATE TABLE table_35889 ( "Date" text, "Competition" text, "Opponents" text, "Venue" text, "Score" text )
Who was the opponent at the away game with a score of 5-4?
SELECT "Opponents" FROM table_35889 WHERE "Venue" = 'away' AND "Score" = '5-4'
CREATE TABLE table_35200 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
When is the most recent year with more than 27 points and more than 5 wins?
SELECT MAX("Year") FROM table_35200 WHERE "Points" > '27' AND "Wins" > '5'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
what is the cost for the hospital stay of patient 005-69150 during the first hospital visit?
SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-69150' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)
CREATE TABLE table_1231892_4 ( number_in_series VARCHAR, broadcast_order VARCHAR )
What's the number of episodes with a broadcast order s04 e07?
SELECT COUNT(number_in_series) FROM table_1231892_4 WHERE broadcast_order = "S04 E07"
CREATE TABLE table_52247 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Who constructed the car with laps more than 70 and a time/retired of +12.535?
SELECT "Constructor" FROM table_52247 WHERE "Laps" > '70' AND "Time/Retired" = '+12.535'
CREATE TABLE table_73062 ( "Parliament" text, "Name" text, "Period in office" text, "Birth and death years" text, "General election contested" real, "Constituency contested" text, "Political party" text )
During what period were parliament 11th?
SELECT "Period in office" FROM table_73062 WHERE "Parliament" = '11th'
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients whose language is span and admission location is clinic referral/premature?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "SPAN" AND demographic.admission_location = "CLINIC REFERRAL/PREMATURE"
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 cost ( row_id number, subject_id number, hadm_id nu...
what is the drug patient 64136 was prescribed for within 2 days after being diagnosed with chr pulmon heart dis nec when they visited the hospital last time?
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 = 64136 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chr pu...
CREATE TABLE table_204_526 ( id number, "name" text, "#" number, "position" text, "height" text, "weight" number, "year" text, "home town" text, "high school" text )
what was the number of freshmen on the team ?
SELECT COUNT(*) FROM table_204_526 WHERE "year" = 'freshman'
CREATE TABLE table_73692 ( "Series #" real, "Season #" text, "Episode" text, "Directed by" text, "Written by" text, "Original air date" text, "Viewers (in millions)" text )
If the season number is 2.08, who was the episode written by?
SELECT "Written by" FROM table_73692 WHERE "Season #" = '2.08'
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTaskStates ( Id number, ...
[SuperUser] top #N# questions tagged with #Tag#.
SELECT Id AS "post_link", Tags, ViewCount, Score FROM Posts WHERE Tags LIKE '%##Tag?lvm##%' AND NOT Tags LIKE '%##Filter1?llvm##%' AND NOT Tags LIKE '%##Filter2?visualvm##%' AND NOT AcceptedAnswerId IS NULL AND ClosedDate IS NULL AND CommunityOwnedDate IS NULL AND Score > 0 ORDER BY ViewCount DESC LIMIT 100
CREATE TABLE table_70255 ( "Institution" text, "Main Campus Location" text, "Founded" real, "Mascot" text, "School Colors" text )
Which School Colors were Founded of 1969, with an Institution of barton community college?
SELECT "School Colors" FROM table_70255 WHERE "Founded" = '1969' AND "Institution" = 'barton community college'
CREATE TABLE county_public_safety ( county_id number, name text, population number, police_officers number, residents_per_officer number, case_burden number, crime_rate number, police_force text, location text ) CREATE TABLE city ( city_id number, county_id number, name ...
Show white percentages of cities and the crime rates of counties they are in.
SELECT T1.white, T2.crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.county_id = T2.county_id
CREATE TABLE table_name_72 ( car__number VARCHAR, driver VARCHAR )
What is Brendan Gaughan's Car #?
SELECT car__number FROM table_name_72 WHERE driver = "brendan gaughan"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
Find the drug code for Caphosol.
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Caphosol"
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
what are the three most commonly prescribed drugs that patients were prescribed within 2 months after receiving a cultures - blood procedure in the last year?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cultures - blood' AND DATETIME(treatment.treatment...
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodi...
have patient 013-28507 received a vte prophylaxis - compression stockings since 4 years ago?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507')) AND treatment.treatmentname = 'vte prophylaxis - compression st...
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 departments ( DEP...
For those employees who get more salary than the employee whose id is 163, show the frequency of their last name, I want to show total number in desc order.
SELECT LAST_NAME, COUNT(LAST_NAME) FROM employees WHERE SALARY > (SELECT SALARY FROM employees WHERE EMPLOYEE_ID = 163) GROUP BY LAST_NAME ORDER BY COUNT(LAST_NAME) DESC
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
i need flight and fare information departing from OAKLAND to SALT LAKE CITY on thursday before 800
SELECT DISTINCT flight.flight_id FROM fare, flight, flight_fare WHERE (((flight.departure_time < 800 AND flight.flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 24 AND DATE_D...
CREATE TABLE table_51234 ( "Driver" text, "Car #" real, "Make" text, "Points" real, "Laps" real, "Winnings" text )
How many laps did Jeff Burton have when he drove car with a # over 9 and more than 118 points?
SELECT COUNT("Laps") FROM table_51234 WHERE "Car #" > '9' AND "Driver" = 'jeff burton' AND "Points" > '118'
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text )
What are the average star ratings of each movie title? Could you return me a bar chart?, show names from high to low order please.
SELECT title, AVG(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY title DESC
CREATE TABLE table_36946 ( "Season" text, "Tropical Lows" real, "Tropical Cyclones" real, "Severe Tropical Cyclones" real, "Strongest storm" text )
What is the least number of tropical cyclones when the strongest storm was Tiffany and less than 10 tropical lows.
SELECT MIN("Severe Tropical Cyclones") FROM table_36946 WHERE "Strongest storm" = 'tiffany' AND "Tropical Lows" > '10'
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, ...
give me the number of patients whose admission type is urgent and insurance is medicare?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.insurance = "Medicare"
CREATE TABLE table_name_55 ( years VARCHAR, decile VARCHAR, area VARCHAR )
Which years have a Decile larger than 4, and an Area of thames?
SELECT years FROM table_name_55 WHERE decile > 4 AND area = "thames"
CREATE TABLE organisations ( organisation_id number, organisation_type text, organisation_details text ) CREATE TABLE project_outcomes ( project_id number, outcome_code text, outcome_details text ) CREATE TABLE research_outcomes ( outcome_code text, outcome_description text ) CREATE T...
What are the details for all projects that did not hire any staff in a research role?
SELECT project_details FROM projects WHERE NOT project_id IN (SELECT project_id FROM project_staff WHERE role_code = 'researcher')
CREATE TABLE table_50227 ( "Player" text, "Sacks" real, "Ints" real, "Int Yds" real, "Int LG" real, "Int TD" real, "Fumb R." real, "Fumb Yds" real, "Fumb LG" real, "Fumb TD" real, "Fumb F." real )
Which Fumb Yds has a Fumb F. of 0, and a Int LG smaller than 0?
SELECT MAX("Fumb Yds") FROM table_50227 WHERE "Fumb F." = '0' AND "Int LG" < '0'
CREATE TABLE table_name_51 ( role VARCHAR, registration VARCHAR )
What is the role of the aircraft that has a registration of s5-hpb?
SELECT role FROM table_name_51 WHERE registration = "s5-hpb"
CREATE TABLE table_name_99 ( points VARCHAR, laps VARCHAR, grid VARCHAR )
How many points have 88 laps and a grid of 14?
SELECT points FROM table_name_99 WHERE laps = "88" AND grid = "14"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtim...
since 2102 what are the three most common medications prescribed to patients in the same month after a diagnosis of hypomagnesemia?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypomagnesemia' AND STRFTIME('%y', diagnosis.diagn...
CREATE TABLE table_train_36 ( "id" int, "do_not_resuscitate_dnr" bool, "active_infection" bool, "sepsis" bool, "vasospastic_diathesis" bool, "septic_shock" bool, "age" float, "NOUSE" float )
must be 18 years or older
SELECT * FROM table_train_36 WHERE age >= 18
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Visualize a bar chart about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road, and sort in asc by the how many acc road.
SELECT ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road ORDER BY COUNT(ACC_Road)
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_s...
list flights from PITTSBURGH to SAN FRANCISCO
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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN...
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 demographic ( subject_id text, hadm_id t...
how many patients who were diagnosed with personal history of venous thrombosis and embolism had lab test result as delta?
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 = "Personal history of venous thrombosis and embolism" AND lab.flag = "delta"
CREATE TABLE table_49763 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
what is score of a team with tie of 4?
SELECT "Score" FROM table_49763 WHERE "Tie no" = '4'
CREATE TABLE table_51611 ( "Date" text, "Opponents" text, "Score" text, "Competition" text, "Match Report" text )
What is the match report for July 10, 2005?
SELECT "Match Report" FROM table_51611 WHERE "Date" = 'july 10, 2005'
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_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 ( COUNTRY...
For those employees who get more salary than the employee whose id is 163, show the frequency of their last name, sort from high to low by the LAST_NAME.
SELECT LAST_NAME, COUNT(LAST_NAME) FROM employees WHERE SALARY > (SELECT SALARY FROM employees WHERE EMPLOYEE_ID = 163) GROUP BY LAST_NAME ORDER BY LAST_NAME 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 PostFeedback ( Id number, PostId numb...
Average Time for certain tags until accepted answer - work in progress.
SELECT p.Id, p.Tags, p.Title, CAST((JULIANDAY(CreationDate) - JULIANDAY(p.CreationDate)) * 24.0 AS INT) FROM Posts AS p INNER JOIN Posts AS p2 ON p.AcceptedAnswerId = p2.Id WHERE p.Id IN (12999100)
CREATE TABLE table_80311 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
What shows for nationality when there is a rank larger than 6, and a Time of 2:14.95?
SELECT "Nationality" FROM table_80311 WHERE "Rank" > '6' AND "Time" = '2:14.95'
CREATE TABLE table_54613 ( "Stage" real, "Date" text, "Course" text, "Distance" text, "Winner" text, "GC Leader" text )
Who is the GC leader at vila - segovia?
SELECT "GC Leader" FROM table_54613 WHERE "Course" = 'ávila - segovia'
CREATE TABLE table_29041 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
Which episode was directed by Jeff Woolnough and written by Christopher Ambrose?
SELECT "Title" FROM table_29041 WHERE "Directed by" = 'Jeff Woolnough' AND "Written by" = 'Christopher Ambrose'
CREATE TABLE table_1341598_22 ( result VARCHAR, incumbent VARCHAR )
What is the number of results for james shannon?
SELECT COUNT(result) FROM table_1341598_22 WHERE incumbent = "James Shannon"
CREATE TABLE table_22856 ( "Year" real, "Worldwide" real, "Africa" real, "America" real, "Asia" real, "Australia" real, "Europe" real )
What is the latest year that Europe had 471895?
SELECT MAX("Year") FROM table_22856 WHERE "Europe" = '471895'
CREATE TABLE table_73397 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successors formal installation" text )
What are all the states (class) when the successor was Joseph Anderson ( DR )?
SELECT "State (class)" FROM table_73397 WHERE "Successor" = 'Joseph Anderson ( DR )'
CREATE TABLE people ( people_id number, sex text, name text, date_of_birth text, height number, weight number ) CREATE TABLE candidate ( candidate_id number, people_id number, poll_source text, date text, support_rate number, consider_rate number, oppose_rate number,...
Return the poll resource associated with the most candidates.
SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate ...
Identify users by reputation across sites.
SELECT u1.Id AS "user_link", u2.Reputation FROM StackOverflow.dbo.Users AS u1 INNER JOIN "stackexchange.meta".dbo.Users AS u2 ON u1.AccountId = u2.AccountId WHERE u1.Reputation BETWEEN 65000 AND 67000 AND u2.Reputation BETWEEN 12000 AND 14000 LIMIT 10
CREATE TABLE table_28780 ( "Year (Ceremony)" text, "English title" text, "Arabic title" text, "Director" text, "Result" text )
When 2012 (85th) is the year (ceremony) how many results?
SELECT COUNT("Result") FROM table_28780 WHERE "Year (Ceremony)" = '2012 (85th)'
CREATE TABLE table_204_647 ( id number, "year" number, "film" text, "role" text, "language" text )
how many languages has he been in that are in the telugu language ?
SELECT COUNT(*) FROM table_204_647 WHERE "language" = 'telugu'
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayNa...
All posts for Tags machine-learning,Python and SVM.
SELECT Id, AnswerCount, Body, Tags FROM Posts WHERE Id IN (SELECT PostId FROM PostTags WHERE TagId = '5990' INTERSECT SELECT PostId FROM PostTags WHERE TagId = '16' INTERSECT SELECT PostId FROM PostTags WHERE TagId = '12408')
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...
for patient id 29767, specify the time of admission and marital status.
SELECT demographic.marital_status, demographic.admittime FROM demographic WHERE demographic.subject_id = "29767"
CREATE TABLE table_49550 ( "Volume:Issue" text, "Issue date(s)" text, "Weeks at number one" real, "Song" text, "Artist(s)" text )
Which Song has an Issue date(s) of 29 may - 26 june?
SELECT "Song" FROM table_49550 WHERE "Issue date(s)" = '29 may - 26 june'
CREATE TABLE table_20620 ( "Missouri vs." text, "Overall Record" text, "at Columbia" text, "at Opponents Venue" text, "at Neutral Site" text, "Last 5 Meetings" text, "Last 10 Meetings" text, "Current Streak" text, "Since Joining SEC" text )
What are the outcomes of the last 5 meetings where the overall record is UM, 2-1?
SELECT "Last 5 Meetings" FROM table_20620 WHERE "Overall Record" = 'UM, 2-1'
CREATE TABLE table_2950964_1 ( title VARCHAR, _number VARCHAR )
What is the title of book number 8?
SELECT title FROM table_2950964_1 WHERE _number = "8"
CREATE TABLE table_name_22 ( oppose VARCHAR, poll_source VARCHAR, unsure VARCHAR )
What percentage of people were opposed to the candidate based on the Time Poll poll that showed 6% of people were unsure?
SELECT oppose FROM table_name_22 WHERE poll_source = "time poll" AND unsure = "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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
How many patients with cerebral aneurysm/sda as their primary disease were born before the year 2126?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CEREBRAL ANEURYSM/SDA" AND demographic.dob_year < "2126"
CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating number(10), languages varchar2(20), releasedate Date, resolution number(10) ) CREATE TABLE artist ( artist_name varchar2(50), country va...
What is the country of origin of the artist who is female and produced a song in Bangla, and count them by a pie chart
SELECT T1.country, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = "Female" AND T2.languages = "bangla" GROUP BY T1.country
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...
What are the ULCS classes offered next Winter ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_cour...
CREATE TABLE table_name_57 ( years VARCHAR, runners_up VARCHAR )
What was the year of the competition in which Odd Grenland was the runner-up?
SELECT years FROM table_name_57 WHERE runners_up = "odd grenland"
CREATE TABLE table_79663 ( "Date" text, "Series" text, "Circuit" text, "City / State" text, "Winner" text, "Team" text )
Who is the Winner of the Nissan Motorsport Australia Team at the Oran Park Raceway?
SELECT "Winner" FROM table_79663 WHERE "Team" = 'nissan motorsport australia' AND "Circuit" = 'oran park raceway'
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 ( ...
among patients treated with base drug, how many of them had mild intellect disability?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Mild intellect disabilty" AND prescriptions.drug_type = "BASE"
CREATE TABLE table_name_97 ( attendance INTEGER, loss VARCHAR )
Loss of de la rosa (8 8) has what average attendance?
SELECT AVG(attendance) FROM table_name_97 WHERE loss = "de la rosa (8–8)"
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the sum of revenue , and group by attribute name.
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name
CREATE TABLE table_name_23 ( ntsc_m VARCHAR, pal_m VARCHAR )
What is the NTSC M for Pal M 525/60?
SELECT ntsc_m FROM table_name_23 WHERE pal_m = "525/60"
CREATE TABLE table_201_43 ( id number, "name" text, "canton" text, "district" text, "area\n(km2)" number, "population\n(as of 2005)" number, "date of law" text )
how many diekirch districts also have diekirch as their canton ?
SELECT COUNT("district") FROM table_201_43 WHERE "canton" = 'diekirch'
CREATE TABLE table_name_16 ( score VARCHAR, away_team VARCHAR, home_team VARCHAR )
What was the score of the game which featured the gold coast blaze as the away team and the adelaide 36ers as the home team?
SELECT score FROM table_name_16 WHERE away_team = "gold coast blaze" AND home_team = "adelaide 36ers"
CREATE TABLE table_45414 ( "Position" real, "Name" text, "Played" real, "Drawn" real, "Lost" real, "Points" real )
what is the least drawn when the name is sv apfeldorf and the position is more than 8?
SELECT MIN("Drawn") FROM table_45414 WHERE "Name" = 'sv apfeldorf' AND "Position" > '8'
CREATE TABLE table_15778392_1 ( theme VARCHAR, week__number VARCHAR )
WHERE THE WEEK NUMBER WAS TOP 8, WHAT WAS THE THEME?
SELECT theme FROM table_15778392_1 WHERE week__number = "Top 8"
CREATE TABLE table_name_87 ( Id VARCHAR )
What is the 2007 value with NMS in 2011?
SELECT 2007 FROM table_name_87 WHERE 2011 = "nms"
CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget numeric(12,2) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2)...
How many courses are in the Psychology department for each year? Return a line chart, and display from low to high by the x axis.
SELECT year, COUNT(year) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY year
CREATE TABLE table_204_409 ( id number, "date" text, "race name" text, "location" text, "uci rating" number, "winner" text, "team" text )
who was the winner of the first race on the tour ?
SELECT "winner" FROM table_204_409 WHERE id = 1
CREATE TABLE table_65248 ( "Opposing Team" text, "Against" real, "Date" text, "Venue" text, "Status" text )
Which the lowest Against has a Status of tour match, and a Venue of ravenhill , belfast?
SELECT MIN("Against") FROM table_65248 WHERE "Status" = 'tour match' AND "Venue" = 'ravenhill , belfast'
CREATE TABLE table_13794 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "Total Apps" text, "Total Goals" real )
Which position has 5 total apps?
SELECT "Position" FROM table_13794 WHERE "Total Apps" = '5'
CREATE TABLE table_name_94 ( outcome VARCHAR, partner VARCHAR )
What is the outcome of the match when the partner is Nicole Arendt?
SELECT outcome FROM table_name_94 WHERE partner = "nicole arendt"
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, ...
Vote history for a question.
SELECT * FROM Votes WHERE (EXISTS(SELECT * FROM Posts WHERE ParentId = @QuestionId AND Id = PostId) OR PostId = @QuestionId) AND (VoteTypeId = 8 OR VoteTypeId = 9) ORDER BY CreationDate
CREATE TABLE table_25178 ( "Version" text, "Release date" text, "Distribution mechanism" text, "Features" text, "Security issues" text )
If the distribution mechanism is windows nt 4.0 option pack Microsoft office 97 and the features is service release, what is the version?
SELECT "Version" FROM table_25178 WHERE "Features" = 'Service release' AND "Distribution mechanism" = 'Windows NT 4.0 Option Pack Microsoft Office 97'
CREATE TABLE table_name_47 ( date VARCHAR, visiting_team VARCHAR )
Name the date with visiting team of philadelphia eagles
SELECT date FROM table_name_47 WHERE visiting_team = "philadelphia eagles"
CREATE TABLE table_56826 ( "Chemical class" text, "Group" text, "Formula" text, "Prefix" text, "Suffix" text )
Which item has the suffix containing thiocyanato- (-scn) as a prefix?
SELECT "Suffix" FROM table_56826 WHERE "Prefix" = 'thiocyanato- (-scn)'
CREATE TABLE table_name_49 ( record VARCHAR, home VARCHAR, score VARCHAR )
Which Record has a Home of edmonton oilers, and a Score of 3 6?
SELECT record FROM table_name_49 WHERE home = "edmonton oilers" AND score = "3–6"
CREATE TABLE table_39874 ( "Season" text, "Team" text, "Conf." text, "Conf. finish" text, "Div." text, "Div. Finish" text, "Awards" text, "Head coach" text )
what is the division in the western conference that finished 2nd in their division under rick adelman?
SELECT "Div." FROM table_39874 WHERE "Conf." = 'western' AND "Div. Finish" = '2nd' AND "Head coach" = 'rick adelman'