instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
A bar chart about the number of faults for different fault short name, sort from low to high by the y-axis.
CREATE TABLE Maintenance_Engineers (engineer_id INTEGER,company_id INTEGER,first_name VARCHAR(50),last_name VARCHAR(50),other_details VARCHAR(255))CREATE TABLE Engineer_Visits (engineer_visit_id INTEGER,contact_staff_id INTEGER,engineer_id INTEGER,fault_log_entry_id INTEGER,fault_status VARCHAR(10),visit_start_datetime...
SELECT fault_short_name, COUNT(fault_short_name) FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY fault_short_name ORDER BY COUNT(fault_short_name)
when did patient 029-8212 get admitted for the last time since 2104 in the hospital?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,ag...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '029-8212' AND STRFTIME('%y', patient.hospitaladmittime) >= '2104' ORDER BY patient.hospitaladmittime DESC LIMIT 1
On what date(s) was the winning team Prema Powerteam?
CREATE TABLE table_25213146_2 (date VARCHAR,winning_team VARCHAR)
SELECT date FROM table_25213146_2 WHERE winning_team = "Prema Powerteam"
What is the nationality of Louis floch
CREATE TABLE table_26964 ("Name" text,"Position" text,"Period" text,"Appearances\u00b9" real,"Goals\u00b9" real,"Nationality\u00b2" text)
SELECT "Nationality\u00b2" FROM table_26964 WHERE "Name" = 'Louis Floch'
What was the lowest home attendance for the southern derby?
CREATE TABLE table_983 ("Competition" text,"Record" text,"Result" text,"Home Matches" real,"Home Attendance" real,"Avg. Home Attendance" real)
SELECT MIN("Home Attendance") FROM table_983 WHERE "Competition" = 'Southern Derby'
what number of patients have admission location as transfer from hosp/extram and drug code as phen 100ivbp?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.formulary_drug_cd = "PHEN100IVPB"
How much did the away team score that played St Kilda?
CREATE TABLE table_51744 ("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_51744 WHERE "Home team" = 'st kilda'
What was the date of the game played at Gillette Stadium with a score of 40-21?
CREATE TABLE table_name_97 (date VARCHAR,location VARCHAR,result VARCHAR)
SELECT date FROM table_name_97 WHERE location = "gillette stadium" AND result = "40-21"
How many values for joined occur at Guilford College?
CREATE TABLE table_28409 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" real,"Football?" text,"Joined" real)
SELECT COUNT("Joined") FROM table_28409 WHERE "Institution" = 'Guilford College'
which season was the only season to come in 18th ?
CREATE TABLE table_204_717 (id number,"season" text,"level" number,"division" text,"place" text)
SELECT "season" FROM table_204_717 WHERE "place" = 18
presence of a pulmonary artery catheter ( or central venous catheters )
CREATE TABLE table_train_65 ("id" int,"intention_to_arterial_catheter" bool,"steroid_therapy" bool,"intention_to_central_venous_catheter" bool,"central_venous_pressure_cvp" int,"receiving_vasopressor" bool,"pulmonary_artery_occlusive_pressure_paop" int,"septic_shock" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_65 WHERE intention_to_arterial_catheter = 1 OR intention_to_central_venous_catheter = 1
Name the call sign for the 17 physical
CREATE TABLE table_19450 ("Virtual" real,"Physical" real,"Call sign" text,"Branding" text,"Network" text,"Owner" text)
SELECT "Call sign" FROM table_19450 WHERE "Physical" = '17'
What date did the International Gold Cup take place?
CREATE TABLE table_4640 ("Round" real,"Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Winning car" text)
SELECT "Date" FROM table_4640 WHERE "Name" = 'international gold cup'
Name the least age 40-49
CREATE TABLE table_169693_1 (age_40_49 INTEGER)
SELECT MIN(age_40_49) FROM table_169693_1
Which player was drafted after round 9 and number 464 overall?
CREATE TABLE table_32181 ("Round" real,"Overall" real,"Player" text,"Position" text,"School/Club Team" text)
SELECT "Player" FROM table_32181 WHERE "Round" > '9' AND "Overall" = '464'
Who has a To par of 2, and a Country of united states?
CREATE TABLE table_78576 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text)
SELECT "Player" FROM table_78576 WHERE "To par" = '–2' AND "Country" = 'united states'
Will there be any upper-level ANTHRCUL classes to take this Spring ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)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 varc...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ANTHRCUL' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Sp...
Which translation was published in 1986?
CREATE TABLE table_name_78 (translation VARCHAR,date VARCHAR)
SELECT translation FROM table_name_78 WHERE date = 1986
Who took the loss in the game that ended with a 54-61 record?
CREATE TABLE table_69660 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Loss" FROM table_69660 WHERE "Record" = '54-61'
What is the away team score for the team that has a home team score of 14.22 (106)?
CREATE TABLE table_11202 ("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_11202 WHERE "Home team score" = '14.22 (106)'
when was the last time patient 031-3355 was given microbiology tests in 12/this year?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,cul...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND DATETIME(microlab.culturetakentime, 'start of yea...
What is the dpi of a scanner with the mm dimensions 280 x 95 x 40?
CREATE TABLE table_20787 ("product" text,"dimensions (mm)" text,"dpi" real,"pages per minute (color)" real,"max page size" text,"interface" text)
SELECT "dpi" FROM table_20787 WHERE "dimensions (mm)" = '280 x 95 x 40'
what is the name of the procedure that has been done two times in 03/last year to patient 27362?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_diagnoses (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 labevents (row_id number...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 273...
Name the years in orlando that the player from concord hs was in
CREATE TABLE table_20193 ("Player" text,"No." real,"Nationality" text,"Position" text,"Years in Orlando" text,"School/Club Team" text)
SELECT "Years in Orlando" FROM table_20193 WHERE "School/Club Team" = 'Concord HS'
what are the top four commonly prescribed drugs that patients were prescribed after having received a aortocor bypas-1 cor art treatment in the same hospital visit?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE patients (row_id number,subject_id number,gender tex...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id 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...
What country has a score of 66-73-69=208?
CREATE TABLE table_name_69 (country VARCHAR,score VARCHAR)
SELECT country FROM table_name_69 WHERE score = 66 - 73 - 69 = 208
Which player was chosen by Saskatchewan in a pick larger than 38?
CREATE TABLE table_47179 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text)
SELECT "Player" FROM table_47179 WHERE "Pick #" > '38' AND "CFL Team" = 'saskatchewan'
What pregame analyst(s) had rob stone and monica gonzalez as sideline reporters and were on tsn2?
CREATE TABLE table_21758 ("Year" real,"Network" text,"Play-by-play" text,"Color commentator" text,"Sideline reporters" text,"Pregame host" text,"Pregame analysts" text)
SELECT "Pregame analysts" FROM table_21758 WHERE "Sideline reporters" = 'Rob Stone and Monica Gonzalez' AND "Network" = 'TSN2'
tag gold badges sorted by date.
CREATE TABLE PostsWithDeleted (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,LastEditDate time,LastActivityDate time,Title text,Ta...
SELECT ROW_NUMBER() OVER (ORDER BY b.Date), u.Id, u.DisplayName, b.Date, b.Name, b.Class FROM Badges AS b INNER JOIN Users AS u ON u.Id = b.UserId WHERE b.Name LIKE '%' AND b.Class = 1 ORDER BY b.Date
Name the most tackles for 3.5 sacks
CREATE TABLE table_15581223_8 (tackles INTEGER,sacks VARCHAR)
SELECT MAX(tackles) FROM table_15581223_8 WHERE sacks = "3.5"
When the team is chicago what is the location attendence?
CREATE TABLE table_27756164_8 (location_attendance VARCHAR,team VARCHAR)
SELECT location_attendance FROM table_27756164_8 WHERE team = "Chicago"
What was the official rating 16-39 of episode 9?
CREATE TABLE table_29773532_21 (official_rating_16_39 VARCHAR,episode VARCHAR)
SELECT official_rating_16_39 FROM table_29773532_21 WHERE episode = 9
how many of the female patients had icd9 code 76519?
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 WHERE demographic.gender = "F" AND diagnoses.icd9_code = "76519"
List the number of enginners and group by first name in a bar chart, display by the bar in descending please.
CREATE TABLE Maintenance_Contracts (maintenance_contract_id INTEGER,maintenance_contract_company_id INTEGER,contract_start_date DATETIME,contract_end_date DATETIME,other_contract_details VARCHAR(255))CREATE TABLE Part_Faults (part_fault_id INTEGER,part_id INTEGER,fault_short_name VARCHAR(20),fault_description VARCHAR(2...
SELECT first_name, COUNT(first_name) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY first_name ORDER BY first_name DESC
What is the width for hte truss with a source of zacher (1994)?
CREATE TABLE table_9320 ("Length feet (m)" text,"Width feet (m)" text,"Load short tons (MT)" text,"Truss type(s)" text,"Year built" text,"Source (Year)" text)
SELECT "Width feet (m)" FROM table_9320 WHERE "Source (Year)" = 'zacher (1994)'
how many games were played at the prudential center ?
CREATE TABLE table_203_410 (id number,"game" number,"date" text,"opponent" text,"location" text,"score" text,"attendance" number,"record" text)
SELECT COUNT("game") FROM table_203_410 WHERE "location" = 'prudential center'
When 1984 is the first elected who are the candidates?
CREATE TABLE table_19753079_41 (candidates VARCHAR,first_elected VARCHAR)
SELECT candidates FROM table_19753079_41 WHERE first_elected = 1984
Users with Tags Score excluding undesirable tag.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescr...
SELECT DISTINCT u.Id AS "user_link", CONCAT('https://stackoverflow.com/users/', u.Id) AS "profile_link", u.DisplayName, 'Tag:' + t.TagName, SUM(a.Score) AS "tag_score", COUNT(*) AS "answer_count" FROM Users AS u INNER JOIN Posts AS a ON a.OwnerUserId = u.Id INNER JOIN Posts AS q ON a.ParentId = q.Id INNER JOIN PostTags...
count the number of patients whose admission location is trsf within this facility and drug name is sodium chloride?
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 lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.drug = "Sodium Chloride"
when was the first efavirenz prescription given to patient 13536 when they came to the hospital last time.
CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_i...
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13536 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'efavirenz' ORDER BY prescriptions.startdate LIMIT 1
Tell me the average final rank for loe more than 10 and point less than 43
CREATE TABLE table_78171 ("Season" real,"Belonging league" text,"Matches" real,"league point" real,"Draw" real,"Lose" real,"Goal difference" real,"Point" real,"Lost point" real,"Final rank" real)
SELECT AVG("Final rank") FROM table_78171 WHERE "Lose" > '10' AND "Point" < '43'
how much do charge for a chemotherapy?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayi...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'treatment' AND cost.eventid IN (SELECT treatment.treatmentid FROM treatment WHERE treatment.treatmentname = 'chemotherapy')
Which Particle has an Isospin I of 1 2, and a Symbol of 0 (1530)?
CREATE TABLE table_56575 ("Particle" text,"Symbol" text,"Makeup" text,"Rest mass MeV / c 2" text,"Isospin I" text,"Spin (Parity) J P" text,"Commonly decays to" text)
SELECT "Particle" FROM table_56575 WHERE "Isospin I" = '1⁄2' AND "Symbol" = 'ξ ∗0 (1530)'
Which player get the highest score in 1971?
CREATE TABLE player_award (player_id text,award_id text,year number,league_id text,tie text,notes text)CREATE TABLE player_award_vote (award_id text,year number,league_id text,player_id text,points_won number,points_max number,votes_first text)CREATE TABLE hall_of_fame (player_id text,yearid number,votedby text,ballots...
SELECT player_id FROM player_award_vote WHERE year = "1971" ORDER BY points_won DESC LIMIT 1
Who is every play-by-play announcer when Chris Rose is the trophy presenter?
CREATE TABLE table_31138 ("Year" real,"Network" text,"Play-by-play announcer" text,"Color commentator" text,"s Field reporter" text,"Pregame hosts" text,"Pregame analysts" text,"Trophy presentation" text)
SELECT "Play-by-play announcer" FROM table_31138 WHERE "Trophy presentation" = 'Chris Rose'
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities?
CREATE TABLE temperature (city_id number,jan number,feb number,mar number,apr number,jun number,jul number,aug number,sep number,oct number,nov number,dec number)CREATE TABLE hosting_city (year number,match_id number,host_city text)CREATE TABLE city (city_id number,city text,hanzi text,hanyu_pinyin text,regional_popula...
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.feb > T2.jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
What was the Result F A on 21 February 2009, when the league position was 1st?
CREATE TABLE table_name_55 (result_f_a VARCHAR,league_position VARCHAR,date VARCHAR)
SELECT result_f_a FROM table_name_55 WHERE league_position = "1st" AND date = "21 february 2009"
What is the school of the player from Lake Charles, LA?
CREATE TABLE table_17054 ("Player" text,"Position" text,"School" text,"Hometown" text,"MLB Draft" text)
SELECT "School" FROM table_17054 WHERE "Hometown" = 'Lake Charles, LA'
which artist has the least highest position ?
CREATE TABLE table_203_249 (id number,"position" number,"song title" text,"artist" text,"sales" number,"highest position" number)
SELECT "artist" FROM table_203_249 ORDER BY "position" DESC LIMIT 1
Performer 2 of compilation 2 is what performer 1?
CREATE TABLE table_36263 ("Date" text,"Episode" real,"Performer 1" text,"Performer 2" text,"Performer 3" text,"Performer 4" text)
SELECT "Performer 1" FROM table_36263 WHERE "Performer 2" = 'compilation 2'
What is the maximum season that has exactly 2 podiums?
CREATE TABLE table_29434211_1 (season INTEGER,podiums VARCHAR)
SELECT MAX(season) FROM table_29434211_1 WHERE podiums = 2
How many teams won $2,089,556?
CREATE TABLE table_22932 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text)
SELECT COUNT("Wins") FROM table_22932 WHERE "Winnings" = '$2,089,556'
who acted the role of ' Mr. Bean
CREATE TABLE genre (gid int,genre text)CREATE TABLE cast (id int,msid int,aid int,role text)CREATE TABLE copyright (id int,msid int,cid int)CREATE TABLE company (id int,name text,country_code varchar)CREATE TABLE made_by (id int,msid int,pid int)CREATE TABLE written_by (id int,msid int,wid int)CREATE TABLE producer (pi...
SELECT actor.name FROM actor, cast WHERE cast.aid = actor.aid AND cast.role = 'Mr. Bean'
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of phone_number and manager_id , and order in ascending by the Y-axis.
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 varchar(40),REGION_ID decimal(10,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY dec...
SELECT PHONE_NUMBER, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID
how many patients whose admission location is clinic referral/premature and item id is 51099?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND lab.itemid = "51099"
What label has the catalog nebt058?
CREATE TABLE table_name_10 (label VARCHAR,catalog VARCHAR)
SELECT label FROM table_name_10 WHERE catalog = "nebt058"
how long did it take warren davadilla to complete the 1998 marlboro centennial tour ?
CREATE TABLE table_204_694 (id number,"year" text,"name" text,"date" text,"stages" number,"distance" text,"winner" text,"time" text)
SELECT "time" FROM table_204_694 WHERE "year" = 1998
What is the attendance for week 11?
CREATE TABLE table_name_59 (attendance VARCHAR,week VARCHAR)
SELECT attendance FROM table_name_59 WHERE week = 11
when was patient 24547 prescribed a mycophenolate mofetil and cetylpyridinium chl (cepacol) at the same time for the first time in 08/last year?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE diagnoses_icd (row_id n...
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'mycophenolate mofetil' AND admissions.subject_id = 24547 AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_...
Tell me the result for week less than 4 and september 7, 1986
CREATE TABLE table_name_46 (result VARCHAR,week VARCHAR,date VARCHAR)
SELECT result FROM table_name_46 WHERE week < 4 AND date = "september 7, 1986"
What winner has the sanremo to cuneo as the course?
CREATE TABLE table_67817 ("Date" text,"Course" text,"Distance" text,"Type" text,"Winner" text)
SELECT "Winner" FROM table_67817 WHERE "Course" = 'sanremo to cuneo'
Filterable history of Review Types and Results.
CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId numbe...
SELECT ReviewTasks.Id, ReviewTasks.CreationDate, ReviewTaskTypes.Name AS ReviewType, ReviewTaskResultTypes.Name AS ResultType FROM ReviewTasks, ReviewTaskResults, ReviewTaskResultTypes, ReviewTaskTypes WHERE ReviewTasks.CompletedByReviewTaskId = ReviewTaskResults.Id AND ReviewTaskResultTypes.Id = ReviewTaskResults.Revi...
How many students did not have any course enrollment?
CREATE TABLE Student_Course_Enrolment (student_id VARCHAR)CREATE TABLE Students (student_id VARCHAR)
SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)
What was Sherrick McManis's earliest round?
CREATE TABLE table_20996923_25 (round__number INTEGER,player VARCHAR)
SELECT MIN(round__number) FROM table_20996923_25 WHERE player = "Sherrick McManis"
Which nation has the America 3 Foundation syndicate and the jayhawk yacht?
CREATE TABLE table_54699 ("Sail" text,"Yacht" text,"Syndicate" text,"Yacht Club" text,"Nation" text)
SELECT "Nation" FROM table_54699 WHERE "Syndicate" = 'america 3 foundation' AND "Yacht" = 'jayhawk'
How many golds for the nation ranked below 5 and over 1 bronze medals?
CREATE TABLE table_52350 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Gold") FROM table_52350 WHERE "Rank" > '5' AND "Bronze" < '1'
Get all comments for a specified user in a descending order by Score.
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE Users (Id number,Reputation number,CreationDa...
SELECT c.Score, c.Id AS "comment_link", p.Id AS "post_link", c.Text, c.CreationDate, c.UserId AS "user_link" FROM Comments AS c, Posts AS p WHERE p.Id = c.PostId AND c.UserId = @UserId ORDER BY c.Score DESC
What is the record for the game at home Los Angeles Lakers?
CREATE TABLE table_17333 ("#" real,"Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Attendance" text,"Record" text,"Streak" text)
SELECT "Record" FROM table_17333 WHERE "Home" = 'Los Angeles Lakers'
Plot sum capacity over openning year in a line chart, and I want to rank by the x axis in ascending.
CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price...
SELECT Openning_year, SUM(Capacity) FROM cinema ORDER BY Openning_year
What scores did the RSC Anderlecht club have?
CREATE TABLE table_name_68 (score VARCHAR,club VARCHAR)
SELECT score FROM table_name_68 WHERE club = "rsc anderlecht"
Which letter has an operator of the Defense Information Systems Agency?
CREATE TABLE table_46741 ("Letter" text,"IPv6 address" text,"AS-number" text,"Operator" text,"Location #sites (global/local)" text,"Software" text)
SELECT "Letter" FROM table_46741 WHERE "Operator" = 'defense information systems agency'
What player had the high point on July 7?
CREATE TABLE table_63598 ("Game" real,"Date" text,"Opponent" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location/Attendance" text,"Record" text)
SELECT "High points" FROM table_63598 WHERE "Date" = 'july 7'
How many patients are discharged to home health care and underwent the procedure cardiopulm resuscitate nos?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME" AND procedures.short_title = "Cardiopulm resuscita NOS"
when first did patient 12927 have the minimum heart rate 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 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 inputevents_cv (row_...
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12927)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart ra...
tell me the sex of patient 021-111547.
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab ...
SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '021-111547'
What is the fewest goals for when goals against is 75 and drawn is smaller than 11?
CREATE TABLE table_45087 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" real)
SELECT MIN("Goals For") FROM table_45087 WHERE "Goals Against" = '75' AND "Drawn" < '11'
What professors teach upper-level classes ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)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 int,heavy_assignments...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN program_...
What did Geelong score as the away team?
CREATE TABLE table_51523 ("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_51523 WHERE "Away team" = 'geelong'
datasets for KNN
CREATE TABLE venue (venueid int,venuename varchar)CREATE TABLE author (authorid int,authorname varchar)CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE cite (citingpaperid int,citedpaperid int)CREATE TABLE paperfield (fieldid int,paperid int)CREATE TABLE writes (paperid int,authorid int)CREATE TABLE pa...
SELECT DISTINCT dataset.datasetid FROM dataset, keyphrase, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'KNN' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid
what is admission location of subject name michael witt?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT demographic.admission_location FROM demographic WHERE demographic.name = "Michael Witt"
Name the air date for uk17
CREATE TABLE table_23414 ("No. overall" text,"No. in series" real,"Family/families" text,"Location(s)" text,"Original air date" text)
SELECT "Original air date" FROM table_23414 WHERE "No. overall" = 'UK17'
Name the away team score for home team of university
CREATE TABLE table_name_36 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team AS score FROM table_name_36 WHERE home_team = "university"
how many times does patient 006-245995 come in to the icu in 2104?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicm...
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-245995') AND STRFTIME('%y', patient.unitadmittime) = '2104'
What is the tyre for the circuit of Prince George, which had Jim Clark as the fastest lap?
CREATE TABLE table_name_82 (tyre VARCHAR,fastest_lap VARCHAR,circuit VARCHAR)
SELECT tyre FROM table_name_82 WHERE fastest_lap = "jim clark" AND circuit = "prince george"
Find the number of routes operated by American Airlines.
CREATE TABLE airlines (alid VARCHAR,name VARCHAR)CREATE TABLE routes (alid VARCHAR)
SELECT COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
what are the different software platforms for devices, and how many devices have each?
CREATE TABLE device (Device_ID int,Device text,Carrier text,Package_Version text,Applications text,Software_Platform text)CREATE TABLE stock (Shop_ID int,Device_ID int,Quantity int)CREATE TABLE shop (Shop_ID int,Shop_Name text,Location text,Open_Date text,Open_Year int)
SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform
Tell me the 1998 Broadway with barry cavanagh
CREATE TABLE table_4372 ("Character" text,"1954 Broadway" text,"1955 broadcast" text,"1960 broadcast" text,"1979 Broadway" text,"1990 Broadway" text,"1991 Broadway" text,"1998 Broadway" text,"1999 Broadway" text)
SELECT "1998 Broadway" FROM table_4372 WHERE "1999 Broadway" = 'barry cavanagh'
what is the total number of games in the swat series ?
CREATE TABLE table_203_633 (id number,"title" text,"year" number,"platform" text,"developer" text,"publisher" text)
SELECT COUNT("title") FROM table_203_633
what is the number of patients categorized under chemistry lab test who had open reduction of femur fracture with internal fixation?
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 procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Chemistry"
how much does patient 006-216991 pay for their hospital stay until 4 years ago?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight...
SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-216991') AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year')
What is the total capacity (MW) of the farm that is noted as being under construction?
CREATE TABLE table_name_17 (capacity__mw_ VARCHAR,notes VARCHAR)
SELECT COUNT(capacity__mw_) FROM table_name_17 WHERE notes = "under construction"
What is Segment A where Segment C is Sushi (part 1)?
CREATE TABLE table_19905 ("Series Ep." text,"Episode" real,"Netflix" text,"Segment A" text,"Segment B" text,"Segment C" text,"Segment D" text)
SELECT "Segment A" FROM table_19905 WHERE "Segment C" = 'Sushi (Part 1)'
What is the percentage of total area in the ecozone that the area is 1782252 km2?
CREATE TABLE table_20143 ("Ecozone" text,"Area (km\u00b2)" real,"Percentage of total area" text,"Percentage of land area" text,"Percentage protected" text)
SELECT "Percentage of total area" FROM table_20143 WHERE "Area (km\u00b2)" = '1782252'
For each payment method, how many payments were made Show bar chart, could you display in descending by the bar?
CREATE TABLE Customers (customer_id INTEGER,customer_address_id INTEGER,customer_status_code VARCHAR(15),date_became_customer DATETIME,date_of_birth DATETIME,first_name VARCHAR(80),last_name VARCHAR(80),amount_outstanding DOUBLE,email_address VARCHAR(250),phone_number VARCHAR(255),cell_mobile_phone_number VARCHAR(255))...
SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code ORDER BY payment_method_code DESC
The episode with production code 9abx02 was originally aired on what date?
CREATE TABLE table_10088101_1 (original_air_date VARCHAR,production_code VARCHAR)
SELECT original_air_date FROM table_10088101_1 WHERE production_code = "9ABX02"
What was the home team's score at the game that had a crowd larger than 24,000?
CREATE TABLE table_name_79 (home_team VARCHAR,crowd INTEGER)
SELECT home_team AS score FROM table_name_79 WHERE crowd > 24 OFFSET 000
How many divisions in bowling ?
CREATE TABLE table_30535 ("Season" text,"Sport" text,"Tournament Structure" text,"# of Divisions" real,"1st Tournament" real,"2012-2013 State Tournament Location" text)
SELECT "# of Divisions" FROM table_30535 WHERE "Sport" = 'Bowling'
how many of the patients admitted on transfer from hosp/extram had icd9 code 99591?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND diagnoses.icd9_code = "99591"
how many total people can fit in windsor park ?
CREATE TABLE table_203_420 (id number,"#" number,"stadium" text,"capacity" number,"city" text,"home team" text)
SELECT "capacity" FROM table_203_420 WHERE "stadium" = 'windsor park'
give me the one way flights from PITTSBURGH to BOSTON
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE date_day (month_number int,day_number int,year int,da...
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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = ...