instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
how many patients stayed on the 517 ward since 2 years ago?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,discha...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 517 AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-2 year')
What is the number of goals Dave Taylor, who has more than 1 tries, has?
CREATE TABLE table_name_65 (goals INTEGER,player VARCHAR,tries VARCHAR)
SELECT SUM(goals) FROM table_name_65 WHERE player = "dave taylor" AND tries > 1
According to Other requirements which courses in Special African Art should be taken ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE co...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Special African Art%' OR course.description LIKE '%Special African Art%' OR course.name LIKE '%S...
Suggested edits on a specific post.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,...
SELECT Id AS "suggested_edit_link", CreationDate, OwnerUserId, Comment, Text, Title, Tags FROM SuggestedEdits WHERE PostId = '##postid?3376##' ORDER BY Id
What is the platform of the 2010 game with Shuichiro Nishiya as director?
CREATE TABLE table_name_5 (platform_s_ VARCHAR,year VARCHAR,director VARCHAR)
SELECT platform_s_ FROM table_name_5 WHERE year = 2010 AND director = "shuichiro nishiya"
Who is the Latin Commander of the Siege of Constantinople?
CREATE TABLE table_name_88 (latin_commander VARCHAR,battle VARCHAR)
SELECT latin_commander FROM table_name_88 WHERE battle = "siege of constantinople"
When was the dvd release directed by Billy O'Brien?
CREATE TABLE table_23476 ("#" real,"Title" text,"Maneater" text,"Television Premiere" text,"DVD release" text,"Writer" text,"Director" text,"Producer" text)
SELECT "DVD release" FROM table_23476 WHERE "Director" = 'Billy O''Brien'
let me know the number of patients with drug code ris1l for whom pleural fluid lab test order was placed.
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 lab (subject_id text,hadm_id text,itemid text,charttime te...
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 = "RIS1L" AND lab.fluid = "Pleural"
Which level has marvin gaye as artist 1 and david bowie as artist 2?
CREATE TABLE table_23649244_1 (level VARCHAR,artist_1 VARCHAR,artist_2 VARCHAR)
SELECT level FROM table_23649244_1 WHERE artist_1 = "Marvin Gaye" AND artist_2 = "David Bowie"
Find the total amount of loans offered by each bank branch.
CREATE TABLE bank (bname VARCHAR,branch_id VARCHAR)CREATE TABLE loan (branch_id VARCHAR)
SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname
what is the total number of patients diagnosed with mal neo middle 3rd esoph who received drug via pb route.
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 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 = "Mal neo middle 3rd esoph" AND prescriptions.route = "PB"
What year was incumbent Martin Lancaster elected?
CREATE TABLE table_18219 ("District" text,"Incumbent" text,"Party" text,"Elected" real,"Status" text,"Opponent" text)
SELECT MIN("Elected") FROM table_18219 WHERE "Incumbent" = 'Martin Lancaster'
What are the titles of the books whose writer is not 'Elaine Lee'?
CREATE TABLE publication (publication_id number,book_id number,publisher text,publication_date text,price number)CREATE TABLE book (book_id number,title text,issues number,writer text)
SELECT title FROM book WHERE writer <> "Elaine Lee"
how many years was gordon larsen convicted to ?
CREATE TABLE table_204_479 (id number,"defendant" text,"arrested" text,"charge" text,"result" text,"sentence" text)
SELECT "sentence" FROM table_204_479 WHERE "defendant" = 'gordon larsen'
how did patient 14397 last be admitted to the hospital?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom 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 d_icd_diagnoses (r...
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 14397 ORDER BY admissions.admittime DESC LIMIT 1
Who replaced the previous manager of Altay?
CREATE TABLE table_27091128_2 (replaced_by VARCHAR,team VARCHAR)
SELECT replaced_by FROM table_27091128_2 WHERE team = "Altay"
What is the rank for ord/kord with more than 1,332,123 total cargo?
CREATE TABLE table_75055 ("Rank" real,"Airport" text,"Code (IATA/ICAO)" text,"Total Cargo (Metric Tonnes)" real,"% Change" text)
SELECT MIN("Rank") FROM table_75055 WHERE "Code (IATA/ICAO)" = 'ord/kord' AND "Total Cargo (Metric Tonnes)" > '1,332,123'
What is the score of the away team who played the home team who scored 7.14 (56)?
CREATE TABLE table_56276 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_56276 WHERE "Home team score" = '7.14 (56)'
i'd like to see the fare code again QX
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight 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)CREATE TABLE class_of_service (booking_class var...
SELECT DISTINCT fare_basis_code FROM fare_basis WHERE fare_basis_code = 'QX'
What is the source of the poll that had Republican: Dino Rossi at 46%, Democrat: Christine Gregoire at 50%, and the lead margin was larger than 3?
CREATE TABLE table_48633 ("Source" text,"Dates administered" text,"Democrat: Christine Gregoire" text,"Republican: Dino Rossi" text,"Lead Margin" real)
SELECT "Source" FROM table_48633 WHERE "Republican: Dino Rossi" = '46%' AND "Lead Margin" > '3' AND "Democrat: Christine Gregoire" = '50%'
Who holds the time of 17:11.572?
CREATE TABLE table_6457 ("Race" text,"Trophy" text,"Rider(s)" text,"Machine" text,"Year" real,"Average speed" text,"Time" text)
SELECT "Race" FROM table_6457 WHERE "Time" = '17:11.572'
What is the county of precints 515?
CREATE TABLE table_10586064_2 (county VARCHAR,precincts VARCHAR)
SELECT county FROM table_10586064_2 WHERE precincts = 515
How many weeks did the single that entered the charts 14 september 2002 stay on the charts ?
CREATE TABLE table_name_30 (weeks_on_chart__uk_ VARCHAR,entered_chart__uk_ VARCHAR)
SELECT COUNT(weeks_on_chart__uk_) FROM table_name_30 WHERE entered_chart__uk_ = "14 september 2002"
Stacked bar chart of the number of country for with each Competition_type in each country
CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE player (Player_ID int,name text,Position text,Club_ID in...
SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country
how many cities do not have lower populations than valenza ?
CREATE TABLE table_203_413 (id number,"rank" text,"city" text,"population" number,"area\n(km2)" number,"density\n(inhabitants/km2)" number,"altitude\n(mslm)" number)
SELECT COUNT("city") FROM table_203_413 WHERE "city" <> 'valenza' AND "population" >= (SELECT "population" FROM table_203_413 WHERE "city" = 'valenza')
provide the number of patients whose diagnoses icd9 code is v1000 and lab test category is blood gas?
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 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 = "V1000" AND lab."CATEGORY" = "Blood Gas"
give me the number of patients whose marital status is widowed and lab test name is ck-mb index?
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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.label = "CK-MB Index"
how many ties occurred in the second round ?
CREATE TABLE table_204_405 (id number,"team 1" text,"agg." text,"team 2" text,"1st leg" text,"2nd leg" text)
SELECT COUNT(*) FROM table_204_405 WHERE "2nd leg" = "2nd leg"
What is the lowest draw that has less than 4 wins, 14 losses, and against more than 1836?
CREATE TABLE table_41218 ("Ballarat FL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT MIN("Draws") FROM table_41218 WHERE "Wins" < '4' AND "Losses" = '14' AND "Against" > '1836'
Show the most common apartment type code among apartments with more than 1 bathroom.
CREATE TABLE Apartments (apt_type_code VARCHAR,bathroom_count INTEGER)
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1
Which 2006 cfl draft pick played college ball at Idaho state?
CREATE TABLE table_name_91 (pick__number VARCHAR,college VARCHAR)
SELECT pick__number FROM table_name_91 WHERE college = "idaho state"
Name the total number of division for fa cups being 9
CREATE TABLE table_31346 ("Season" text,"Division" text,"League Apps" real,"League Goals" real,"FA Cup Apps" real,"FA Cup Goals" real,"Other Apps" real,"Other Goals" real,"Total Apps" real,"Total Goals" real)
SELECT COUNT("Division") FROM table_31346 WHERE "FA Cup Apps" = '9'
what event comes after ufc 121 ?
CREATE TABLE table_204_363 (id number,"res." text,"record" text,"opponent" text,"method" text,"event" text,"date" text,"round" number,"time" text,"location" text,"notes" text)
SELECT "event" FROM table_204_363 WHERE id = (SELECT id FROM table_204_363 WHERE "event" = 'ufc 121') + 1
Which winning team has Iowa city as the site, and december 3, 2006 as the date?
CREATE TABLE table_36272 ("Date" text,"Site" text,"Sport" text,"Winning team" text,"Series" text)
SELECT "Winning team" FROM table_36272 WHERE "Site" = 'iowa city' AND "Date" = 'december 3, 2006'
How many matches were 44?
CREATE TABLE table_26514 ("Rank" real,"Dismissals" real,"Player" text,"Caught" real,"Stumped" real,"Matches" real,"Innings" real)
SELECT COUNT("Dismissals") FROM table_26514 WHERE "Matches" = '44'
what is the highest rank for italy when gold is more than 1?
CREATE TABLE table_name_19 (rank INTEGER,nation VARCHAR,gold VARCHAR)
SELECT MAX(rank) FROM table_name_19 WHERE nation = "italy" AND gold > 1
Usuarios que preguntan mucho y aceptan poco.
CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTask...
SELECT U.Id AS "user_link", U.DisplayName, COUNT(CASE WHEN P.AcceptedAnswerId IS NULL THEN 1 ELSE NULL END) AS PreguntasSinAceptar, COUNT(CASE WHEN NOT P.AcceptedAnswerId IS NULL THEN 1 ELSE NULL END) AS PreguntasAceptadas, U.LastAccessDate AS UltimoAcceso FROM Users AS U INNER JOIN Posts AS P ON U.Id = P.OwnerUserId W...
how many rooms have king beds? Report the number for each decor type, and could you list x-axis from high to low order?
CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)
SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY decor DESC
blood pressure greater than 160 / 100 mmhg.
CREATE TABLE table_train_107 ("id" int,"systolic_blood_pressure_sbp" int,"body_weight" float,"modified_hachinski_ischemia_scale" int,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"clinical_dementia_rating_cdr" float,"NOUSE" float)
SELECT * FROM table_train_107 WHERE systolic_blood_pressure_sbp >= 160 OR diastolic_blood_pressure_dbp >= 100
Out of total number of patients who were newborn, how many of them had a lab test for urine?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "NEWBORN" AND lab.fluid = "Urine"
What is the attendance in a week earlier than 4, and result is w 31-20?
CREATE TABLE table_name_5 (attendance INTEGER,week VARCHAR,result VARCHAR)
SELECT AVG(attendance) FROM table_name_5 WHERE week < 4 AND result = "w 31-20"
what is the horse that ranked 69?
CREATE TABLE table_63340 ("Rank" text,"Rider" text,"Horse" text,"Nation" text,"Judge E" text,"Judge C" text,"Judge M" text,"Penalty Points" real)
SELECT "Horse" FROM table_63340 WHERE "Rank" = '69'
Which strain has 1,312 genes?
CREATE TABLE table_name_50 (strain VARCHAR,genes VARCHAR)
SELECT strain FROM table_name_50 WHERE genes = "1,312"
Name the use for amd opteron dual-core 2.6ghz
CREATE TABLE table_3890 ("Model - Computer name" text,"CPU type" text,"No. of processors" text,"Period of operation" text,"Maximum peak performance (Teraflops)" text,"Use" text)
SELECT "Use" FROM table_3890 WHERE "CPU type" = 'AMD Opteron dual-core 2.6GHz'
What is the 2006 value of the 2011 grand slam tournaments?
CREATE TABLE table_name_64 (Id VARCHAR)
SELECT 2006 FROM table_name_64 WHERE 2011 = "grand slam tournaments"
how many patients with admission location as phys referral/normal deli were diagnosed for copd excerbation.
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 demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "COPD EXACERBATION"
what is the heat when the athlete is anita pistone?
CREATE TABLE table_name_89 (heat INTEGER,athlete VARCHAR)
SELECT SUM(heat) FROM table_name_89 WHERE athlete = "anita pistone"
What seat has a vote percentage of 100.0%
CREATE TABLE table_68176 ("Party" text,"Party List votes" real,"Vote percentage" text,"Total Seats" text,"Seat percentage" text)
SELECT "Seat percentage" FROM table_68176 WHERE "Vote percentage" = '100.0%'
how many patients were diagnosed with diabetes mellitus - type ii during the same hospital visit after having undergone a allopurinol until 2 years ago?
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, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'allopurinol' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TI...
What is the total market value of all corporations headquartered in Germany?
CREATE TABLE table_name_51 (market_value___usd_million_ VARCHAR,headquarters VARCHAR)
SELECT COUNT(market_value___usd_million_) FROM table_name_51 WHERE headquarters = "germany"
What is the latest founded year?
CREATE TABLE table_2120 ("Institution" text,"Location" text,"Founded" real,"Type" text,"Enrollment" real,"Nickname" text,"Joined" real,"Left" real,"Current Conference" text)
SELECT MAX("Founded") FROM table_2120
What are the names of all the Japanese constructors that have earned more than 5 points, and count them by a pie chart
CREATE TABLE driverStandings (driverStandingsId INTEGER,raceId INTEGER,driverId INTEGER,points REAL,position INTEGER,positionText TEXT,wins INTEGER)CREATE TABLE constructorStandings (constructorStandingsId INTEGER,raceId INTEGER,constructorId INTEGER,points REAL,position INTEGER,positionText TEXT,wins INTEGER)CREATE TA...
SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name
who is beavercreek's representative
CREATE TABLE table_31168 ("District" real,"Representative" text,"Party" text,"Residence" text,"First Elected" text,"Term Limited" real)
SELECT "Representative" FROM table_31168 WHERE "Residence" = 'Beavercreek'
What position was pick # 54?
CREATE TABLE table_26996293_7 (position VARCHAR,pick__number VARCHAR)
SELECT position FROM table_26996293_7 WHERE pick__number = 54
Bar chart of the number of course name from each course name, and I want to order by the Y-axis in desc.
CREATE TABLE Student_Course_Attendance (student_id INTEGER,course_id INTEGER,date_of_attendance DATETIME)CREATE TABLE Candidates (candidate_id INTEGER,candidate_details VARCHAR(255))CREATE TABLE Candidate_Assessments (candidate_id INTEGER,qualification CHAR(15),assessment_date DATETIME,asessment_outcome_code CHAR(15))C...
SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name ORDER BY COUNT(course_name) DESC
What Series had 14 races and 12th position?
CREATE TABLE table_42416 ("Season" text,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"Podiums" real,"Points" text,"Position" text)
SELECT "Series" FROM table_42416 WHERE "Races" = '14' AND "Position" = '12th'
What is Gold, when Total is 6?
CREATE TABLE table_76977 ("Nation" text,"Gold" text,"Silver" text,"Bronze" text,"Total" real)
SELECT "Gold" FROM table_76977 WHERE "Total" = '6'
the match on november 12 , 1978 was on a hard surface . what was the surface of the previous match ?
CREATE TABLE table_204_553 (id number,"outcome" text,"no." number,"date" text,"tournament" text,"surface" text,"partner" text,"opponents in the final" text,"score in the final" text)
SELECT "surface" FROM table_204_553 WHERE "date" < (SELECT "date" FROM table_204_553 WHERE "date" = '12 november 1978') ORDER BY "date" DESC LIMIT 1
Posts with many 'thank you' answers, ordered by views. Looking at posts shorter than 200 with the text `thank` somewhere in it, ordered by views
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT a.ParentId AS "post_link", COUNT(a.Id), SUM(q.ViewCount) / COUNT(a.Id) FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND LENGTH(a.Body) <= 200 AND (a.Body LIKE '%thank%') GROUP BY a.ParentId HAVING COUNT(a.Id) > 1 ORDER BY COUNT(a.Id) DESC, SUM(q.ViewCount...
How many players are listed for the school/club team Washington?
CREATE TABLE table_15463188_17 (name VARCHAR,school_club_team VARCHAR)
SELECT COUNT(name) FROM table_15463188_17 WHERE school_club_team = "Washington"
How much is the money ($) when the country is united states, to par is e and the score is 72-75-70-71=288?
CREATE TABLE table_9524 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT SUM("Money ( $ )") FROM table_9524 WHERE "Country" = 'united states' AND "To par" = 'e' AND "Score" = '72-75-70-71=288'
what is the new prescription of patient 015-59552 today vs. the one yesterday?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '015-59552') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medica...
What is the nation who won 1 bronze in the Olympics during 1924 1928?
CREATE TABLE table_24943 ("Rank" real,"Athlete" text,"Nation" text,"Olympics" text,"Gold" real,"Silver" real,"Bronze" real,"Total(min. 2 medals)" real)
SELECT "Nation" FROM table_24943 WHERE "Olympics" = '1924–1928' AND "Bronze" = '1'
Posts (Questions and Answers) based on a given tag and duration.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,Paren...
SELECT TIME_TO_STR(p.LastActivityDate, '%Y') AS YEAR, TIME_TO_STR(p.LastActivityDate, '%B') AS MONTH, MONTH(p.LastActivityDate) AS MONTH_NUM, COUNT(*) AS Total FROM Posts AS p, PostTags AS ptags, Tags AS t, PostTypes AS ptypes WHERE p.PostTypeId = ptypes.Id AND ptypes.Id IN (1, 2) AND p.Id = ptags.PostId AND ptags.TagI...
How many Gold does the Nation in Rank 12 with less than 2 Total medals have?
CREATE TABLE table_35250 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Gold") FROM table_35250 WHERE "Rank" = '12' AND "Total" < '2'
What are the names of festivals held in year 2007?
CREATE TABLE nomination (artwork_id number,festival_id number,result text)CREATE TABLE festival_detail (festival_id number,festival_name text,chair_name text,location text,year number,num_of_audience number)CREATE TABLE artwork (artwork_id number,type text,name text)
SELECT festival_name FROM festival_detail WHERE year = 2007
Which channel has Joel Meyers as the Play by play commentator?
CREATE TABLE table_45374 ("Channel" text,"Play-by-play" text,"Color commentator(s)" text,"Studio host" text,"Studio analysts" text)
SELECT "Channel" FROM table_45374 WHERE "Play-by-play" = 'joel meyers'
Which Pick # has an NHL team of detroit red wings?
CREATE TABLE table_name_69 (pick__number VARCHAR,nhl_team VARCHAR)
SELECT pick__number FROM table_name_69 WHERE nhl_team = "detroit red wings"
How many wins did the driver with 1 second and more than 12 races have?
CREATE TABLE table_name_98 (wins VARCHAR,second VARCHAR,races VARCHAR)
SELECT wins FROM table_name_98 WHERE second = "1" AND races > 12
how many times has nigel mansell been the winning driver ?
CREATE TABLE table_203_408 (id number,"rd." number,"grand prix" text,"date" text,"location" text,"pole position" text,"fastest lap" text,"winning driver" text,"constructor" text,"report" text)
SELECT COUNT(*) FROM table_203_408 WHERE "winning driver" = 'nigel mansell'
What is the language of the malacca fm station?
CREATE TABLE table_1601792_3 (language VARCHAR,station VARCHAR)
SELECT language FROM table_1601792_3 WHERE station = "Malacca FM"
which competition was in tokyo , japan but came in 2nd position ?
CREATE TABLE table_203_215 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" text)
SELECT "competition" FROM table_203_215 WHERE "venue" = 'tokyo, japan' AND "position" = 2
count the number of patients whose primary disease is hypertension;rule out coronary artery disease/cardiac cath and drug route is sc.
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" AND prescriptions.route = "SC"
Opponent of at new york giants had what venue?
CREATE TABLE table_5210 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Venue" text,"Attendance" text)
SELECT "Venue" FROM table_5210 WHERE "Opponent" = 'at new york giants'
What country did the project, Bonga SW; Aparo with a shell operator take place?
CREATE TABLE table_5932 ("Country" text,"Project Name" text,"Year startup" text,"Operator" text,"Peak" text)
SELECT "Country" FROM table_5932 WHERE "Operator" = 'shell' AND "Project Name" = 'bonga sw; aparo'
Who was the 1999-2002 Years for Grizzlies small forward Player who was from the United States?
CREATE TABLE table_44821 ("Player" text,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text)
SELECT "Player" FROM table_44821 WHERE "Nationality" = 'united states' AND "Position" = 'small forward' AND "Years for Grizzlies" = '1999-2002'
Who was the leading score in the game at the Warriors?
CREATE TABLE table_name_54 (leading_scorer VARCHAR,home VARCHAR)
SELECT leading_scorer FROM table_name_54 WHERE home = "warriors"
What is the highest number of wins with a goal difference less than 4 at the Villarreal CF and more than 38 played?
CREATE TABLE table_name_82 (wins INTEGER,played VARCHAR,goal_difference VARCHAR,club VARCHAR)
SELECT MAX(wins) FROM table_name_82 WHERE goal_difference < 4 AND club = "villarreal cf" AND played > 38
How many games was game 43?
CREATE TABLE table_21236 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT COUNT("Record") FROM table_21236 WHERE "Game" = '43'
When do all the researcher role staff stop working? Bin the time into weekday interval and count them with a bar chart, order by the the number of date to in asc.
CREATE TABLE Documents (document_id INTEGER,document_type_code VARCHAR(10),grant_id INTEGER,sent_date DATETIME,response_received_date DATETIME,other_details VARCHAR(255))CREATE TABLE Projects (project_id INTEGER,organisation_id INTEGER,project_details VARCHAR(255))CREATE TABLE Organisation_Types (organisation_type VARC...
SELECT date_to, COUNT(date_to) FROM Project_Staff ORDER BY COUNT(date_to)
Who has a total of 272?
CREATE TABLE table_name_46 (player VARCHAR,total VARCHAR)
SELECT player FROM table_name_46 WHERE total = 272
What is the earliest year that includes a Seattle Storm guard?
CREATE TABLE table_name_54 (year INTEGER,position VARCHAR,wnba_team VARCHAR)
SELECT MIN(year) FROM table_name_54 WHERE position = "guard" AND wnba_team = "seattle storm"
Find the name and budget of departments whose budgets are more than the average budget Visualize by bar chart, and display names in descending order.
CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE course (course_id varchar(8),title...
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY dept_name DESC
What township is 34.781 square miles?
CREATE TABLE table_18600760_18 (township VARCHAR,land___sqmi__ VARCHAR)
SELECT township FROM table_18600760_18 WHERE land___sqmi__ = "34.781"
what were the five most frequent drugs prescribed to male patients of the 20s in the same month after they had been diagnosed with other lung disease nec, this year?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time...
SELECT t3.drug FROM (SELECT t2.drug, 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.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
What is the international mail with the lowest number to have less than 72 domestic freight, 0 domestic mail later than 2012 with total freight and mail more than 4,695?
CREATE TABLE table_name_82 (international_mail INTEGER,total_freight_and_mail VARCHAR,year VARCHAR,domestic_freight VARCHAR,domestic_mail VARCHAR)
SELECT MIN(international_mail) FROM table_name_82 WHERE domestic_freight < 72 AND domestic_mail = 0 AND year < 2012 AND total_freight_and_mail > 4 OFFSET 695
what is death status and admission location of subject id 42067?
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 demographic.expire_flag, demographic.admission_location FROM demographic WHERE demographic.subject_id = "42067"
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a line chart about the change of employee_id over hire_date , could you sort by the X-axis in desc?
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE ...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE DESC
What is the frequency for the city of Lamar, Colorado?
CREATE TABLE table_name_37 (frequency_mhz INTEGER,city_of_license VARCHAR)
SELECT AVG(frequency_mhz) FROM table_name_37 WHERE city_of_license = "lamar, colorado"
Are WRITING 220 and WRITING 303 available at the same time ?
CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students...
SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, course_offering AS COURSE_OFFERING_0, course_offering AS COURSE_OFFERING_1, course_prerequisite WHERE COURSE_OFFERING_1.semester = COURSE_OFFERING_0.semester AND COURSE_0.course_id = COURSE_OFFERING_0.course_id AND COURSE_0.department = 'WRITING' AND COUR...
How many people attended the game on December 2, 1951?
CREATE TABLE table_name_69 (attendance VARCHAR,date VARCHAR)
SELECT attendance FROM table_name_69 WHERE date = "december 2, 1951"
What is the last name of the student who received an A in the class with the code 10018?
CREATE TABLE department (dept_code text,dept_name text,school_code text,emp_num number,dept_address text,dept_extension text)CREATE TABLE professor (emp_num number,dept_code text,prof_office text,prof_extension text,prof_high_degree text)CREATE TABLE employee (emp_num number,emp_lname text,emp_fname text,emp_initial te...
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
What was the nominated work, nominated for the drama league award before 2007?
CREATE TABLE table_60862 ("Year" real,"Award" text,"Category" text,"Nominated Work" text,"Result" text)
SELECT "Nominated Work" FROM table_60862 WHERE "Result" = 'nominated' AND "Award" = 'drama league award' AND "Year" < '2007'
During which years was the Model 318td (diesel) with the Engine code of m47d20 manufactured?
CREATE TABLE table_name_64 (years VARCHAR,engine_code VARCHAR,model VARCHAR)
SELECT years FROM table_name_64 WHERE engine_code = "m47d20" AND model = "318td (diesel)"
What was the team that held the race title of Mallala?
CREATE TABLE table_name_47 (team VARCHAR,race_title VARCHAR)
SELECT team FROM table_name_47 WHERE race_title = "mallala"
Who was the opponent in UFC 19?
CREATE TABLE table_46597 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Opponent" FROM table_46597 WHERE "Event" = 'ufc 19'
how many patients were prescribed iso-osmotic dextrose during the same hospital encounter after the diagnosis of chf nos, since 2102?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title 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 numbe...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =...
What is the winners name at the western open?
CREATE TABLE table_name_23 (winner VARCHAR,tournament VARCHAR)
SELECT winner FROM table_name_23 WHERE tournament = "western open"
What was the home team score for the game where Hawthorn is the home team?
CREATE TABLE table_name_83 (home_team VARCHAR)
SELECT home_team AS score FROM table_name_83 WHERE home_team = "hawthorn"
How many wins did he have when he played under 2 events?
CREATE TABLE table_name_22 (wins VARCHAR,events INTEGER)
SELECT COUNT(wins) FROM table_name_22 WHERE events < 2