table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_62754 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
How many lanes have a rank greater than 8?
SELECT SUM("Lane") FROM table_62754 WHERE "Rank" > '8'
CREATE TABLE table_name_41 ( position VARCHAR, name VARCHAR )
What position did kyle mckenzie play?
SELECT position FROM table_name_41 WHERE name = "kyle mckenzie"
CREATE TABLE table_name_71 ( touchdowns INTEGER, field_goals INTEGER )
Who had the most touchdowns with more than 0 Field goals?
SELECT MAX(touchdowns) FROM table_name_71 WHERE field_goals > 0
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...
count the number of patients who were diagnosed with hyperkalemia - due to excess intake.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'hyperkalemia - due to excess intake')
CREATE TABLE table_53802 ( "Nation" text, "Gold" text, "Silver" text, "Bronze" text, "Total" real )
How many silvers for finland?
SELECT "Silver" FROM table_53802 WHERE "Nation" = 'finland'
CREATE TABLE table_203_336 ( id number, "#" number, "date" text, "opponent" text, "score" text, "win" text, "loss" text, "save" text, "attendance" number, "record" text )
what was the difference in attendance between july 7 and july 8 ?
SELECT ABS((SELECT "attendance" FROM table_203_336 WHERE "date" = 'july 7') - (SELECT "attendance" FROM table_203_336 WHERE "date" = 'july 8'))
CREATE TABLE table_19417244_2 ( directed_by VARCHAR, us_viewers__millions_ VARCHAR )
who directed the episode that have 14.59 million viewers
SELECT directed_by FROM table_19417244_2 WHERE us_viewers__millions_ = "14.59"
CREATE TABLE table_1708050_3 ( wins INTEGER, position VARCHAR )
Name the most wins where position is 16th
SELECT MAX(wins) FROM table_1708050_3 WHERE position = "16th"
CREATE TABLE table_47344 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
On what date did they play in Boston Garden with a record of 22-4?
SELECT "Date" FROM table_47344 WHERE "Location" = 'boston garden' AND "Record" = '22-4'
CREATE TABLE table_45166 ( "Season" real, "Winner" text, "Team" text, "Goals" text, "Assists" text, "Points" text )
How many points when Bill Benson was the winner?
SELECT "Points" FROM table_45166 WHERE "Winner" = 'bill benson'
CREATE TABLE table_12842068_1 ( submitting_country VARCHAR, film_title_used_in_nomination VARCHAR )
What country submitted the movie the orphanage?
SELECT submitting_country FROM table_12842068_1 WHERE film_title_used_in_nomination = "The Orphanage"
CREATE TABLE table_12218 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
What is the lowest score that has t10 as the place, with Ireland as the country?
SELECT MIN("Score") FROM table_12218 WHERE "Place" = 't10' AND "Country" = 'ireland'
CREATE TABLE table_34263 ( "Name" text, "Council Seat" text, "Formed" real, "Population (2010)" real, "Area" text, "Website" text )
What is the name of the metropolitan that has a population larger than 35,082 and formed after 1897?
SELECT "Name" FROM table_34263 WHERE "Population (2010)" > '35,082' AND "Formed" > '1897'
CREATE TABLE table_name_74 ( position VARCHAR, player VARCHAR, goals VARCHAR, points VARCHAR )
Mike Forshaw had 0 goals and 28 points. What is his position?
SELECT position FROM table_name_74 WHERE goals = 0 AND points = 28 AND player = "mike forshaw"
CREATE TABLE table_name_39 ( home_team VARCHAR, venue VARCHAR )
Which team plays at Lake Oval?
SELECT home_team FROM table_name_39 WHERE venue = "lake oval"
CREATE TABLE table_203_211 ( id number, "pos." number, "time" text, "athlete" text, "country" text, "venue" text, "date" text )
how many athletes were faster than 12.40 seconds ?
SELECT COUNT("athlete") FROM table_203_211 WHERE "time" < 12.40
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 admissions ( row_id number, subject_id number, hadm...
what was the first ph laboratory test time patient 31482 had during this month?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ph') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31482) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIM...
CREATE TABLE table_name_97 ( area_km_2 INTEGER, census_ranking VARCHAR )
What is the area of the community with a census ranking of 636 of 5,008?
SELECT AVG(area_km_2) FROM table_name_97 WHERE census_ranking = "636 of 5,008"
CREATE TABLE table_11975 ( "Date" text, "Tournament" text, "Winning Score" text, "Margin of Victory" text, "Runner-up" text )
Who was the runner up in the konica san jose classic Tournament?
SELECT "Runner-up" FROM table_11975 WHERE "Tournament" = 'konica san jose classic'
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) 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,...
Is WRITING 303 available to me in Winter 2011 ?
SELECT COUNT(*) > 0 FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN...
CREATE TABLE table_53530 ( "Pick" real, "Player" text, "Country of origin*" text, "PBA team" text, "College" text )
What college has pick 45
SELECT "College" FROM table_53530 WHERE "Pick" = '45'
CREATE TABLE table_34643 ( "Year" real, "US Cham. Rank" real, "US Cham. Spending" text, "Next Highest Spender" text, "Next Highest Amount" text )
Which Year is the highest one that has a Next Highest Spender of aarp, and a US Cham Spending of $39,805,000, and a US Cham Rank larger than 1?
SELECT MAX("Year") FROM table_34643 WHERE "Next Highest Spender" = 'aarp' AND "US Cham. Spending" = '$39,805,000' AND "US Cham. Rank" > '1'
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE l...
how many patients have received sedative agent - propofol after the first insulin during the same hospital visit since 6 years ago?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'insulin' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME()...
CREATE TABLE table_name_38 ( races VARCHAR, points VARCHAR )
Which races did they accumulate at least 125 points?
SELECT races FROM table_name_38 WHERE points = "125"
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...
count the number of patients whose discharge location is short term hospital and procedure long title is other endoscopy of small intestine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND procedures.long_title = "Other endoscopy of small intestine"
CREATE TABLE table_27847088_1 ( viewers__millions_ VARCHAR, series_no VARCHAR )
How many were the viewers (in millions) of the series no. 45?
SELECT viewers__millions_ FROM table_27847088_1 WHERE series_no = 45
CREATE TABLE table_name_81 ( Id VARCHAR )
What is 2009, when 2004 is 2R, and when 1993 is A?
SELECT 2009 FROM table_name_81 WHERE 2004 = "2r" AND 1993 = "a"
CREATE TABLE apartment_facilities ( apt_id number, facility_code text ) CREATE TABLE apartments ( apt_id number, building_id number, apt_type_code text, apt_number text, bathroom_count number, bedroom_count number, room_count text ) CREATE TABLE guests ( guest_id number, ge...
What are the first names and last names of all the guests?
SELECT guest_first_name, guest_last_name FROM guests
CREATE TABLE aircraft ( Aircraft_ID int, Order_Year int, Manufacturer text, Model text, Fleet_Series text, Powertrain text, Fuel_Propulsion text ) CREATE TABLE pilot_record ( Record_ID int, Pilot_ID int, Aircraft_ID int, Date text ) CREATE TABLE pilot ( Pilot_ID int, ...
Please compare the frequency of the position of the pilots using a bar chart.
SELECT Position, COUNT(Position) FROM pilot GROUP BY Position
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id...
what were the five drugs most frequently prescribed to the male patients aged 40s in the same hospital visit after being diagnosed with pneumonia, organism nos?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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 FROM d_...
CREATE TABLE table_name_84 ( position INTEGER, difference VARCHAR, drawn VARCHAR )
Which Position has a Difference of 5, and a Drawn smaller than 3?
SELECT MIN(position) FROM table_name_84 WHERE difference = "5" AND drawn < 3
CREATE TABLE table_10975034_2 ( player VARCHAR, college VARCHAR )
Which player from the 2004 CFL draft attended Wilfrid Laurier?
SELECT player FROM table_10975034_2 WHERE college = "Wilfrid Laurier"
CREATE TABLE table_42361 ( "State" text, "Seats (ACs)" real, "Date of Counting" text, "Incumbent" text, "Election Winner" text )
What is the smallest number of seats with INC as an election winner and BJP incumbent?
SELECT MIN("Seats (ACs)") FROM table_42361 WHERE "Election Winner" = 'inc' AND "Incumbent" = 'bjp'
CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int )
Stack bar chart of the number of type vs Nationality based on type, I want to rank the number of type in asc order.
SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY COUNT(Type)
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...
what is the number of patients whose ethnicity is white and diagnoses icd9 code is 41512?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.icd9_code = "41512"
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...
what is gender and lab test abnormal status of subject id 2110?
SELECT demographic.gender, lab.flag FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "2110"
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 procedures ( ...
give me the number of patients whose admission year is less than 2135 and diagnoses icd9 code is 2859?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2135" AND diagnoses.icd9_code = "2859"
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, ...
how many patients were prescribed with chlorhexidine gluconate 0.12 % mouth/throat soln multidose?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'chlorhexidine gluconate 0.12 % mouth/throat soln multidose')
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...
count the number of patients whose age is less than 63 and drug type is base?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "63" AND prescriptions.drug_type = "BASE"
CREATE TABLE table_37702 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text )
When was republican incumbent Joseph McKenna first elected?
SELECT "First elected" FROM table_37702 WHERE "Party" = 'republican' AND "Incumbent" = 'joseph mckenna'
CREATE TABLE table_57970 ( "Episode" real, "Rating" real, "Share" real, "Rating/share (18-49)" text, "Rank (Timeslot)" real, "Rank (Night)" real )
What is the timeslor rank for the episode with larger than 2.9 rating, rating/share of 2.6/8 and rank for the night higher than 5?
SELECT AVG("Rank (Timeslot)") FROM table_57970 WHERE "Rating" > '2.9' AND "Rating/share (18-49)" = '2.6/8' AND "Rank (Night)" > '5'
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
provide the number of patients whose insurance is medicare and diagnoses short title is idio periph neurpthy nos?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.short_title = "Idio periph neurpthy NOS"
CREATE TABLE table_32222 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What's the lowest round with the opponent John Howard that had a method of Decision (unanimous)?
SELECT MIN("Round") FROM table_32222 WHERE "Method" = 'decision (unanimous)' AND "Opponent" = 'john howard'
CREATE TABLE table_59209 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What is the total for player karrie webb?
SELECT COUNT("Total") FROM table_59209 WHERE "Player" = 'karrie webb'
CREATE TABLE table_name_12 ( away_team VARCHAR, home_team VARCHAR )
Who is the away team that played home team of Perth Wildcats?
SELECT away_team FROM table_name_12 WHERE home_team = "perth wildcats"
CREATE TABLE table_62085 ( "Device" text, "Carrier" text, "Package Version" text, "Applications" text, "Software Platform" text )
WHAT IS THE PACKAGE VERSION WITH TELUS MOBILITY?
SELECT "Package Version" FROM table_62085 WHERE "Carrier" = 'telus mobility'
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description...
No of users who have answered a question.
SELECT COUNT(user_posts) FROM (SELECT COUNT(*) AS user_posts FROM Posts WHERE NOT OwnerUserId IS NULL AND PostTypeId = 2 GROUP BY OwnerUserId) AS a
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...
count the number of patients whose admission location is clinic referral/premature and procedure icd9 code is 45?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "45"
CREATE TABLE table_9864 ( "Name" text, "Position" text, "Height" text, "Weight" real, "Year" text, "Home Town" text )
What is the total combined weight of players from minnetonka, mn?
SELECT SUM("Weight") FROM table_9864 WHERE "Home Town" = 'minnetonka, mn'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
tell me how much urine catheter patient 015-92657 has produced since 04/16/2104.
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-92657')) AND intakeoutput.celllabel = 'urine...
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 below 77 years of age have undergone the procedure with short title percu endosc gastrostomy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "77" AND procedures.short_title = "Percu endosc gastrostomy"
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ...
count the number of patients who have received a microbiological eye test since 2 years ago.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'eye' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-2 year'))
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
when was patient 006-227759 first tested at a laboratory until 10/2101?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-227759')) AND STRFTIME('%y-%m', lab.labresulttime) <= '2101-10' ORDER BY lab.la...
CREATE TABLE table_55646 ( "Player" text, "Pos." text, "From" real, "School/Country" text, "Rebs" real, "Asts" real )
What is the low rebound total for players from Oklahoma before 1975?
SELECT MIN("Rebs") FROM table_55646 WHERE "School/Country" = 'oklahoma' AND "From" < '1975'
CREATE TABLE suppliers ( supplier_id number, supplier_name text, supplier_phone text ) CREATE TABLE supplier_addresses ( supplier_id number, address_id number, date_from time, date_to time ) CREATE TABLE customer_orders ( order_id number, customer_id number, order_status_code t...
Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.
SELECT staff_id FROM staff_department_assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM staff_department_assignments WHERE job_title_code = 'Clerical Staff')
CREATE TABLE table_name_24 ( overall INTEGER, pick VARCHAR, college VARCHAR )
How many overalls have a pick greater than 19, with florida as the college?
SELECT SUM(overall) FROM table_name_24 WHERE pick > 19 AND college = "florida"
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
for the last time, when they came to the hospital first time how much etomidate was prescribed to patient 18677?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18677 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'etomidate' ORDER BY prescriptions.startdate DESC LIMIT 1
CREATE TABLE table_name_80 ( year VARCHAR, actor VARCHAR, film VARCHAR, category VARCHAR )
What year was Jennifer Tilly's Film of Bullets Over Broadway up in the best supporting actress category?
SELECT year FROM table_name_80 WHERE film = "bullets over broadway" AND category = "best supporting actress" AND actor = "jennifer tilly"
CREATE TABLE table_204_292 ( id number, "no." number, "name" text, "class" number, "games" number, "minutes" number, "points" number, "2 points\n(made/attempts)" text, "2 points\n(%)" number, "3 points\n(made/attempts)" text, "3 points\n(%)" number, "free throws\n(made/at...
next to merritt , who was the top scorer ?
SELECT "name" FROM table_204_292 WHERE "name" <> 'amber merritt' ORDER BY "points" DESC LIMIT 1
CREATE TABLE table_204_612 ( id number, "draft order\nround" number, "draft order\nchoice" number, "player" text, "position" text, "height" text, "weight" text, "college" text )
who was the tallest player drafted ?
SELECT "player" FROM table_204_612 ORDER BY "height" DESC LIMIT 1
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
When is the next time the Pharmacotherapeutics will be offered ?
SELECT DISTINCT semester.semester, semester.year FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.name LIKE '%Pharmacotherapeutics%' AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FRO...
CREATE TABLE table_name_55 ( pick VARCHAR, college VARCHAR, player VARCHAR )
What is Far Eastern College Johnny Abarrientos' Pick number?
SELECT pick FROM table_name_55 WHERE college = "far eastern" AND player = "johnny abarrientos"
CREATE TABLE table_2668416_18 ( party VARCHAR, incumbent VARCHAR )
In how many different parts was the incumbent Abraham B. Venable?
SELECT COUNT(party) FROM table_2668416_18 WHERE incumbent = "Abraham B. Venable"
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 procedures ( ...
Provide the number of patients having lab test fluid as pleural that were diagnosed with adv eff benzodiaz tranq.
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 = "Adv eff benzodiaz tranq" AND lab.fluid = "Pleural"
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Show me about the distribution of All_Neutral and School_ID in a bar chart, rank in ascending by the x-axis.
SELECT All_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral
CREATE TABLE table_19468 ( "Team" text, "# appearances" real, "years (won in bold)" text, "# wins" real, "# runner-up" real, "Most recent final" text )
What is the number of appearances where the most recent final result is 1999, beat Genk 3-1?
SELECT COUNT("# appearances") FROM table_19468 WHERE "Most recent final" = '1999, beat Genk 3-1'
CREATE TABLE table_name_27 ( visitor VARCHAR, date VARCHAR )
Who was the visiting team on April 6?
SELECT visitor FROM table_name_27 WHERE date = "april 6"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, ...
tell me the maximum total cost of a hospital that contains pregnancy since 2104?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'pregnancy')) AND STRFTIME('%y', cost.charget...
CREATE TABLE Visits ( Visit_ID INTEGER, Tourist_Attraction_ID INTEGER, Tourist_ID INTEGER, Visit_Date DATETIME, Visit_Details VARCHAR(40) ) CREATE TABLE Tourist_Attraction_Features ( Tourist_Attraction_ID INTEGER, Feature_ID INTEGER ) CREATE TABLE Royal_Family ( Royal_Family_ID INTEGER...
Show different ways to get to attractions and the number of attractions that can be accessed in the corresponding way. Plot them as bar chart.
SELECT How_to_Get_There, COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There
CREATE TABLE table_17680 ( "Character" text, "Portrayed by" text, "Main cast seasons" text, "Recurring cast seasons" text, "# of episodes" real )
What seasons does Nick Lucas appear in?
SELECT "Recurring cast seasons" FROM table_17680 WHERE "Character" = 'Nick Lucas'
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 are discharged due to short term hospital and tested with potassium whole blood?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND lab.label = "Potassium, Whole Blood"
CREATE TABLE table_train_61 ( "id" int, "white_blood_cell_count_wbc" int, "in_another_study" bool, "systolic_blood_pressure_sbp" int, "trauma" bool, "temperature" float, "anc" int, "hypotension" bool, "heart_rate" int, "paco2" float, "gastrointestinal_disease" bool, "burn...
gastrointestinal hemorrhage, seizure, drug overdose, burn or trauma
SELECT * FROM table_train_61 WHERE gastrointestinal_disease = 1 OR seizure_disorder = 1 OR drug_abuse = 1 OR burn_injury > 0 OR trauma = 1
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 diagnosis of current alcohol related problems
SELECT * FROM table_train_138 WHERE alcohol_abuse = 1
CREATE TABLE table_67700 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What would be the lowest Attendance that also showed a loss of Obermueller (1-2)?
SELECT MIN("Attendance") FROM table_67700 WHERE "Loss" = 'obermueller (1-2)'
CREATE TABLE table_19508635_1 ( order__number VARCHAR, theme VARCHAR )
Name the order number for 1960s
SELECT order__number FROM table_19508635_1 WHERE theme = "1960s"
CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number, secretary_vote number, treasurer_vote number, class_president_vote number, class_senator_vote number ) CREATE TABLE student ( stuid number, ...
What are the first and last names of all the female students who have president votes?
SELECT DISTINCT T1.fname, T1.lname FROM student AS T1 JOIN voting_record AS T2 ON T1.stuid = T2.president_vote WHERE T1.sex = "F"
CREATE TABLE table_28352 ( "\u00d7" text, "Wehdat" text, "Faisaly" text, "Ramtha" text, "Ahli" text, "Hussein" text, "Jazeera" text, "Amman" text, "Qadisiya" text, "Jeel" text, "Baqaa" text )
what is the capital where it is ramtha
SELECT "Qadisiya" FROM table_28352 WHERE "\u00d7" = 'Ramtha'
CREATE TABLE table_66397 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the Attendance of the game in Week 12?
SELECT MAX("Attendance") FROM table_66397 WHERE "Week" = '12'
CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE inst ( instid number, name text, country text ) CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE papers ( paperid number, title text )
What are the papers published under the institution 'Indiana University'?
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University"
CREATE TABLE table_name_39 ( attendance VARCHAR, week VARCHAR, opponent VARCHAR )
Which attendance number was taken in a week less than 16 when the Washington Redskins were the opponents?
SELECT attendance FROM table_name_39 WHERE week < 16 AND opponent = "washington redskins"
CREATE TABLE table_name_28 ( nation VARCHAR, gold VARCHAR, bronze VARCHAR )
For what nation is the gold medals 0, and the bronze medals less than 1?
SELECT nation FROM table_name_28 WHERE gold = 0 AND bronze < 1
CREATE TABLE table_35448 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the score for the game on February 29?
SELECT "Score" FROM table_35448 WHERE "Date" = 'february 29'
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAd...
Top 5k Users by Reputation per Post.
SELECT (u.Reputation / COUNT(p.OwnerUserId)) AS "Rep Per Post", u.DisplayName, COUNT(p.OwnerUserId) AS "Posts", u.Reputation FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE u.Reputation >= 5000 GROUP BY u.Reputation, u.DisplayName ORDER BY (u.Reputation / COUNT(p.OwnerUserId)) DESC
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 prescriptions...
calculate the total number of patients with item id 51244
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51244"
CREATE TABLE table_41983 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Set 4" text, "Set 5" text, "Total" text )
What is the total of the 3-0 score with a set 2 of 25-12 and a set 3 of 25-18?
SELECT "Total" FROM table_41983 WHERE "Score" = '3-0' AND "Set 3" = '25-18' AND "Set 2" = '25-12'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
what is the names of the medications which patient 004-7984 was allergic to until 36 months ago?
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-7984')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME(), '-...
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, Acc...
Ratio of downvoted questions over time.. Look at the Graph, to see the evolution of the upvote/downvote ratio.
SELECT DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), 1) AS YearMonth, 1 / (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS FLOAT), 0)) AS Ratio FROM Votes WHERE CreationDate > '01-01-2010' GROUP BY DATEFROMPARTS(YEAR(CreationDate),...
CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date )
Find the average rating star for each movie that are not reviewed by Brittany Harris. Plot them as scatter chart.
SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
CREATE TABLE club ( Club_ID int, Club_name text, Region text, Start_year int ) CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starti...
Draw a bar chart of gender versus the number of gender
SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender
CREATE TABLE table_name_47 ( years VARCHAR, nation VARCHAR, assist VARCHAR, rank VARCHAR )
Which years did the USA have a rank lower than 6 and an assist number less than 26?
SELECT years FROM table_name_47 WHERE assist < 26 AND rank < 6 AND nation = "usa"
CREATE TABLE enzyme ( id int, name text, Location text, Product text, Chromosome text, OMIM int, Porphyria text ) CREATE TABLE medicine ( id int, name text, Trade_Name text, FDA_approved text ) CREATE TABLE medicine_enzyme_interaction ( enzyme_id int, medicine_id in...
Visualize a bar chart for what are the ids and trade names of the medicine that can interact with at least 3 enzymes?, could you sort x-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 Trade_Name DESC
CREATE TABLE table_name_71 ( avg_g INTEGER, long VARCHAR, loss VARCHAR )
Which Avg/G has a Long of 93, and a Loss smaller than 249?
SELECT SUM(avg_g) FROM table_name_71 WHERE long = 93 AND loss < 249
CREATE TABLE table_28472 ( "Character" text, "Played by" text, "Season 1" real, "Season 2" real, "Season 3" real, "Season 4" real, "First Appearance" text )
How many season 4 appearances are there by Mrs. Jennifer Knight?
SELECT MIN("Season 4") FROM table_28472 WHERE "Character" = 'Mrs. Jennifer Knight'
CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, s...
Visualize a pie chart to show the credit scores of customers who have taken a loan by different names.
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID
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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, ...
when is the last time patient 4758 visited the hospital since 2105?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 4758 AND STRFTIME('%y', admissions.admittime) >= '2105' ORDER BY admissions.admittime DESC LIMIT 1
CREATE TABLE Claims_Processing ( Claim_Processing_ID INTEGER, Claim_ID INTEGER, Claim_Outcome_Code CHAR(15), Claim_Stage_ID INTEGER, Staff_ID INTEGER ) CREATE TABLE Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATETIME, End_Date DATETI...
Find the number of records of each policy type and its type code. Visualize by bar chart.
SELECT Policy_Type_Code, COUNT(*) FROM Policies GROUP BY Policy_Type_Code
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...
count the number of patients whose discharge location is short term hospital and year of birth is less than 2078?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.dob_year < "2078"
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id numbe...
what is the percentile 109.0 in the laboratory test of chloride with regard to the same age of patient 15986 in their current hospital encounter?
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age ...
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 Users ( Id number, Reputation number,...
Tags with a high proportion of unanswered questions. with score <= 0, low views, no answers
SELECT t.TagName, 100 * CAST(COUNT(p.Id) AS FLOAT) / COUNT(*) AS "% Unanswered", COUNT(p.Id) AS Unanswered, COUNT(*) AS Posts FROM Tags AS t LEFT JOIN PostTags AS pt ON t.Id = pt.TagId LEFT OUTER JOIN Posts AS p ON pt.PostId = p.Id AND p.PostTypeId = 1 AND p.ViewCount < 500 AND (p.AnswerCount < 1 OR p.AnswerCount IS NU...
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
what were the three most frequent drugs that were prescribed within 2 months to patients of age 30s after they had been diagnosed with hyperglycemia - stress related since 2104.
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 = 'hyperglycemia - stress related' AND STRFTIME('%y',...