table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE table_203_742 ( id number, "rnd" number, "date" text, "race name" text, "circuit" text, "city/location" text, "pole position" text, "fastest lap" text, "winning driver" text, "winning team" text, "report" text )
the race on march 5 took place in miami , florida . where did the next race take place ?
SELECT "city/location" FROM table_203_742 WHERE "date" > (SELECT "date" FROM table_203_742 WHERE "date" = 'march 5') ORDER BY "date" LIMIT 1
CREATE TABLE table_80223 ( "Year" real, "Alabama" text, "Arkansas" text, "Auburn" text, "Ole Miss" text, "Mississippi St." text )
Who is the Arkansas player associated with Ken Stabler?
SELECT "Arkansas" FROM table_80223 WHERE "Alabama" = 'ken stabler'
CREATE TABLE table_46635 ( "Model Number" text, "Frequency" text, "L2-Cache" text, "Front Side Bus" text, "Multiplier" text, "Voltage" text, "Socket" text )
What is the Front Side Bus for Model Number c3 850?
SELECT "Front Side Bus" FROM table_46635 WHERE "Model Number" = 'c3 850'
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
count the number of patients whose primary disease is sdh and lab test fluid is pleural?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "SDH" AND lab.fluid = "Pleural"
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_fro...
what airlines fly between BOSTON and SAN FRANCISCO
SELECT DISTINCT airline.airline_code FROM airline, 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_na...
CREATE TABLE asset_parts ( asset_id number, part_id number ) CREATE TABLE maintenance_engineers ( engineer_id number, company_id number, first_name text, last_name text, other_details text ) CREATE TABLE fault_log_parts ( fault_log_entry_id number, part_fault_id number, fault_s...
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
SELECT COUNT(*), T1.fault_log_entry_id FROM fault_log AS T1 JOIN engineer_visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_name_75 ( date_of_vacancy VARCHAR, team VARCHAR )
What is the vacancy date of Dundee?
SELECT date_of_vacancy FROM table_name_75 WHERE team = "dundee"
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...
I want to see trend of the number of date of notes by date of notes, and show x-axis from low to high order.
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY date_of_notes
CREATE TABLE table_60886 ( "Team" text, "Club home city" text, "2006\u201307 Season" text, "Stadium" text, "Stadium capacity" text )
What is 2006-07 Season, when Team is 'KF Fush Kosova'?
SELECT "2006\u201307 Season" FROM table_60886 WHERE "Team" = 'kf fushë kosova'
CREATE TABLE table_72114 ( "Rnd" text, "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text )
What rnds were there for the phoenix international raceway?
SELECT "Rnd" FROM table_72114 WHERE "Circuit" = 'Phoenix International Raceway'
CREATE TABLE table_76747 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text )
Which college has a nose tackle position?
SELECT "College" FROM table_76747 WHERE "Position" = 'nose tackle'
CREATE TABLE table_name_80 ( up_for_reelection INTEGER, took_office VARCHAR, position VARCHAR )
What is the earliest year a Chairman who took office after 2011 is up for reelection?
SELECT MIN(up_for_reelection) FROM table_name_80 WHERE took_office > 2011 AND position = "chairman"
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName te...
Average age of SO User.
SELECT COUNT(*) FROM Votes
CREATE TABLE table_204_642 ( id number, "team" text, "domestic tournament" text, "position" text, "appearance" text, "qualified" text )
which team came in after the titans in the miway t20 challenge ?
SELECT "team" FROM table_204_642 WHERE "appearance" > (SELECT "appearance" FROM table_204_642 WHERE "team" = 'titans' AND "domestic tournament" = '2011-12 miway t20 challenge') AND "domestic tournament" = '2011-12 miway t20 challenge' ORDER BY "appearance" LIMIT 1
CREATE TABLE table_name_80 ( date VARCHAR, round VARCHAR )
what is the date when the round is qf?
SELECT date FROM table_name_80 WHERE round = "qf"
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConce...
Top Android Dev in Malaysia Based on UpVote.
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =...
CREATE TABLE table_47368 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
what is the location attendance when the high assists is by ramon sessions (8) on march 30?
SELECT "Location Attendance" FROM table_47368 WHERE "High assists" = 'ramon sessions (8)' AND "Date" = 'march 30'
CREATE TABLE table_22683369_8 ( league INTEGER )
What was the lowest number of points scored in the league cup?
SELECT MIN(league) AS Cup FROM table_22683369_8
CREATE TABLE table_name_23 ( country VARCHAR, rank VARCHAR )
Which Country has a Rank of 5?
SELECT country FROM table_name_23 WHERE rank = 5
CREATE TABLE table_49024 ( "School Year" text, "Volleyball" text, "Cross Country" text, "Soccer" text, "Tennis" text, "Golf" text )
What is Tennis, when School Year is 2004-05?
SELECT "Tennis" FROM table_49024 WHERE "School Year" = '2004-05'
CREATE TABLE table_36614 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
In what Round was a Defensive Tackle Pick # less than 19?
SELECT COUNT("Round") FROM table_36614 WHERE "Position" = 'defensive tackle' AND "Pick #" < '19'
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amoun...
Give me a histogram to show the date and the amount for all the payments processed with Visa, order y axis in descending order.
SELECT Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY Amount_Payment DESC
CREATE TABLE d_labitems ( row_id number, itemid number, label 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 ) CREATE TABLE labevents ( ro...
what is the maximum base excess value of patient 19412 during this month?
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19412) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'base excess') AND DATETIME(labevents.charttime, 'start of month') = DATETIM...
CREATE TABLE table_45361 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Location" text )
What is Event, when Method is 'Submission (Armbar)', and when Opponent is 'Jason St. Louis'?
SELECT "Event" FROM table_45361 WHERE "Method" = 'submission (armbar)' AND "Opponent" = 'jason st. louis'
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) 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 t...
what flights leave from NASHVILLE to PHOENIX
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 = 'NASHVILLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHOE...
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE proce...
have any laboratory tests been performed since 2102 on patient 21454?
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21454) AND STRFTIME('%y', labevents.charttime) >= '2102'
CREATE TABLE table_name_25 ( country VARCHAR, player VARCHAR )
WHAT COUNTRY HAS A PLAYER NAMED JACK NICKLAUS?
SELECT country FROM table_name_25 WHERE player = "jack nicklaus"
CREATE TABLE table_name_73 ( nationality VARCHAR, school_club_team VARCHAR )
What is the nationality of the Team Purdue?
SELECT nationality FROM table_name_73 WHERE school_club_team = "purdue"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
what is procedure short title of subject name stephanie suchan?
SELECT procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Stephanie Suchan"
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, ...
tell me about TW flight 539
SELECT DISTINCT flight_id FROM flight WHERE airline_code = 'TW' AND flight_number = 539
CREATE TABLE table_204_10 ( id number, "ecclesiastical jurisdictions" text, "latin name" text, "type" text, "rite" text, "ecclesiastical province" text, "established" text, "area (km2)" number )
how many dioceses were established before 1978 ?
SELECT COUNT("ecclesiastical jurisdictions") FROM table_204_10 WHERE "established" < 1978
CREATE TABLE table_9284 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who had the highest rebounds on December 30?
SELECT "High rebounds" FROM table_9284 WHERE "Date" = 'december 30'
CREATE TABLE table_27535 ( "Round" text, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning driver" text, "Winning team" text )
Name the circuit for 13 july
SELECT "Circuit" FROM table_27535 WHERE "Date" = '13 July'
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT )
Return a bar chart on what is the average age for each gender?, I want to list by the mean age in descending.
SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY AVG(age) DESC
CREATE TABLE table_204_697 ( id number, "song" text, "artist(s)" text, "concert" number, "film" number, "1978 album" number, "2002 album" number )
which song is previous to georgia on my mind
SELECT "song" FROM table_204_697 WHERE id = (SELECT id FROM table_204_697 WHERE "song" = '"georgia on my mind"') - 1
CREATE TABLE table_204_888 ( id number, "location" text, "mile" number, "destinations" text, "notes" text )
what note is before former md 453 ?
SELECT "notes" FROM table_204_888 WHERE id = (SELECT id FROM table_204_888 WHERE "notes" = 'former md 453') - 1
CREATE TABLE products ( product_id number, product_name text, product_price number, product_description text ) CREATE TABLE order_deliveries ( location_code text, actual_order_id number, delivery_status_code text, driver_employee_id number, truck_id number, delivery_date time ) ...
List the state names and the number of customers living in each state.
SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
have there been any microbiology tests for patient 90663 on their current hospital visit?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663 AND admissions.dischtime IS NULL)
CREATE TABLE table_45660 ( "Country" text, "Skip" text, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real, "Shot %" real )
Name the Country which has Stolen Ends larger than 7, and a Skip of david murdoch?
SELECT "Country" FROM table_45660 WHERE "Stolen Ends" > '7' AND "Skip" = 'david murdoch'
CREATE TABLE table_name_73 ( population_in_millions VARCHAR, gdp_2012_millions_of_euro VARCHAR )
What is Population in Millions, when GDP 2012 Millions of Euro is 600,638?
SELECT population_in_millions FROM table_name_73 WHERE gdp_2012_millions_of_euro = "600,638"
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
during this year, what are the top five most frequent diagnoses that patients were diagnosed in the same month after receiving umbilical vein cath.
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
CREATE TABLE table_27320 ( "Region" text, "Prison inmates Men" real, "Prison inmates Women" real, "Prison inmates Total" real, "Incarceration rate Male" real, "Incarceration rate Female" real, "Incarceration rate Total" real, "Country comparison" text )
How many regions had 153 women prison inmates?
SELECT COUNT("Incarceration rate Total") FROM table_27320 WHERE "Prison inmates Women" = '153'
CREATE TABLE table_14518 ( "State" text, "Abbr." text, "Capital" text, "Largest city" text, "Statehood" text, "Population est. (2012)" real, "House seat(s)" real )
What is the 2012 population for the state whose capital is Santa Fe?
SELECT "Population est. (2012)" FROM table_14518 WHERE "Capital" = 'santa fe'
CREATE TABLE table_name_53 ( opponent VARCHAR, record VARCHAR )
Who is the opponent of the team with a 1-1-0 record?
SELECT opponent FROM table_name_53 WHERE record = "1-1-0"
CREATE TABLE dependent ( sex VARCHAR )
how many female dependents are there?
SELECT COUNT(*) FROM dependent WHERE sex = 'F'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age te...
was the dulcolax prescribed to patient 032-9230 this month?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-9230')) AND medication.drugname = 'dulcolax' AND DATETIME(medication.d...
CREATE TABLE table_20522228_2 ( episode VARCHAR, share VARCHAR )
What was the episode name when share was 8?
SELECT episode FROM table_20522228_2 WHERE share = 8
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the average of department_id bin hire_date by time, I want to sort Y in ascending order.
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID)
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...
give me the number of patients whose days of hospital stay is greater than 11 and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "11" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
on the first icu visit, when did patient 3267 have the first urine out foley output?
SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3267) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND outputevents.itemid I...
CREATE TABLE table_204_301 ( id number, "nationality" text, "name" text, "term as a deputy judge" text, "reason for termination" text )
which country had the most deputy judges ?
SELECT "nationality" FROM table_204_301 GROUP BY "nationality" ORDER BY COUNT("name") DESC LIMIT 1
CREATE TABLE table_48128 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What date was the match against carlisle united?
SELECT "Date" FROM table_48128 WHERE "Away team" = 'carlisle united'
CREATE TABLE table_203_224 ( id number, "title" text, "year" number, "channel" text, "role" text, "notes" text )
what was the title of the last television appearance she had in 2010 ?
SELECT "title" FROM table_203_224 WHERE "year" = 2010 ORDER BY id DESC LIMIT 1
CREATE TABLE table_70784 ( "Lithium" text, "Sodium" text, "Potassium" text, "Rubidium" text, "Caesium" text )
what is the properties of sodium when rubidium is nacl (2.1)?
SELECT "Sodium" FROM table_70784 WHERE "Rubidium" = 'nacl (2.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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
what is the drug code and drug dose of drug name lidocaine viscous 2%?
SELECT prescriptions.formulary_drug_cd, prescriptions.drug_dose FROM prescriptions WHERE prescriptions.drug = "Lidocaine Viscous 2%"
CREATE TABLE table_name_58 ( year INTEGER, team VARCHAR, wins VARCHAR )
Which Year is the highest that has a Team of walker racing, and Wins larger than 1?
SELECT MAX(year) FROM table_name_58 WHERE team = "walker racing" AND wins > 1
CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name ...
show me the DINNER flights from BALTIMORE to OAKLAND
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, food_service WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_se...
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 ethnicity is american indian/alaska native and diagnoses long title is unspecified erythematous condition?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND diagnoses.long_title = "Unspecified erythematous condition"
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 ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
how many patients born before the year 2167 were primarily diagnosed for hyperglycemia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.dob_year < "2167"
CREATE TABLE table_name_49 ( agg VARCHAR, opponent VARCHAR )
What was the aggregate total for the match against Koper?
SELECT agg FROM table_name_49 WHERE opponent = "koper"
CREATE TABLE table_name_49 ( population__2011_ VARCHAR, population__2006_ VARCHAR )
What is the total number of people in 2011 speaking the mother tongue language spoken by 120 in 2006?
SELECT COUNT(population__2011_) FROM table_name_49 WHERE population__2006_ = 120
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE CloseAsO...
SELECT TOP 100 FROM Posts.
SELECT * FROM Posts LIMIT 10000
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
how many hours does it have been since patient 19428 last received a anion gap lab test in the current hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19428 AND admissio...
CREATE TABLE courses ( course_name VARCHAR )
List the names of courses in alphabetical order?
SELECT course_name FROM courses ORDER BY course_name
CREATE TABLE table_26368963_1 ( year VARCHAR, under_15 VARCHAR, under_19 VARCHAR )
How many years are there where the the under-15 is Arturo Salazar Martinez and the under-19 is Moises Galvez?
SELECT COUNT(year) FROM table_26368963_1 WHERE under_15 = "Arturo Salazar Martinez" AND under_19 = "Moises Galvez"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
calculate the length of stay of patient 006-93519's first stay in the icu for.
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-93519') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
CREATE TABLE problem_category_codes ( problem_category_code text, problem_category_description text ) CREATE TABLE problems ( problem_id number, product_id number, closure_authorised_by_staff_id number, reported_by_staff_id number, date_problem_reported time, date_problem_closed time, ...
What are the ids of the problems reported before the date of any problem reported by Lysanne Turcotte?
SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < (SELECT MIN(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Lysanne" AND T4.staff_last_name = "Turcotte")
CREATE TABLE table_71029 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
What Player with a Place of T10 had a Score of 80-70-72-72=294?
SELECT "Player" FROM table_71029 WHERE "Place" = 't10' AND "Score" = '80-70-72-72=294'
CREATE TABLE table_203_9 ( id number, "state" text, "last execution date" text, "name" text, "crime" text, "method" text )
what is the total number of states that have never used capital punishment ?
SELECT COUNT("state") FROM table_203_9 WHERE "last execution date" = 'never used'
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...
provide the number of patients whose diagnoses short title is anxiety state nos and drug route is oral?
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 = "Anxiety state NOS" AND prescriptions.route = "ORAL"
CREATE TABLE table_68556 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Which outcome has a Surface of clay and a Score of 4 6, 7 5, 2 6?
SELECT "Outcome" FROM table_68556 WHERE "Surface" = 'clay' AND "Score" = '4–6, 7–5, 2–6'
CREATE TABLE table_name_61 ( area_km_2 INTEGER, member_state VARCHAR, population_in_millions VARCHAR )
What is the lowest area km2 of the member state of the Czech Republic and has a population in millions lesss than 10.3?
SELECT MIN(area_km_2) FROM table_name_61 WHERE member_state = "czech republic" AND population_in_millions < 10.3
CREATE TABLE table_name_71 ( team VARCHAR, previous_team VARCHAR, pos VARCHAR )
Which Team has a Previous team of san diego rockets, and a Position of f?
SELECT team FROM table_name_71 WHERE previous_team = "san diego rockets" AND pos = "f"
CREATE TABLE table_77554 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
Which team was the visitor on January 10?
SELECT "Visitor" FROM table_77554 WHERE "Date" = 'january 10'
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 gender is f and primary disease is gastrointestinal bleed?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "GASTROINTESTINAL BLEED"
CREATE TABLE table_47921 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
Who replaced the manager of team arminia bielefeld?
SELECT "Replaced by" FROM table_47921 WHERE "Team" = 'arminia bielefeld'
CREATE TABLE table_40014 ( "Date" text, "Home captain" text, "Away captain" text, "Venue" text, "Result" text )
Who was the away captain with a result of Eng by 1 wkt?
SELECT "Away captain" FROM table_40014 WHERE "Result" = 'eng by 1 wkt'
CREATE TABLE publication ( abstract varchar, cid int, citation_num int, jid int, pid int, reference_num int, title varchar, year int ) CREATE TABLE domain_conference ( cid int, did int ) CREATE TABLE domain_keyword ( did int, kid int ) CREATE TABLE domain ( did int...
return me the abstract of ' Making database systems usable ' .
SELECT abstract FROM publication WHERE title = 'Making database systems usable'
CREATE TABLE table_name_81 ( winner VARCHAR, year INTEGER )
Who was the winner after 2011?
SELECT winner FROM table_name_81 WHERE year > 2011
CREATE TABLE table_22589 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
Name the total number of production code by david richardson and todd holland
SELECT COUNT("Production code") FROM table_22589 WHERE "Written by" = 'David Richardson' AND "Directed by" = 'Todd Holland'
CREATE TABLE candidates ( candidate_id number, candidate_details text ) CREATE TABLE students ( student_id number, student_details text ) CREATE TABLE candidate_assessments ( candidate_id number, qualification text, assessment_date time, asessment_outcome_code text ) CREATE TABLE addr...
List the id of students who attended statistics courses in the order of attendance date.
SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.date_of_attendance
CREATE TABLE table_34190 ( "Name" text, "Term" text, "Games" real, "Record (W\u2013L\u2013T / OTL)" text, "Points" real, "Win percentage" real )
Which Win percentage has a Name of red kelly?
SELECT SUM("Win percentage") FROM table_34190 WHERE "Name" = 'red kelly'
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
StackOverflow Rank and Percentile by Tag.
WITH Rankings AS (SELECT Id, Ranking = ROW_NUMBER() OVER (ORDER BY Reputation DESC) FROM Users WHERE UPPER(Users.Location) LIKE UPPER('##Country##')), Counts AS (SELECT Count = COUNT(*) FROM Users WHERE Reputation > '##ReputationCutoff##') SELECT Id, Ranking, 100 - (100 * (CAST(Ranking AS FLOAT(20, 5)) / (SELECT Count ...
CREATE TABLE table_61609 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the To Par of Peter Senior from Australia?
SELECT "To par" FROM table_61609 WHERE "Country" = 'australia' AND "Player" = 'peter senior'
CREATE TABLE table_29786 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What was the team's score against detroit?
SELECT "Score" FROM table_29786 WHERE "Team" = 'Detroit'
CREATE TABLE table_23177573_1 ( rank__week_ VARCHAR, written_by VARCHAR, directed_by VARCHAR )
What was the week ranking of the episode written by Thomas L. Moran and directed by Andrew Bernstein?
SELECT rank__week_ FROM table_23177573_1 WHERE written_by = "Thomas L. Moran" AND directed_by = "Andrew Bernstein"
CREATE TABLE table_1448 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" real, "Date" text )
What were the home team scores when carlton was the home team?
SELECT "Home team score" FROM table_1448 WHERE "Home team" = 'Carlton'
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, visualize the relationship between code and price , and group by attribute name.
SELECT T1.Code, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name
CREATE TABLE appellations ( no number, appelation text, county text, state text, area text, isava text ) CREATE TABLE grapes ( id number, grape text, color text ) CREATE TABLE wine ( no number, grape text, winery text, appelation text, state text, name text,...
List the grapes and appelations of all wines.
SELECT grape, appelation FROM wine
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
what is the allergy that patient 025-44495 has had this month?
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND DATETIME(allergy.allergytime, 'start of month') = DATETI...
CREATE TABLE table_name_27 ( street_address VARCHAR, name VARCHAR )
What's the address of the union bank of California tower?
SELECT street_address FROM table_name_27 WHERE name = "union bank of california tower"
CREATE TABLE table_name_99 ( round VARCHAR, venue VARCHAR )
What Round is in Ullevaal?
SELECT round FROM table_name_99 WHERE venue = "ullevaal"
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...
how many patients with hx traumatic fracture had a lab test for joint fluid?
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 = "Hx traumatic fracture" AND lab.fluid = "Joint Fluid"
CREATE TABLE table_2116 ( "Institution" text, "Location" text, "Founded" real, "Type" text, "Enrollment" real, "Nickname" text, "Joined" real )
In what year did the Lions join?
SELECT MIN("Joined") FROM table_2116 WHERE "Nickname" = 'Lions'
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 ) CREATE TABLE pat...
since 3 years ago what are the top three most frequent diagnoses given to patients during the same month after the diagnosis of elderly multigravida-del?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careuni...
what were the three most ordered microbiology tests for patients who have previously received oth extraoc mus-tend op within the same month during the last year?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
CREATE TABLE table_name_63 ( finish VARCHAR, country VARCHAR )
What is the finish of South Africa?
SELECT finish FROM table_name_63 WHERE country = "south africa"
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), ...
Return a bar chart on how many faculty members does each building have? List the result with the name of the building, and show total number in asc order.
SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY COUNT(*)
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREA...
is there ground transportation from ATL airport to downtown ATLANTA
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city AS CITY_0, city AS CITY_1, ground_service WHERE airport.airport_code = airport_service.airport_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = airport_service.city_code AND CITY_1.city_name = 'ATLANTA' AND ground_service.airp...
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
indicate the daily average amount of respiration for patient 006-202970 on the last intensive care unit visit.
SELECT AVG(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 = '006-202970') AND NOT patient.unitdischargetime IS ...