instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
when was first time patient 010-20205 had the maximum sao2 value on the first intensive care unit visit?
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 vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-20205') AND NOT patient.unitdischargetime IS NU...
what is the number of patients whose discharge location is disch-tran to psych hosp and admission year is less than 2145?
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 WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.admityear < "2145"
Who was the home team for the game with Platense as the away team and attendance under 529?
CREATE TABLE table_name_67 (home VARCHAR,attendance VARCHAR,away VARCHAR)
SELECT home FROM table_name_67 WHERE attendance < 529 AND away = "platense"
what was the average age of the grasshoppers ?
CREATE TABLE table_204_26 (id number,"name" text,"position" text,"birth date/age at start of campaign" text,"games in campaign" text,"club" text)
SELECT AVG("birth date/age at start of campaign") FROM table_204_26 WHERE "club" = 'grasshoppers'
does pulaski county have more cities beginning with the letter a than montgomery county ?
CREATE TABLE table_204_299 (id number,"name of place" text,"number of counties" number,"principal county" text,"lower zip code" number)
SELECT (SELECT COUNT(*) FROM table_204_299 WHERE "principal county" = 'pulaski county') > (SELECT COUNT(*) FROM table_204_299 WHERE "principal county" = 'montgomery county')
What is the capital of the province with in Hangul?
CREATE TABLE table_42222 ("Former kingdom" text,"Province" text,"Hangul" text,"Hanja" text,"Capital" text,"Modern equivalent" text)
SELECT "Capital" FROM table_42222 WHERE "Hangul" = '양주'
How much Total has a Player of todd hamilton, and a To par smaller than 15?
CREATE TABLE table_13133 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" real,"Finish" text)
SELECT COUNT("Total") FROM table_13133 WHERE "Player" = 'todd hamilton' AND "To par" < '15'
What is the result of the London 2012 Women's Olympic Football Tournament?
CREATE TABLE table_69109 ("Match" text,"Date" text,"Location" text,"Lineup" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_69109 WHERE "Location" = 'london 2012 women''s olympic football tournament'
What is the location of the track that opened in 1950?
CREATE TABLE table_1245148_1 (location VARCHAR,year_opened VARCHAR)
SELECT location FROM table_1245148_1 WHERE year_opened = 1950
what was the venue that hosted Carlton as the away team?
CREATE TABLE table_name_24 (venue VARCHAR,away_team VARCHAR)
SELECT venue FROM table_name_24 WHERE away_team = "carlton"
What is the maximum overall number?
CREATE TABLE table_2985714_2 (_number INTEGER)
SELECT MAX(_number) FROM table_2985714_2
What is the date with Ellis as the decision and St. Louis as the visitor?
CREATE TABLE table_57584 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Record" text)
SELECT "Date" FROM table_57584 WHERE "Decision" = 'ellis' AND "Visitor" = 'st. louis'
Which Payments were processed with Visa? List the date and the amount using a bar chart, order by the y axis in desc.
CREATE TABLE Customer_Policies (Policy_ID INTEGER,Customer_ID INTEGER,Policy_Type_Code CHAR(15),Start_Date DATE,End_Date DATE)CREATE TABLE Settlements (Settlement_ID INTEGER,Claim_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER,Customer_Policy_ID INTEGER)CREATE TABL...
SELECT Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY Amount_Payment DESC
Numbers most used in posts. totally useless. more of an experiment.
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 ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu...
SELECT OwnerUserId AS "user_link", OwnerUserId, SUM(LENGTH(Body)) AS totalLen, SUM(LENGTH(Body) - LENGTH(REPLACE(LOWER(Body), '1', ''))) AS "1", SUM(LENGTH(Body) - LENGTH(REPLACE(LOWER(Body), '2', ''))) AS "2", SUM(LENGTH(Body) - LENGTH(REPLACE(LOWER(Body), '3', ''))) AS "3", SUM(LENGTH(Body) - LENGTH(REPLACE(LOWER(Bod...
what's the league where regular season is 2nd, northwest
CREATE TABLE table_1046454_1 (league VARCHAR,regular_season VARCHAR)
SELECT league FROM table_1046454_1 WHERE regular_season = "2nd, Northwest"
count the number of patients whose death status is 1 and diagnoses short title is dermatitis nos?
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.expire_flag = "1" AND diagnoses.short_title = "Dermatitis NOS"
What rank is Bulgaria with less than 3 silver and more than 1 bronze?
CREATE TABLE table_64875 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT "Rank" FROM table_64875 WHERE "Silver" < '3' AND "Bronze" > '1' AND "Nation" = 'bulgaria'
For those employees who do not work in departments with managers that have ids between 100 and 200, a line chart shows the change of commission_pct over hire_date, and sort X in asc order.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
In Tie #19, what was the name of the away team?
CREATE TABLE table_name_27 (away_team VARCHAR,tie_no VARCHAR)
SELECT away_team FROM table_name_27 WHERE tie_no = "19"
how many patients were diagnosed with hx of bladder malignancy in this year after being diagnosed with fx condyl proc mandib-cl within 2 months?
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 icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid numb...
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 = 'hx of bladder mali...
What college did steve justice attend?
CREATE TABLE table_19788 ("Round" real,"Choice" real,"Player" text,"Position" text,"Height" text,"Weight" text,"College" text)
SELECT "College" FROM table_19788 WHERE "Player" = 'Steve Justice'
how many emergency hospital admission patients have lab test item id 51259?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.itemid = "51259"
how many songs were produced by chaos ?
CREATE TABLE table_203_353 (id number,"#" number,"title" text,"producer(s)" text,"featured guest(s)" text,"time" text)
SELECT COUNT("title") FROM table_203_353 WHERE "producer(s)" = 'chaos'
what is the primary disease for the patient id 92796?
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 demographic.diagnosis FROM demographic WHERE demographic.subject_id = "92796"
In which club is Ledley King a captain?
CREATE TABLE table_79809 ("Club" text,"Manager" text,"Captain" text,"Manufacturer" text,"Sponsor" text)
SELECT "Club" FROM table_79809 WHERE "Captain" = 'ledley king'
What are the memories and carriers of phones?
CREATE TABLE phone (Memory_in_G VARCHAR,Carrier VARCHAR)
SELECT Memory_in_G, Carrier FROM phone
What is the minimum age of patients whose admission location is trsf within this facility and primary disease is ruq pain?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "RUQ PAIN"
What first class team does sanath jayasuriya play for?
CREATE TABLE table_name_51 (first_class_team VARCHAR,player VARCHAR)
SELECT first_class_team FROM table_name_51 WHERE player = "sanath jayasuriya"
Name the election for the percent of popular vote being 4.48%
CREATE TABLE table_286271_1 (election VARCHAR,_percentage_of_popular_vote VARCHAR)
SELECT election FROM table_286271_1 WHERE _percentage_of_popular_vote = "4.48%"
Where is the location of Game 4?
CREATE TABLE table_66090 ("Game" text,"Date" text,"Opponent" text,"Score" text,"Location/Attendance" text,"Record" text)
SELECT "Location/Attendance" FROM table_66090 WHERE "Game" = '4'
count the numbers of patients who were diagnosed with acute respiratory distress and did not come back to the hospital within 2 months in 2105.
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 (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute respiratory distress' AND STRFTIME('%y', diagnosis.diagnosistime) = '2105') AS t1) - (SELECT C...
find the number of patients who were born before the year 2123 and their lab test fluid is cerebrospinal fluid (csf).
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2123" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
How many items in each participant type code? Show me a pie chart!
CREATE TABLE Services (Service_ID INTEGER,Service_Type_Code CHAR(15))CREATE TABLE Events (Event_ID INTEGER,Service_ID INTEGER,Event_Details VARCHAR(255))CREATE TABLE Participants (Participant_ID INTEGER,Participant_Type_Code CHAR(15),Participant_Details VARCHAR(255))CREATE TABLE Participants_in_Events (Event_ID INTEGER...
SELECT Participant_Type_Code, COUNT(Participant_Type_Code) FROM Participants GROUP BY Participant_Type_Code
What is the league cup apps when the league goals are greater than 3, there are 30 (2) total apps, and has a position of mf?
CREATE TABLE table_46958 ("Squad No." real,"Name" text,"Position" text,"League Apps" text,"League Goals" real,"FA Cup Apps" text,"FA Cup Goals" real,"League Cup Apps" text,"League Cup Goals" real,"Total Apps" text,"Total Goals" real)
SELECT "League Cup Apps" FROM table_46958 WHERE "Position" = 'mf' AND "League Goals" > '3' AND "Total Apps" = '30 (2)'
What is the highest year that has fila world championships as the event, with toledo, united states as the venue, and a weight class (kg) less than 97?
CREATE TABLE table_name_37 (year INTEGER,weight_class__kg_ VARCHAR,event VARCHAR,venue VARCHAR)
SELECT MAX(year) FROM table_name_37 WHERE event = "fila world championships" AND venue = "toledo, united states" AND weight_class__kg_ < 97
what is the number of elective hospital admission patients who had urethral catheterization?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.short_title = "Ureteral catheterization"
What is the total number of viewers where the share is 7 and the week rank is 64?
CREATE TABLE table_16072430_1 (viewers VARCHAR,share VARCHAR,weekly_rank VARCHAR)
SELECT COUNT(viewers) FROM table_16072430_1 WHERE share = 7 AND weekly_rank = "64"
give the number of patients whose admission type is elective and primary disease is abdominal abscess.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.diagnosis = "ABDOMINAL ABSCESS"
what are the four most commonly ordered procedures for patients who had previously received anticonvulsant - levetiracetam in the same hospital visit, in 2105?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime t...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antic...
What was the high points when rebounds were Terrence Williams (8)?
CREATE TABLE table_22879323_10 (high_points VARCHAR,high_rebounds VARCHAR)
SELECT high_points FROM table_22879323_10 WHERE high_rebounds = "Terrence Williams (8)"
How many people directed the episode that aired on February 5, 1968?
CREATE TABLE table_25800134_12 (director VARCHAR,airdate VARCHAR)
SELECT COUNT(director) FROM table_25800134_12 WHERE airdate = "February 5, 1968"
What's the total of Goals Scored with Points that's smaller than 27, and a Team of C.D. Atl tico Balboa?
CREATE TABLE table_72005 ("Place" real,"Team" text,"Played" real,"Draw" real,"Lost" real,"Goals Scored" real,"Goals Conceded" real,"Points" real)
SELECT SUM("Goals Scored") FROM table_72005 WHERE "Points" < '27' AND "Team" = 'c.d. atlético balboa'
how old was pierre vallieres before he died ?
CREATE TABLE table_204_698 (id number,"name" text,"lifetime" text,"nationality" text,"notable as" text,"notes" text)
SELECT "lifetime" - "lifetime" FROM table_204_698 WHERE "name" = 'pierre vallieres'
Name the number of dismissals for adam gilchrist
CREATE TABLE table_23316034_23 (dismissals VARCHAR,player VARCHAR)
SELECT COUNT(dismissals) FROM table_23316034_23 WHERE player = "Adam Gilchrist"
Scatter plot to show min(age) on x axis and maximal age on y axis for different majors.
CREATE TABLE Plays_Games (StuID INTEGER,GameID INTEGER,Hours_Played INTEGER)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,LNam...
SELECT MIN(Age), MAX(Age), Major FROM Student GROUP BY Major
What are the id and zip code of the address with the highest monthly rental?
CREATE TABLE Addresses (zip_postcode VARCHAR,address_id VARCHAR)CREATE TABLE Student_Addresses (address_id VARCHAR)
SELECT T2.address_id, T1.zip_postcode FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id ORDER BY monthly_rental DESC LIMIT 1
What is the finish for the chip ganassi racing team that was later than 2010 and a Start of 17?
CREATE TABLE table_6322 ("Year" real,"Chassis" text,"Engine" text,"Start" text,"Finish" text,"Team" text)
SELECT "Finish" FROM table_6322 WHERE "Team" = 'chip ganassi racing' AND "Year" > '2010' AND "Start" = '17'
tell me the top four most frequent diagnoses that patients were diagnosed with within 2 months after receiving cardioversion in the previous year.
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE allergy (...
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cardioversion' AND DATETIME(treatment.tr...
Name the sum of gross tonnage for wood on date more tahn 1846 for comissioned and ship of esk
CREATE TABLE table_52907 ("Ship" text,"Date Commissioned" real,"Gross Tonnage" real,"Propulsion" text,"Material" text)
SELECT SUM("Gross Tonnage") FROM table_52907 WHERE "Material" = 'wood' AND "Date Commissioned" > '1846' AND "Ship" = 'esk'
What was the season number for the episode with the series number 61?
CREATE TABLE table_16971 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real)
SELECT MAX("Season #") FROM table_16971 WHERE "Series #" = '61'
when was the last time that was patient 007-15837 had the maximum -monos in the current hospital encounter?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dos...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-15837' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = '-monos' O...
What are the names and headquarters of all manufacturers, ordered by revenue descending?
CREATE TABLE products (code number,name text,price number,manufacturer number)CREATE TABLE manufacturers (code number,name text,headquarter text,founder text,revenue number)
SELECT name, headquarter FROM manufacturers ORDER BY revenue DESC
What is Date when Runner-up is Sof a Mul novich ( per )?
CREATE TABLE table_41437 ("Date" text,"Location" text,"Country" text,"Event" text,"Winner" text,"Runner-up" text)
SELECT "Date" FROM table_41437 WHERE "Runner-up" = 'sofía mulánovich ( per )'
Provide the admission location as well as discharge location of Elizabeth Bateman.
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.admission_location, demographic.discharge_location FROM demographic WHERE demographic.name = "Elizabeth Bateman"
In which location did he win the Superbrawl 16 event?
CREATE TABLE table_46147 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" text,"Location" text)
SELECT "Location" FROM table_46147 WHERE "Res." = 'win' AND "Event" = 'superbrawl 16'
What is the highest Pick number that had a road number that was less than 6, featured Bob Dailey as a player, and which had a Reg GP bigger than 257?
CREATE TABLE table_name_43 (pick__number INTEGER,reg_gp VARCHAR,rd__number VARCHAR,player VARCHAR)
SELECT MAX(pick__number) FROM table_name_43 WHERE rd__number < 6 AND player = "bob dailey" AND reg_gp > 257
Show me about the distribution of Sex and the sum of Height , and group by attribute Sex in a bar chart, and list X in descending order.
CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)
SELECT Sex, SUM(Height) FROM people GROUP BY Sex ORDER BY Sex DESC
how many of the patients aged below 74 were discharged after short term hospital care?
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 WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.age < "74"
Among patients admitted in the year or after 2187, calculate the minimum age of patients with brain mass intracranial hemorrhage as their primary disease
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 MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND demographic.admityear >= "2187"
how many patients less than 27 years of age have been diagnosed with hypoxemia?
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 demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "27" AND diagnoses.long_title = "Hypoxemia"
Find the titles of items that received both a rating higher than 8 and a rating below 5.
CREATE TABLE item (title VARCHAR,i_id VARCHAR)CREATE TABLE review (i_id VARCHAR,rating INTEGER)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
What dates had matches at the venue Sabina Park?
CREATE TABLE table_name_50 (date VARCHAR,venue VARCHAR)
SELECT date FROM table_name_50 WHERE venue = "sabina park"
what is the number of times that miracle man has held the belt ?
CREATE TABLE table_204_854 (id number,"#" number,"wrestlers" text,"reign" number,"date" text,"days\nheld" number,"location" text,"notes" text)
SELECT COUNT(*) FROM table_204_854 WHERE "wrestlers" = 'miracle man'
Which Opponent has an Attendance of bye?
CREATE TABLE table_name_76 (opponent VARCHAR,attendance VARCHAR)
SELECT opponent FROM table_name_76 WHERE attendance = "bye"
count the number of patients whose admission year is less than 2138 and diagnoses long title is unspecified schizophrenia, unspecified?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2138" AND diagnoses.long_title = "Unspecified schizophrenia, unspecified"
conferences in 2013
CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE writes (paperid int,authorid int)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE venue (venueid int,venuename varchar)CREATE TABLE paperkeyphrase (paperid int,keyphraseid int)CREA...
SELECT DISTINCT venueid FROM paper WHERE year = 2013
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday by a bar chart, and show by the y axis in ascending.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGE...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID)
When Kerry# was 199060, what was the percentage?
CREATE TABLE table_21806 ("County" text,"Kerry%" text,"Kerry#" real,"Bush%" text,"Bush#" real,"Others%" text,"Others#" real,"2000 result" text)
SELECT "Kerry%" FROM table_21806 WHERE "Kerry#" = '199060'
provide me the number of female patients born before 2087.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.dob_year < "2087"
what team played on may 20 on the home side
CREATE TABLE table_name_50 (home_team VARCHAR,date VARCHAR)
SELECT home_team FROM table_name_50 WHERE date = "may 20"
WHAT IS THE LOWEST MONEY WITH 74-74-76-74=298 SCORE?
CREATE TABLE table_name_2 (money___ INTEGER,score VARCHAR)
SELECT MIN(money___) AS $__ FROM table_name_2 WHERE score = 74 - 74 - 76 - 74 = 298
What is the coin that weighs 3 g made of?
CREATE TABLE table_40147 ("Value" text,"\u20ac equiv." text,"Diameter" text,"Weight" text,"Composition" text)
SELECT "Composition" FROM table_40147 WHERE "Weight" = '3 g'
What was their record when they played the stampeders?
CREATE TABLE table_21839208_4 (record VARCHAR,opponent VARCHAR)
SELECT record FROM table_21839208_4 WHERE opponent = "Stampeders"
Show me a bar chart for how many students are advised by each rank of faculty? List the rank and the number of students, and order in ascending by the Y-axis please.
CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Student (StuID INTEGER,LName...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY COUNT(*)
When the runner-up is listed as Gigi Fern ndez Natalia Zvereva and the week is 26 June 2 weeks, who are the semi finalists?
CREATE TABLE table_name_25 (semi_finalists VARCHAR,runner_up VARCHAR,week_of VARCHAR)
SELECT semi_finalists FROM table_name_25 WHERE runner_up = "gigi fernández natalia zvereva" AND week_of = "26 june 2 weeks"
A pie chart shows the proportion of All_Neutral and School_ID.
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_Neutral, School_ID FROM basketball_match
what amount of hours have passed since patient 022-6959 had the last procedure on this hospital visit?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitsta...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-6959'...
What is Score, when Outcome is 'winner', when Partnering is 'Nicole Sewell', and when Opponent in Final is 'Victoria Davies / Kate Warne-Holland'?
CREATE TABLE table_name_50 (score VARCHAR,opponent_in_final VARCHAR,outcome VARCHAR,partnering VARCHAR)
SELECT score FROM table_name_50 WHERE outcome = "winner" AND partnering = "nicole sewell" AND opponent_in_final = "victoria davies / kate warne-holland"
Can you say what was the entrant of maserati built item with a Tyre of p with a chassis of 250f a6gcm that was driven by Luigi Villoresi?
CREATE TABLE table_53662 ("Entrant" text,"Constructor" text,"Chassis" text,"Tyre" text,"Driver" text,"Rounds" text)
SELECT "Entrant" FROM table_53662 WHERE "Constructor" = 'maserati' AND "Tyre" = 'p' AND "Chassis" = '250f a6gcm' AND "Driver" = 'luigi villoresi'
what is the total number of titles in 2011 ?
CREATE TABLE table_204_927 (id number,"title" text,"year" number,"artist(s)" text,"album" text,"writer(s)" text,"producer(s)" text)
SELECT COUNT("title") FROM table_204_927 WHERE "year" = 2011
What is the Outcome in the Malaysia Open with Partner Yoo Sang-Hee?
CREATE TABLE table_name_81 (outcome VARCHAR,partner VARCHAR,venue VARCHAR)
SELECT outcome FROM table_name_81 WHERE partner = "yoo sang-hee" AND venue = "malaysia open"
What is the win-loss when 2008 has a value of Q1 at Australian Open?
CREATE TABLE table_15060 ("Tournament" text,"2007" text,"2008" text,"2009" text,"Career Win-Loss" text)
SELECT "Career Win-Loss" FROM table_15060 WHERE "2008" = 'q1' AND "Tournament" = 'australian open'
What is the occupation of the candidate that resides in Windsor Junction?
CREATE TABLE table_55678 ("Riding" text,"Candidate" text,"Gender" text,"Residence" text,"Occupation" text,"Votes" real,"Rank" text)
SELECT "Occupation" FROM table_55678 WHERE "Residence" = 'windsor junction'
Which Eviction result has a Net vote of 31.86%?
CREATE TABLE table_name_10 (eviction_result VARCHAR,net_vote VARCHAR)
SELECT eviction_result FROM table_name_10 WHERE net_vote = "31.86%"
what were the four most frequent drugs prescribed within the same month to the patients aged 40s after having been diagnosed with acute kidney failure nos this year?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,discht...
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 ...
who is the opponent when the score is 7 5, 7 6 (8 6)?
CREATE TABLE table_46947 ("Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Opponent" FROM table_46947 WHERE "Score" = '7–5, 7–6 (8–6)'
What is the rank with 0 bronze?
CREATE TABLE table_76069 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT AVG("Rank") FROM table_76069 WHERE "Bronze" < '0'
Outcome of 13, and a Year of 2007 happened in what venue?
CREATE TABLE table_34960 ("Outcome" text,"Year" text,"Venue" text,"Last opponent" text,"Score" text)
SELECT "Venue" FROM table_34960 WHERE "Outcome" = '13' AND "Year" = '2007'
What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50?
CREATE TABLE regions (region_id number,region_name text)CREATE TABLE job_history (employee_id number,start_date time,end_date time,job_id text,department_id number)CREATE TABLE employees (employee_id number,first_name text,last_name text,email text,phone_number text,hire_date time,job_id text,salary number,commission_p...
SELECT email FROM employees WHERE commission_pct = "null" AND salary BETWEEN 7000 AND 12000 AND department_id = 50
how many stations have frequencies between 88 and 92 ?
CREATE TABLE table_204_258 (id number,"location" text,"frequency" number,"call sign" text,"network" text,"call sign meaning" text)
SELECT COUNT(*) FROM table_204_258 WHERE "frequency" >= 88 AND "frequency" <= 92
What is the smallest round with a Grand Prix of indian gp?
CREATE TABLE table_name_74 (round INTEGER,grand_prix VARCHAR)
SELECT MIN(round) FROM table_name_74 WHERE grand_prix = "indian gp"
Which year is the lowest one when the playoffs did not qualify?
CREATE TABLE table_name_93 (year INTEGER,playoffs VARCHAR)
SELECT MIN(year) FROM table_name_93 WHERE playoffs = "did not qualify"
Find the category descriptions of the products whose descriptions include letter 't', and count them by a bar chart, and I want to display by the names in descending please.
CREATE TABLE Product_Characteristics (product_id INTEGER,characteristic_id INTEGER,product_characteristic_value VARCHAR(50))CREATE TABLE Ref_Characteristic_Types (characteristic_type_code VARCHAR(15),characteristic_type_description VARCHAR(80))CREATE TABLE Ref_Colors (color_code VARCHAR(15),color_description VARCHAR(80...
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY product_category_description DESC
How much total has a To par of +9?
CREATE TABLE table_46263 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" text,"Finish" text)
SELECT COUNT("Total") FROM table_46263 WHERE "To par" = '+9'
Tell me the DA for bureau chief ada
CREATE TABLE table_name_22 (district_attorney VARCHAR,position VARCHAR)
SELECT district_attorney FROM table_name_22 WHERE position = "bureau chief ada"
How many rounds had a selection of 165?
CREATE TABLE table_43064 ("Round" real,"Selection" real,"Player" text,"Position" text,"College" text)
SELECT SUM("Round") FROM table_43064 WHERE "Selection" = '165'
Name the right ascension for sagittarius and NGC number larger than 6522 for open cluster and declination of 22
CREATE TABLE table_10403 ("NGC number" real,"Object type" text,"Constellation" text,"Right ascension (J2000)" text,"Declination (J2000)" text)
SELECT "Right ascension ( J2000 )" FROM table_10403 WHERE "Constellation" = 'sagittarius' AND "NGC number" > '6522' AND "Object type" = 'open cluster' AND "Declination ( J2000 )" = '°22′'
Name the total number of lg for cg is larger than 1.0 for c apps is 3
CREATE TABLE table_25117 ("Player" text,"Nat" text,"Pos" text,"L Apps" real,"L G" real,"C Apps" real,"C G" real,"Total Apps" real,"Total G" real)
SELECT COUNT("L G") FROM table_25117 WHERE "C G" > '1.0' AND "C Apps" = '3'
How many golds have denmark as the nation, with a total less than 1?
CREATE TABLE table_64830 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Gold") FROM table_64830 WHERE "Nation" = 'denmark' AND "Total" < '1'
What is the part number of athlon x2 4850e?
CREATE TABLE table_name_89 (part_number_s_ VARCHAR,model_number VARCHAR)
SELECT part_number_s_ FROM table_name_89 WHERE model_number = "athlon x2 4850e"