instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the Score when the opponent in the final is alicia pillay on a hard surface?
CREATE TABLE table_42546 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent in the final" text,"Score" text)
SELECT "Score" FROM table_42546 WHERE "Surface" = 'hard' AND "Opponent in the final" = 'alicia pillay'
what is minimum age of patients whose admission type is newborn and insurance is medicare?
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,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.insurance = "Medicare"
What is the lowest win percentage for when Perth Scorchers is the opposition?
CREATE TABLE table_name_20 (win__percentage INTEGER,opposition VARCHAR)
SELECT MIN(win__percentage) FROM table_name_20 WHERE opposition = "perth scorchers"
find the drug type and dose of calcium chloride.
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,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT prescriptions.drug_type, prescriptions.drug_dose FROM prescriptions WHERE prescriptions.drug = "Calcium Chloride"
Which Position has a Surname of naylor?
CREATE TABLE table_name_78 (position VARCHAR,surname VARCHAR)
SELECT position FROM table_name_78 WHERE surname = "naylor"
What is the team 1 with tikve as team 2?
CREATE TABLE table_60078 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 1" FROM table_60078 WHERE "Team 2" = 'tikveš'
When koki mizuno is the player how man positions are there?
CREATE TABLE table_1837 ("P" real,"Player" text,"Position" text,"SPL" real,"League Cup" real,"Scottish Cup" real,"UEFA Champions League" real,"Total" real)
SELECT COUNT("Position") FROM table_1837 WHERE "Player" = 'Koki Mizuno'
count the number of patients whose diagnoses icd9 code is 53190 and lab test abnormal status is delta?
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,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
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.icd9_code = "53190" AND lab.flag = "delta"
What are the number of the completion dates of all the tests that have result 'Fail'?, rank by the bar in asc.
CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATETIME,login_name VARCHAR(40),password VARCHAR(10),personal_name VARCHAR(40),middle_name VARCHAR(40),family_name VARCHAR(40))CREATE TABLE Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCH...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY date_of_completion
what is the average total hospital cost which involves ondansetron 4 mg po tab-disperse this year?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE lab (labid number,patientunitstayid num...
SELECT AVG(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 medication.patientunitstayid FROM medication WHERE medication.drugname = 'ondansetron 4 mg po tab-disperse')) AND DATETI...
How many years as tallest building was Independence Hall?
CREATE TABLE table_name_6 (years_as_tallest VARCHAR,name VARCHAR)
SELECT years_as_tallest FROM table_name_6 WHERE name = "independence hall"
Which formula has a refractive index 589.3 at 1.97?
CREATE TABLE table_7698 ("Material" text,"Formula" text,"Refractive index(es) 589.3nm" text,"Hardness (Mohs' scale)" text,"Density (g/cm 3)" text,"State of the art" text)
SELECT "Formula" FROM table_7698 WHERE "Refractive index(es) 589.3nm" = '1.97'
Show me about the distribution of All_Games and ACC_Percent in a bar chart, could you show in desc by the X-axis?
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_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce...
SELECT All_Games, ACC_Percent FROM basketball_match ORDER BY All_Games DESC
Most popular StackOverflow tags in Jul 2016.
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 ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,R...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN...
In what city was the team that left the conference in 1949 based?
CREATE TABLE table_name_65 (city VARCHAR,year_left VARCHAR)
SELECT city FROM table_name_65 WHERE year_left = "1949"
accept rate, for positive-scoring q/a, users with rep from elsewhere.
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 ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu...
SELECT CAST(SUM(hasAccepted) AS FLOAT) / COUNT(acc.Id) AS ratio, COUNT(acc.Id) AS numQuestions, SUM(hasAccepted) AS numAccepts FROM (SELECT fq.Id AS id, CASE WHEN SUM(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) > 0 THEN 1 ELSE 0 END AS hasPositiveAnswer, CASE WHEN COUNT(fq.accepted) > 0 THEN 1 ELSE 0 END AS hasAccepted FR...
Who won the game where the Challenge Leader is ACC (2-1)?
CREATE TABLE table_21022 ("Date" text,"Time" text,"ACC Team" text,"Big Ten Team" text,"Location" text,"Television" text,"Attendance" real,"Winner" text,"Challenge Leader" text)
SELECT "Winner" FROM table_21022 WHERE "Challenge Leader" = 'ACC (2-1)'
Which Player has a PI GP over 0 and a Rd # of 1?
CREATE TABLE table_54911 ("Rd #" real,"Pick #" real,"Player" text,"Team (League)" text,"Reg GP" real,"Pl GP" real)
SELECT "Player" FROM table_54911 WHERE "Pl GP" > '0' AND "Rd #" = '1'
what is the previous conference when the year joined is 1932 and the mascot is tigers?
CREATE TABLE table_name_46 (previous_conference VARCHAR,year_joined VARCHAR,mascot VARCHAR)
SELECT previous_conference FROM table_name_46 WHERE year_joined = "1932" AND mascot = "tigers"
For those records from the products and each product's manufacturer, show me about the distribution of founder and the amount of founder , and group by attribute founder in a bar chart, and sort by the X from high to low.
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder DESC
what is age and discharge time of subject id 74032?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT demographic.age, demographic.dischtime FROM demographic WHERE demographic.subject_id = "74032"
how many areas have at least 5 stations ?
CREATE TABLE table_204_601 (id number,"area served" text,"city of license" text,"vc" number,"rf" number,"callsign" text,"network" text,"notes" text)
SELECT COUNT(*) FROM (SELECT "area served" FROM table_204_601 GROUP BY "area served" HAVING COUNT(*) >= 5)
has patient 004-54892 received a antihypertensive drug - labetalol procedure at other hospitals?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE microlab (microlabid number,patientuni...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '004-54892' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '004-54892' AND patient.hospitaldischargetime IS NULL)) AND tr...
Show the number of document type for different document type description in a bar chart, and show y-axis in ascending order.
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document_Description VARCHAR(255),Other_Details...
SELECT Document_Type_Description, COUNT(Document_Type_Description) FROM Ref_Document_Types GROUP BY Document_Type_Description ORDER BY COUNT(Document_Type_Description)
What were the results for mens 40 when the mens u20 was Southern Suns def Gold Coast Sharks?
CREATE TABLE table_16724844_1 (mens_40 VARCHAR,mens_u20 VARCHAR)
SELECT mens_40 FROM table_16724844_1 WHERE mens_u20 = "Southern Suns def Gold Coast Sharks"
what is minimum age of patients whose marital status is divorced and primary disease is angioedema?
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)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "ANGIOEDEMA"
Find user pairs who accepted answers from each other.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,...
WITH accepter_acceptee(a, b) AS (SELECT q.OwnerUserId, a.OwnerUserId FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE q.PostTypeId = 1 AND q.OwnerUserId != a.OwnerUserId), collaborations(a, b, type) AS (SELECT a, b, '>' FROM accepter_acceptee UNION ALL SELECT b, a, '<' FROM accepter_acceptee) SE...
How many departments are in each school Show bar chart, and show y-axis in ascending order.
CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCH...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY COUNT(DISTINCT DEPT_NAME)
Which kind of policy type was chosen by the most customers?
CREATE TABLE payments (payment_id number,settlement_id number,payment_method_code text,date_payment_made time,amount_payment number)CREATE TABLE claims (claim_id number,policy_id number,date_claim_made time,date_claim_settled time,amount_claimed number,amount_settled number)CREATE TABLE customer_policies (policy_id num...
SELECT policy_type_code FROM customer_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
give me the number of patients whose primary disease is hypertension;rule out coronary artery disease\cardiac cath and year of birth is less than 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" AND demographic.dob_year < "2110"
how much does diagnosing long-term use of insulin cost?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'long-term use of insulin'))
What are the account ids, customer ids, and account names for all the accounts?
CREATE TABLE accounts (account_id number,customer_id number,account_name text,other_account_details text)CREATE TABLE customers_cards (card_id number,customer_id number,card_type_code text,card_number text,date_valid_from time,date_valid_to time,other_card_details text)CREATE TABLE customers (customer_id number,custome...
SELECT account_id, customer_id, account_name FROM accounts
which song had the highest us country position ?
CREATE TABLE table_203_830 (id number,"year" number,"song" text,"chart positions\nus country" number,"chart positions\ncan country" number,"album" text)
SELECT "song" FROM table_203_830 ORDER BY "chart positions\nus country" LIMIT 1
Which Home team has a Game of game 5?
CREATE TABLE table_name_85 (home_team VARCHAR,game VARCHAR)
SELECT home_team FROM table_name_85 WHERE game = "game 5"
What number did Mo o Negro peak at before 1996?
CREATE TABLE table_name_81 (peak INTEGER,track VARCHAR,year VARCHAR)
SELECT MAX(peak) FROM table_name_81 WHERE track = "moño negro" AND year < 1996
what is lab test fluid of subject name kelly gallardo?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo"
When was the date of appointment by Hugo Broos?
CREATE TABLE table_27374004_4 (date_of_appointment VARCHAR,replaced_by VARCHAR)
SELECT date_of_appointment FROM table_27374004_4 WHERE replaced_by = "Hugo Broos"
On which date was St Kilda the home team?
CREATE TABLE table_name_2 (date VARCHAR,home_team VARCHAR)
SELECT date FROM table_name_2 WHERE home_team = "st kilda"
how about a flight from MILWAUKEE to ST. LOUIS that leaves monday night
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE month (month_number int,month_name text)CREATE TABLE food_service (meal_co...
SELECT DISTINCT flight_id FROM flight WHERE (((((departure_time <= 2400 AND departure_time >= 1800) AND 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 = 21 AND DATE_DAYalias0...
What's the name of the episode whose part 3 aired on February 7, 2008?
CREATE TABLE table_13241993_3 (title VARCHAR,part_3 VARCHAR)
SELECT title FROM table_13241993_3 WHERE part_3 = "February 7, 2008"
give me the number of patients with drug code lido2/5j who had urine lab test.
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 (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "LIDO2/5J" AND lab.fluid = "Urine"
Name the date for game 8
CREATE TABLE table_24110 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Black Knights points" real,"Opponents" real,"Record" text)
SELECT "Date" FROM table_24110 WHERE "Game" = '8'
what was the last hospital admissions type of patient 4288 during this year?
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 outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE labevents (row_i...
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 4288 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime DESC LIMIT 1
What is the position of the player with a round less than 20 from the school/club Washington?
CREATE TABLE table_name_17 (position VARCHAR,round VARCHAR,school_club_team VARCHAR)
SELECT position FROM table_name_17 WHERE round < 20 AND school_club_team = "washington"
When 3 is the bbc three weekly ranking what is the airdate?
CREATE TABLE table_24399615_8 (airdate VARCHAR,bbc_three_weekly_ranking VARCHAR)
SELECT airdate FROM table_24399615_8 WHERE bbc_three_weekly_ranking = "3"
What was the aggregate score for the match won by Brive?
CREATE TABLE table_28068063_2 (aggregate_score VARCHAR,winners VARCHAR)
SELECT aggregate_score FROM table_28068063_2 WHERE winners = "Brive"
how many times patient 1902 has had tpn d17.0 taken on this month/30?
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 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 t...
SELECT COUNT(*) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1902)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tpn d17.0' AN...
What date has 3 as the round (leg)?
CREATE TABLE table_66051 ("Round (Leg)" text,"Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real)
SELECT "Date" FROM table_66051 WHERE "Round (Leg)" = '3'
Give me the comparison about meter_100 over the Time by a bar chart.
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadiu...
SELECT Time, meter_100 FROM swimmer
what 's the number of teams that won the cup four times ?
CREATE TABLE table_204_448 (id number,"team" text,"winners" number,"runners-up" number,"years won" text,"years runner-up" text)
SELECT COUNT("team") FROM table_204_448 WHERE "winners" = 4
Show id from each meter 300, and I want to show from low to high by the y axis please.
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Openin...
SELECT meter_300, ID FROM swimmer ORDER BY ID
how many patients received fiber-optic bronchoscopy during the same month after having been diagnosed with acidosis, the last year?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,l...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'acidosis') AND DAT...
Which position has a Nationality of united states, and a Player of roger powell?
CREATE TABLE table_name_9 (position VARCHAR,nationality VARCHAR,player VARCHAR)
SELECT position FROM table_name_9 WHERE nationality = "united states" AND player = "roger powell"
how many patients underwent oxygen therapy (40% to 60%) within 2 months after they were diagnosed with pneumonia?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid ...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON tre...
What is the number of titles for the city of gy r with a rank larger than 4?
CREATE TABLE table_69608 ("Rank" real,"City" text,"Titles" real,"Winning Clubs" text,"Last victory" real)
SELECT SUM("Titles") FROM table_69608 WHERE "City" = 'győr' AND "Rank" > '4'
In Week 13, who was the opponent?
CREATE TABLE table_name_98 (opponent VARCHAR,week VARCHAR)
SELECT opponent FROM table_name_98 WHERE week = 13
What is the highest round of Ed Smith, who had a pick higher than 261 and played halfback?
CREATE TABLE table_name_78 (round INTEGER,player VARCHAR,pick VARCHAR,position VARCHAR)
SELECT MAX(round) FROM table_name_78 WHERE pick < 261 AND position = "halfback" AND player = "ed smith"
What is the name of the couple if the total points earned is 161?
CREATE TABLE table_73570 ("Rank by average" real,"Place" real,"Couple" text,"Number Of Dances" real,"Total Points Earned" real,"Average" text)
SELECT "Couple" FROM table_73570 WHERE "Total Points Earned" = '161'
get the number of patients younger than 36 years who were discharged to home health care.
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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.age < "36"
has there ever been any type of microbiology test done on patient 99080's staph aureus screen until 95 months ago?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE procedures_icd (row_id number,subject_id ...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99080) AND microbiologyevents.spec_type_desc = 'staph aureus screen' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-95 month')
Which Series has a Winning team of iowa state and a Sport of w basketball?
CREATE TABLE table_name_54 (series VARCHAR,winning_team VARCHAR,sport VARCHAR)
SELECT series FROM table_name_54 WHERE winning_team = "iowa state" AND sport = "w basketball"
Tell me the track for june 9
CREATE TABLE table_74481 ("Date" text,"Track" text,"Event Name" text,"Pole Winner" text,"Race Winner" text)
SELECT "Track" FROM table_74481 WHERE "Date" = 'june 9'
What year was the diesel fuel propulsion, with a length of 40', and numbers (quanity ordered) of 3701-3729 (29 buses), retired?
CREATE TABLE table_38826 ("Make/ Model" text,"Length" text,"Year" real,"Numbers (Quantity Ordered)" text,"Fuel Propulsion" text,"Year Retired" text)
SELECT "Year Retired" FROM table_38826 WHERE "Fuel Propulsion" = 'diesel' AND "Length" = '40' AND "Numbers (Quantity Ordered)" = '3701-3729 (29 buses)'
Opponent of @ edmonton oilers, and a Game larger than 1, and a Series of oilers lead 3 2 had what score?
CREATE TABLE table_name_30 (score VARCHAR,series VARCHAR,opponent VARCHAR,game VARCHAR)
SELECT score FROM table_name_30 WHERE opponent = "@ edmonton oilers" AND game > 1 AND series = "oilers lead 3–2"
Hom many musicians performed in the song 'Flash'?
CREATE TABLE performance (songid number,bandmate number,stageposition text)CREATE TABLE songs (songid number,title text)CREATE TABLE albums (aid number,title text,year number,label text,type text)CREATE TABLE instruments (songid number,bandmateid number,instrument text)CREATE TABLE tracklists (albumid number,position n...
SELECT COUNT(*) FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.title = "Flash"
How long does student Linda Smith spend on the restaurant in total?
CREATE TABLE type_of_restaurant (resid number,restypeid number)CREATE TABLE restaurant_type (restypeid number,restypename text,restypedescription text)CREATE TABLE visits_restaurant (stuid number,resid number,time time,spent number)CREATE TABLE restaurant (resid number,resname text,address text,rating number)CREATE TAB...
SELECT SUM(spent) FROM student JOIN visits_restaurant ON student.stuid = visits_restaurant.stuid WHERE student.fname = "Linda" AND student.lname = "Smith"
Question States over Time (Percent).
CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)...
WITH Batches AS (SELECT DATEADD(mm, DATEPART(mm, Post.CreationDate) - 1, DATEADD(yy, DATEPART(yyyy, Post.CreationDate) - 1900, 0)) AS "date", COUNT(*) AS Total, SUM(CASE WHEN NOT Post.LastEditorUserId IS NULL THEN 1 ELSE 0 END) AS "edited" FROM Posts AS Post GROUP BY DATEPART(yyyy, Post.CreationDate), DATEPART(mm, Post...
How many JavaScript questions are answered by jsfiddle or jsbin.
CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance...
SELECT COUNT(*) FROM Posts AS q JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE q.Tags LIKE '%javascript%' AND (a.Body LIKE '%http://jsbin.com/%' OR a.Body LIKE '%http://jsfiddle.net/%')
Show me the proportion of cities of the branch table with a pie chart.
CREATE TABLE membership_register_branch (Member_ID int,Branch_ID text,Register_Year text)CREATE TABLE branch (Branch_ID int,Name text,Open_year text,Address_road text,City text,membership_amount text)CREATE TABLE purchase (Member_ID int,Branch_ID text,Year text,Total_pounds real)CREATE TABLE member (Member_ID int,Card_...
SELECT City, COUNT(City) FROM branch GROUP BY City
How many students play each sport. Show bar chart.
CREATE TABLE SportsInfo (StuID INTEGER,SportName VARCHAR(32),HoursPerWeek INTEGER,GamesPlayed INTEGER,OnScholarship VARCHAR(1))CREATE TABLE Video_Games (GameID INTEGER,GName VARCHAR(40),GType VARCHAR(40))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Adv...
SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName
How man 'other' millions of smartphones were shipped when 181.1 million total were shipped?
CREATE TABLE table_976 ("Quarter" text,"Android" text,"iOS" text,"Symbian" text,"BlackBerry OS" text,"Linux" text,"Windows Phone" text,"Other" text,"Total" text)
SELECT COUNT("Other") FROM table_976 WHERE "Total" = '181.1'
what is average age of patients whose gender is f and admission type is emergency?
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,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_type = "EMERGENCY"
A bar chart shows the distribution of personal_name and author_id .
CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment DATETIME,date_of_completion DATETIME)CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Course_Authors_and...
SELECT personal_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name
What is the title of the episode directed by Charles Beeson?
CREATE TABLE table_27040 ("\u2116" real,"#" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT "Title" FROM table_27040 WHERE "Directed by" = 'Charles Beeson'
How many distinct official languages are there among countries of players whose positions are defenders.
CREATE TABLE country (country_id number,country_name text,capital text,official_native_language text)CREATE TABLE match_season (season number,player text,position text,country number,team number,draft_pick_number number,draft_class text,college text)CREATE TABLE player (player_id number,player text,years_played text,to...
SELECT COUNT(DISTINCT T1.official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.position = "Defender"
what is the years won for each team
CREATE TABLE table_204_772 (id number,"team" text,"county" text,"wins" number,"years won" number)
SELECT "years won" FROM table_204_772
look for the primary disease and diagnoses icd9 code for patient ida cook.
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 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,sho...
SELECT demographic.diagnosis, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Ida Cook"
Are there 4 -credit courses that are BIOLCHEM ?
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 varchar)CREATE TABLE ta (campus_job_id int,student_id int,location var...
SELECT DISTINCT name, number FROM course WHERE department = 'BIOLCHEM' AND credits = 4
What was the away teams score when Hawthorn played as the home team?
CREATE TABLE table_name_5 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team AS score FROM table_name_5 WHERE home_team = "hawthorn"
What is the entrant earlier than 1956 with a Vanwall Special chassis?
CREATE TABLE table_name_19 (entrant VARCHAR,year VARCHAR,chassis VARCHAR)
SELECT entrant FROM table_name_19 WHERE year < 1956 AND chassis = "vanwall special"
how many patients whose diagnoses long title is other and unspecified noninfectious gastroenteritis and colitis and lab test abnormal status is delta?
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,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Other and unspecified noninfectious gastroenteritis and colitis" AND lab.flag = "delta"
count the number of patients whose procedure long title is thoracentesis.
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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Thoracentesis"
Which format is in St. George with a frequency of 0 107.3 fm?
CREATE TABLE table_name_31 (format VARCHAR,city_of_license VARCHAR,frequency VARCHAR)
SELECT format FROM table_name_31 WHERE city_of_license = "st. george" AND frequency = "0 107.3 fm"
Which title did Neil Affleck direct?
CREATE TABLE table_19527 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text)
SELECT "Title" FROM table_19527 WHERE "Directed by" = 'Neil Affleck'
For all employees who have the letters D or S in their first name, show me the trend about manager_id over hire_date with a line chart, show by the x-axis in descending.
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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc...
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
What was the score on october 23?
CREATE TABLE table_9844 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Score" FROM table_9844 WHERE "Date" = 'october 23'
Which role had a closing broadway cast of Adam Grupper?
CREATE TABLE table_61054 ("Role" text,"Original Broadway cast" text,"Closing Broadway cast" text,"Original US Tour cast" text,"Original NonEquity Tour cast" text,"Original S\u00e3o Paulo cast" text,"Original Lima cast" text)
SELECT "Role" FROM table_61054 WHERE "Closing Broadway cast" = 'adam grupper'
List the order id, customer id for orders in Cancelled status, ordered by their order dates with a scatter chart.
CREATE TABLE Customers (customer_id INTEGER,payment_method_code VARCHAR(10),customer_code VARCHAR(20),customer_name VARCHAR(80),customer_address VARCHAR(255),customer_phone VARCHAR(80),customer_email VARCHAR(80))CREATE TABLE Order_Items (order_item_id INTEGER,order_id INTEGER,product_id INTEGER)CREATE TABLE Products (p...
SELECT order_id, customer_id FROM Customer_Orders WHERE order_status_code = "Cancelled" ORDER BY order_date
Which week had a result of L 38-21?
CREATE TABLE table_name_91 (week VARCHAR,result VARCHAR)
SELECT week FROM table_name_91 WHERE result = "l 38-21"
Pete Conrad was on the Apollo 12 mission but also had what Lunar EVA dates?
CREATE TABLE table_70419 ("Name" text,"Born" text,"Age at first step" text,"Mission" text,"Lunar EVA dates" text,"Service" text)
SELECT "Lunar EVA dates" FROM table_70419 WHERE "Mission" = 'apollo 12' AND "Name" = 'pete conrad'
When 'c'est la vinnie' is the title what is the air date?
CREATE TABLE table_1862 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real)
SELECT "Original air date" FROM table_1862 WHERE "Title" = 'C''est la Vinnie'
What is BP's lowest sales?
CREATE TABLE table_name_73 (sales__billion_ INTEGER,company VARCHAR)
SELECT MIN(sales__billion_) AS $_ FROM table_name_73 WHERE company = "bp"
For those employees who was hired before 2002-06-21, a line chart shows the change of employee_id over hire_date
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_P...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
What is the name of the country in Arabic that has Moroni as the name of its capital in English?
CREATE TABLE table_7050 ("English country name" text,"Arabic romanised country name" text,"Arabic country name" text,"English capital name" text,"Arabic romanised capital name" text,"Arabic capital name" text)
SELECT "Arabic country name" FROM table_7050 WHERE "English capital name" = 'moroni'
What is the area where population in 2010 is 38062?
CREATE TABLE table_27772 ("City/ municipality" text,"Type" text,"No. of Barangays" real,"Population (2010)" real,"Area (km\u00b2)" text,"Pop. density (per km\u00b2)" real,"Income Class" text,"Zip Code" real)
SELECT "Area (km\u00b2)" FROM table_27772 WHERE "Population (2010)" = '38062'
what is average age of patients whose discharge location is home health care and primary disease is gastrointestinal bleed?
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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "GASTROINTESTINAL BLEED"
provide the number of patients whose admission location is emergency room admit and days of hospital stay is greater than 3?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.days_stay > "3"
Show first name and id for all customers with at least 2 accounts in a bar chart, and could you rank by the customer_first_name in asc?
CREATE TABLE Customers (customer_id INTEGER,customer_first_name VARCHAR(50),customer_middle_initial VARCHAR(1),customer_last_name VARCHAR(50),gender VARCHAR(1),email_address VARCHAR(255),login_name VARCHAR(80),login_password VARCHAR(20),phone_number VARCHAR(255),town_city VARCHAR(50),state_county_province VARCHAR(50),c...
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.customer_first_name
What is the box score type for the game that has a score of 103-101?
CREATE TABLE table_43578 ("Date" text,"Home team" text,"Score" text,"Away team" text,"Venue" text,"Box Score" text,"Report" text)
SELECT "Box Score" FROM table_43578 WHERE "Score" = '103-101'
Which Total Pld has a 2005 06 Pts of 27?
CREATE TABLE table_61306 ("Team" text,"2003\u201304 Pts" text,"2004\u201305 Pts" text,"2005\u201306 Pts" real,"Total Pts" real,"Total Pld" real)
SELECT MAX("Total Pld") FROM table_61306 WHERE "2005\u201306 Pts" = '27'