instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
male or female > 60 years of age.
CREATE TABLE table_train_165 ("id" int,"gender" string,"hemoglobin_a1c_hba1c" float,"visual_impairment" bool,"blood_glucose" int,"body_mass_index_bmi" float,"a1c" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_165 WHERE (gender = 'male' OR gender = 'female') AND age > 60
count the number of patients whose ethnicity is black/cape verdean and days of hospital stay is greater than 10?
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.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay > "10"
Plot the total number by grouped by city code as a bar graph, could you list by the Y-axis in descending?
CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Has_Allergy (StuID INTEGER,Allergy VARCHAR(20))CREATE TABLE Allergy_Type (Allergy VARCHAR(20),AllergyType VARCHAR(20))
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) DESC
when was the last microbiological sputum, expectorated test of patient 025-44495 performed this month?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,cultur...
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 = '025-44495')) AND microlab.culturesite = 'sputum, expectorated' AN...
What's the report for the Silverstone circuit?
CREATE TABLE table_16777 ("Race Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Constructor" text,"Report" text)
SELECT "Report" FROM table_16777 WHERE "Circuit" = 'Silverstone'
Which College has a Round of 11, and a Position of wr?
CREATE TABLE table_name_42 (college VARCHAR,round VARCHAR,position VARCHAR)
SELECT college FROM table_name_42 WHERE round = 11 AND position = "wr"
Return a bar chart about the distribution of ACC_Road and the sum of School_ID , and group by attribute ACC_Road, display in asc by the total number of 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 ACC_Road, SUM(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(School_ID)
How many teams were there when chris bosh , lebron james (8) had the high rebounds?
CREATE TABLE table_3846 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT COUNT("Team") FROM table_3846 WHERE "High rebounds" = 'Chris Bosh , LeBron James (8)'
Which Year has a Position of 2nd, and Notes of -63kg, and a Venue of manchester?
CREATE TABLE table_65370 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Notes" text)
SELECT "Year" FROM table_65370 WHERE "Position" = '2nd' AND "Notes" = '-63kg' AND "Venue" = 'manchester'
provide the number of patients whose admission type is urgent and diagnoses short title is hyperacusis?
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.admission_type = "URGENT" AND diagnoses.short_title = "Hyperacusis"
how many defensive backs are there ?
CREATE TABLE table_204_70 (id number,"pick #" number,"nfl team" text,"player" text,"position" text,"college" text)
SELECT COUNT(*) FROM table_204_70 WHERE "position" = 'defensive back'
What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000 Plot them as bar chart, and I want to list by the names from low to high.
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))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),R...
SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000 ORDER BY JOB_TITLE
how did patient 70516 last come to the hospital since 2104?
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_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row...
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 70516 AND STRFTIME('%y', admissions.admittime) >= '2104' ORDER BY admissions.admittime DESC LIMIT 1
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by time, and I want to display in desc 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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_P...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(DEPARTMENT_ID) DESC
What is the date of the Mosport Park circuit?
CREATE TABLE table_5126 ("Race" text,"Length" text,"Class" text,"Circuit" text,"Date" text)
SELECT "Date" FROM table_5126 WHERE "Circuit" = 'mosport park'
What are the dates of death of those politicians whose date of birth 1938-08-30 30 august 1938?
CREATE TABLE table_25345002_1 (date_of_death VARCHAR,date_of_birth VARCHAR)
SELECT COUNT(date_of_death) FROM table_25345002_1 WHERE date_of_birth = "1938-08-30 30 August 1938"
Which player is in round 5?
CREATE TABLE table_11803648_20 (player VARCHAR,round VARCHAR)
SELECT player FROM table_11803648_20 WHERE round = 5
Which royal house is in the state of chu?
CREATE TABLE table_name_98 (royal_house VARCHAR,state VARCHAR)
SELECT royal_house FROM table_name_98 WHERE state = "chu"
What frequency does the Pentium processor use?
CREATE TABLE table_24018112_1 (frequency VARCHAR,brand_name VARCHAR)
SELECT frequency FROM table_24018112_1 WHERE brand_name = "Pentium"
On 15/04/07 in the competition Super League XII, what was the score?
CREATE TABLE table_name_94 (score VARCHAR,competition VARCHAR,date VARCHAR)
SELECT score FROM table_name_94 WHERE competition = "super league xii" AND date = "15/04/07"
what changes have been made to the arterial bp mean in patient 14203's last measured on the first icu visit compared to the second to last value measured on the first icu visit?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_labitems (row_id number,itemid number,label text)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 ...
SELECT (SELECT chartevents.valuenum 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 = 14203) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.item...
What is the home team of the game with a 2-0 record?
CREATE TABLE table_59583 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Home" FROM table_59583 WHERE "Record" = '2-0'
What kind of Republican ticket has a Prohibition ticket of stephen mead wing?
CREATE TABLE table_40136 ("Office" text,"Republican ticket" text,"Democratic ticket" text,"Socialist Labor ticket" text,"Prohibition ticket" text,"Independent Citizens' ticket" text)
SELECT "Republican ticket" FROM table_40136 WHERE "Prohibition ticket" = 'stephen mead wing'
how many teams had more points than silex ?
CREATE TABLE table_203_654 (id number,"position" number,"team" text,"points" number,"played" number,"won" number,"drawn" number,"lost" number,"for" number,"against" number,"difference" number)
SELECT COUNT("team") FROM table_203_654 WHERE "points" > (SELECT "points" FROM table_203_654 WHERE "team" = 'silex')
When bas van erp was the athlete what was the quarterfinals?
CREATE TABLE table_18602462_21 (quarterfinals VARCHAR,athlete VARCHAR)
SELECT quarterfinals FROM table_18602462_21 WHERE athlete = "Bas van Erp"
What is the leading scorer of the game with an attendance of 14,096?
CREATE TABLE table_34071 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Attendance" text,"Record" text)
SELECT "Leading scorer" FROM table_34071 WHERE "Attendance" = '14,096'
What are the total points for the skier with 3.18 slalom points?
CREATE TABLE table_59061 ("Place" text,"Competitor" text,"Downhill points" real,"Slalom points" text,"Total" text)
SELECT "Total" FROM table_59061 WHERE "Slalom points" = '3.18'
show me US flights from SAN FRANCISCO to PITTSBURGH on tuesday
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE month (month_number ...
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, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 22 AND date_day.month_number = 3 A...
Can you tell me the Away team that has the Away team score of 6.11 (47)?
CREATE TABLE table_51439 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_51439 WHERE "Away team score" = '6.11 (47)'
What is the average attendance at a game held at Firhill for the 5(r) round?
CREATE TABLE table_name_26 (attendance INTEGER,venue VARCHAR,round VARCHAR)
SELECT AVG(attendance) FROM table_name_26 WHERE venue = "firhill" AND round = "5(r)"
Tell me the most Att with a long of 27 with yards longer than 27
CREATE TABLE table_10786 ("Player" text,"Att." real,"Yards" real,"Avg." real,"Long" real,"FumL" real)
SELECT MAX("Att.") FROM table_10786 WHERE "Long" = '27' AND "Yards" > '27'
what is the cost of drug name aspirin chew tab 81 mg?
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 vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,he...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'aspirin chew tab 81 mg')
Which team has a Reg GP of 0, a pick number under 136 with a player named Regan Darby?
CREATE TABLE table_name_85 (team__league_ VARCHAR,player VARCHAR,reg_gp VARCHAR,pick__number VARCHAR)
SELECT team__league_ FROM table_name_85 WHERE reg_gp = 0 AND pick__number < 136 AND player = "regan darby"
Votes on deleted posts by year.
CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PendingFlags ...
SELECT COUNT(*) FROM Votes WHERE PostId IS NULL
what are the five most commonly prescribed medications in the same month to the female patients aged 20s after having been diagnosed with chf nos until 2104?
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 microbiologyevents (row_id number,subject_id number,...
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 most points that the Maserati 250F chassis scored in years after 1955?
CREATE TABLE table_name_39 (points INTEGER,chassis VARCHAR,year VARCHAR)
SELECT MAX(points) FROM table_name_39 WHERE chassis = "maserati 250f" AND year > 1955
What country had a 100% cut?
CREATE TABLE table_21690339_1 (country VARCHAR,_percentage_cut VARCHAR)
SELECT country FROM table_21690339_1 WHERE _percentage_cut = "100%"
please give me round trip fares from PITTSBURGH to PHILADELPHIA
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_spe...
SELECT DISTINCT fare.fare_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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
Which father had william iv as a husband?
CREATE TABLE table_name_98 (father VARCHAR,husband VARCHAR)
SELECT father FROM table_name_98 WHERE husband = "william iv"
was no. 1 or veteran built in 1847 ?
CREATE TABLE table_204_476 (id number,"name" text,"date built" number,"builder" text,"works no." number,"wheels" text,"cylinders" text,"notes" text,"withdrawn" number)
SELECT "name" FROM table_204_476 WHERE "name" IN ('no.1', 'veteran') AND "date built" = 1847
Give me a histogram for how many members are in each party?, and rank from low to high by the bar.
CREATE TABLE party_events (Event_ID int,Event_Name text,Party_ID int,Member_in_charge_ID int)CREATE TABLE party (Party_ID int,Minister text,Took_office text,Left_office text,Region_ID int,Party_name text)CREATE TABLE member (Member_ID int,Member_Name text,Party_ID text,In_office text)CREATE TABLE region (Region_ID int,...
SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID ORDER BY Party_name
For those days with the 3 largest maximum gust speeds, can you plot a bar chart to compare the total mean humidity of each day of the weeks?
CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time TEXT)CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temperature_f INTEGER,max_dew_point_f INTEGER,mean_dew_point_f INTEGER,min_dew_point_f INTEGER,max_humidity INTEGER,mean_humidity INT...
SELECT date, SUM(mean_humidity) FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
What is the company that made the chassis for the entrant danka arrows yamaha?
CREATE TABLE table_name_19 (chassis VARCHAR,entrant VARCHAR)
SELECT chassis FROM table_name_19 WHERE entrant = "danka arrows yamaha"
How many deaths did the year with 10 hurricanes and exactly 1 major hurricane have?
CREATE TABLE table_31088 ("Year" real,"Number of tropical storms" real,"Number of hurricanes" real,"Number of major hurricanes" real,"Deaths" text,"Strongest storm" text)
SELECT "Deaths" FROM table_31088 WHERE "Number of hurricanes" = '10' AND "Number of major hurricanes" = '1'
What are the last year of the parties whose theme is 'Spring' or 'Teqnology'? Count the last year for a bar chart, I want to rank y axis in desc order.
CREATE TABLE party (Party_ID int,Party_Theme text,Location text,First_year text,Last_year text,Number_of_hosts int)CREATE TABLE party_host (Party_ID int,Host_ID int,Is_Main_in_Charge bool)CREATE TABLE host (Host_ID int,Name text,Nationality text,Age text)
SELECT Last_year, COUNT(Last_year) FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology" GROUP BY Last_year ORDER BY COUNT(Last_year) DESC
Tell me the category for 2012 and drama league award
CREATE TABLE table_name_92 (category VARCHAR,year VARCHAR,award VARCHAR)
SELECT category FROM table_name_92 WHERE year = 2012 AND award = "drama league award"
What is the date of birth for basket baller called ido kozikaro
CREATE TABLE table_23670057_4 (year_born INTEGER,player VARCHAR)
SELECT MAX(year_born) FROM table_23670057_4 WHERE player = "Ido Kozikaro"
Deletable questions with a tag.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,Las...
SELECT p.Id FROM Posts AS p WHERE (p.PostTypeId = 1 AND NOT p.ClosedDate IS NULL AND p.Score <= '##maxscore##' AND p.ViewCount <= '##maxviews##' AND p.Tags LIKE '%##tag##%' AND DATEDIFF(day, p.ClosedDate, GETDATE()) >= '##mindays##' AND '##maxscore##' >= ALL (SELECT a.Score FROM Posts AS a WHERE (a.ParentId = p.Id)) AN...
count the number of patients whose diagnoses short title is subarachnoid hemorrhage and lab test fluid is pleural?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Subarachnoid hemorrhage" AND lab.fluid = "Pleural"
what is the number of patients whose gender is m and year of birth is less than 2024?
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 = "M" AND demographic.dob_year < "2024"
Percentage of Posts w/ Scores of >1, 0 and <1, by Post Type.
CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans...
SELECT pt.Name AS "Type", COUNT(p.Id) AS "Total", CAST(ROUND(COUNT(CASE WHEN p.Score > 0 THEN 1 ELSE NULL END) / CAST(COUNT(p.Id) AS FLOAT) * 100, 4) AS TEXT(7)) + '%' AS "+", CAST(ROUND(COUNT(CASE WHEN p.Score = 0 THEN 1 ELSE NULL END) / CAST(COUNT(p.Id) AS FLOAT) * 100, 4) AS TEXT(7)) + '%' AS "0", CAST(ROUND(COUNT(C...
How much Played has a Lost larger than 14, and Drawn of 8, and a Team of ipatinga?
CREATE TABLE table_36751 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT SUM("Played") FROM table_36751 WHERE "Lost" > '14' AND "Drawn" = '8' AND "Team" = 'ipatinga'
What are the numbers of races for each constructor id?
CREATE TABLE constructorStandings (constructorid VARCHAR)
SELECT COUNT(*), constructorid FROM constructorStandings GROUP BY constructorid
What Level has a Season larger than 2010?
CREATE TABLE table_64466 ("Season" real,"Level" text,"Division" text,"Administration" text,"Position" text)
SELECT "Level" FROM table_64466 WHERE "Season" > '2010'
What district is Wyatt Aiken in?
CREATE TABLE table_name_19 (district VARCHAR,incumbent VARCHAR)
SELECT district FROM table_name_19 WHERE incumbent = "wyatt aiken"
What is the average entry in the against column with draws smaller than 0?
CREATE TABLE table_59313 ("Portland DFL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT AVG("Against") FROM table_59313 WHERE "Draws" < '0'
what is the daily average amount of actual patient fluid removal that patient 028-30487 had in 05/this year?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean num...
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-30487')) AND intakeoutput.celllabel = 'actua...
what is the last ward id of patient 009-424 on the first hospital visit?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-424' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) ORDER BY patient.unitadmittime DESC LIMIT 1
history of hypersensitivity to the trial drug or to drugs with similar chemical structures.
CREATE TABLE table_train_186 ("id" int,"language" string,"diabetic" string,"regular_alcohol_intake" int,"allergy_to_drug" bool,"alcohol_abuse" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_186 WHERE allergy_to_drug = 1
which has the same prize money as the french super series ?
CREATE TABLE table_204_634 (id number,"tour" number,"official title" text,"venue" text,"city" text,"date\nstart" text,"date\nfinish" text,"prize money\nusd" number,"report" text)
SELECT "official title" FROM table_204_634 WHERE "official title" <> 'french super series' AND "prize money\nusd" = (SELECT "prize money\nusd" FROM table_204_634 WHERE "official title" = 'french super series')
How many championships were won for arena football?
CREATE TABLE table_24471 ("Team" text,"Sport" text,"League" text,"Established" real,"Began in St. Louis" real,"Venue" text,"Championships in St. Louis" text,"Left St. Louis" real)
SELECT "Championships in St. Louis" FROM table_24471 WHERE "Sport" = 'Arena Football'
who was the only prime minister to be in office three times ?
CREATE TABLE table_203_694 (id number,"#" number,"name" text,"took office" text,"left office" text,"party" text)
SELECT "name" FROM table_203_694 GROUP BY "name" HAVING COUNT(*) >= 3
Name the most opponents for 8-1 record
CREATE TABLE table_2417 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Midshipmen points" real,"Opponents" real,"Record" text)
SELECT MAX("Opponents") FROM table_2417 WHERE "Record" = '8-1'
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of revenue , and group by attribute founder, and display by the y-axis in ascending.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Revenue)
On what Date was the Score in Final 6 3, 6 3?
CREATE TABLE table_name_70 (date VARCHAR,score_in_final VARCHAR)
SELECT date FROM table_name_70 WHERE score_in_final = "6–3, 6–3"
tell me whether patient 004-66442 got 30 ml cup : alum & mag hydroxide-simeth 200-200-20 mg/5ml po susp until 03/2102?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,c...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-66442')) AND medication.drugname = '30 ml cup : alum & mag hydroxide-s...
Which Points is the lowest one that has a Year larger than 1974, and a Rank of 15th?
CREATE TABLE table_name_75 (points INTEGER,year VARCHAR,rank VARCHAR)
SELECT MIN(points) FROM table_name_75 WHERE year > 1974 AND rank = "15th"
how many patients whose diagnoses title is abrasion or friction burn of trunk, without mention of infection were admitted before the year 2125?
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 WHERE demographic.admityear < "2125" AND diagnoses.long_title = "Abrasion or friction burn of trunk, without mention of infection"
how many days have gone since patient 60136 was admitted to the hospital for?
CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icust...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 60136 AND admissions.dischtime IS NULL
What is the home team of the game that ended with a score of 0-1?
CREATE TABLE table_39888 ("Match No." text,"Home Team" text,"Score" text,"Away Team" text,"Attendance" text)
SELECT "Home Team" FROM table_39888 WHERE "Score" = '0-1'
What was the score when the NY Islanders was the visiting team?
CREATE TABLE table_77550 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Score" FROM table_77550 WHERE "Visitor" = 'ny islanders'
What is the product description of the product booked with an amount of 102.76?
CREATE TABLE products_for_hire (product_description VARCHAR,product_id VARCHAR)CREATE TABLE products_booked (product_id VARCHAR,booked_amount VARCHAR)
SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76
Any available ULCS next semester ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester in...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' AND semester.semester_id = course...
how many hours have passed since the first time patient 006-195316 visited ward 386 during the current hospital visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean num...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-195316' AND patient.wardid = 386 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
Select Top 100 *From Posts.
CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans...
SELECT * FROM Users LIMIT 100
Give me a histogram for how many rooms cost more than 120, for each different decor?, could you sort y-axis from low to high 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 basePrice > 120 GROUP BY decor ORDER BY COUNT(*)
what is the least number of concerts given in a season
CREATE TABLE table_203_288 (id number,"season" text,"premiere date" text,"the winner" text,"runner-up" text,"finalists" text,"contestants in order of elimination" text,"number of contestants" text,"number of concerts" number)
SELECT MIN("number of concerts") FROM table_203_288
Count the number of different affected regions.
CREATE TABLE storm (storm_id number,name text,dates_active text,max_speed number,damage_millions_usd number,number_deaths number)CREATE TABLE region (region_id number,region_code text,region_name text)CREATE TABLE affected_region (region_id number,storm_id number,number_city_affected number)
SELECT COUNT(DISTINCT region_id) FROM affected_region
On what team did John Bowe round winner at Winton Motor Raceway belong to?
CREATE TABLE table_45174 ("Circuit" text,"Location / State" text,"Date" text,"Round winner" text,"Team" text)
SELECT "Team" FROM table_45174 WHERE "Round winner" = 'john bowe' AND "Circuit" = 'winton motor raceway'
which production has the same number of performances as sleuth ?
CREATE TABLE table_204_592 (id number,"#" number,"title" text,"type" text,"opening\ndate" text,"closing\ndate" text,"performances" number,"comment" text)
SELECT "title" FROM table_204_592 WHERE "title" <> 'sleuth' AND "performances" = (SELECT "performances" FROM table_204_592 WHERE "title" = 'sleuth')
WHAT IS THE CITY WITH THIRD AS LORI OLSON-JOHNS?
CREATE TABLE table_44576 ("Skip" text,"Third" text,"Second" text,"Lead" text,"City" text)
SELECT "City" FROM table_44576 WHERE "Third" = 'lori olson-johns'
What is NK Rijeka's away score?
CREATE TABLE table_name_75 (away VARCHAR,club VARCHAR)
SELECT away FROM table_name_75 WHERE club = "nk rijeka"
Which hard has a Clay of 0 0, Grass of 0 0, Carpet of 0 0, and a Record of 1 0?
CREATE TABLE table_name_10 (hard VARCHAR,record VARCHAR,carpet VARCHAR,clay VARCHAR,grass VARCHAR)
SELECT hard FROM table_name_10 WHERE clay = "0–0" AND grass = "0–0" AND carpet = "0–0" AND record = "1–0"
Show all artist names and the year joined who are not from United States.
CREATE TABLE artist (name VARCHAR,year_join VARCHAR,country VARCHAR)
SELECT name, year_join FROM artist WHERE country <> 'United States'
find out the number of divorced patients for whom cortisol lab test had been ordered.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Cortisol"
Rank larger than 3, and a 6th Runner-up larger than 0, and a 5th Runner-up smaller than 1 has which lowest 1st Runner-up?
CREATE TABLE table_39336 ("Rank" real,"Country/Territory" text,"Miss World" real,"1st Runner-up" real,"2nd Runner-up" real,"3rd Runner-up" real,"4th Runner-up" real,"5th Runner-up" real,"6th Runner-up" real,"Semifinalists" real,"Total" real)
SELECT MIN("1st Runner-up") FROM table_39336 WHERE "Rank" > '3' AND "6th Runner-up" > '0' AND "5th Runner-up" < '1'
How much money for 1st place with a to par less than 1?
CREATE TABLE table_50351 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" real,"Money ($)" real)
SELECT COUNT("Money ( $ )") FROM table_50351 WHERE "Place" = '1' AND "To par" < '1'
What tournament was on May 31, 1987?
CREATE TABLE table_name_93 (tournament VARCHAR,date VARCHAR)
SELECT tournament FROM table_name_93 WHERE date = "may 31, 1987"
Find the number of patients whose is age less than 80 years and diagnoses long title is late effects of cerebrovascular disease hemiplegia affecting unspecified side.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "80" AND diagnoses.long_title = "Late effects of cerebrovascular disease, hemiplegia affecting unspecified side"
i want to fly from CLEVELAND to SAN DIEGO tomorrow and stop in INDIANAPOLIS
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_m...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight, flight_stop WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'INDIA...
What is the height of the player, Larry Hughes?
CREATE TABLE table_name_71 (height VARCHAR,player VARCHAR)
SELECT height FROM table_name_71 WHERE player = "larry hughes"
How many episodes with the production code CA106 are there?
CREATE TABLE table_25740548_2 (written_by VARCHAR,production_code VARCHAR)
SELECT COUNT(written_by) FROM table_25740548_2 WHERE production_code = "CA106"
What was the outcome of the match on 01/07/2007?
CREATE TABLE table_9034 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Outcome" FROM table_9034 WHERE "Date" = '01/07/2007'
In how many different games did Oliver Miller (7) did the high rebounds?
CREATE TABLE table_74458 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT COUNT("Game") FROM table_74458 WHERE "High rebounds" = 'Oliver Miller (7)'
whats patient 14467 last ward id since 4 years ago?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_...
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467) AND NOT transfers.wardid IS NULL AND DATETIME(transfers.intime) >= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY transfers.intime DESC LIMIT 1
BALTIMORE to PHILADELPHIA wednesday
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE...
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND date_day.day_number = 23 AND date_day.month_number = 4 ...
What's the FA Cup that has a league less than 1?
CREATE TABLE table_67604 ("Name" text,"League" real,"Play-offs" real,"FA Cup" real,"League Cup" real,"Total" real)
SELECT SUM("FA Cup") FROM table_67604 WHERE "League" < '1'
County of 46 laporte is what school?
CREATE TABLE table_name_83 (school VARCHAR,county VARCHAR)
SELECT school FROM table_name_83 WHERE county = "46 laporte"
What episode number in the series is 'dance to the music'?
CREATE TABLE table_26545 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real)
SELECT MIN("No. in series") FROM table_26545 WHERE "Title" = 'Dance to the Music'
What is the attendance when Cork City is the opponent?
CREATE TABLE table_name_7 (attendance INTEGER,opponents VARCHAR)
SELECT AVG(attendance) FROM table_name_7 WHERE opponents = "cork city"