instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the two year survival rate for fracture patella-closed patients who were prescribed with pantoprazole sodium?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id numb...
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
What Time has a Show Name of mornings with neil mitchell?
CREATE TABLE table_name_44 (time VARCHAR,show_name VARCHAR)
SELECT time FROM table_name_44 WHERE show_name = "mornings with neil mitchell"
when did patient 035-2205 last have a diagnosis of respiratory arrest since 2105?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,cultu...
SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205')) AND diagnosis.diagnosisname = 'respiratory arrest' AN...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a line chart about the change of commission_pct over hire_date , and sort from high to low by the X please.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EM...
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 DESC
How long did the soap opera run in which Nadine Spru acted in?
CREATE TABLE table_65041 ("Actor" text,"Character" text,"Soap Opera" text,"Years" text,"Duration" text)
SELECT "Character" FROM table_65041 WHERE "Actor" = 'nadine spruß'
Which Losses have Wins smaller than 6, and a South West DFL of sandford?
CREATE TABLE table_name_39 (losses INTEGER,wins VARCHAR,south_west_dfl VARCHAR)
SELECT MIN(losses) FROM table_name_39 WHERE wins < 6 AND south_west_dfl = "sandford"
provide the number of patients who were aadmitted before the year 2125 and their drug route is neb.
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2125" AND prescriptions.route = "NEB"
what is ethnicity of subject id 55094?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT demographic.ethnicity FROM demographic WHERE demographic.subject_id = "55094"
Which team has Peak Fitness as the primary sponsor?
CREATE TABLE table_37459 ("Team" text,"Car(s)" text,"Driver(s)" text,"Primary Sponsor(s)" text,"Crew Chief" text)
SELECT "Team" FROM table_37459 WHERE "Primary Sponsor(s)" = 'peak fitness'
What was the size of the crowd at the game where Fitzroy was the home team?
CREATE TABLE table_54381 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Crowd" FROM table_54381 WHERE "Home team" = 'fitzroy'
who ruled longer , ali saibou or mamadou tandja ?
CREATE TABLE table_203_528 (id number,"year" number,"political rights" number,"civil liberties" number,"status" text,"president" text)
SELECT "president" FROM table_203_528 WHERE "president" IN ('ali saibou', 'mamadou tandja') GROUP BY "president" ORDER BY COUNT(*) DESC LIMIT 1
Name the start with Laps of 199 with qual of 224.838
CREATE TABLE table_67791 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real)
SELECT "Start" FROM table_67791 WHERE "Laps" = '199' AND "Qual" = '224.838'
What is the score when the tie number is 8?
CREATE TABLE table_59956 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Score" FROM table_59956 WHERE "Tie no" = '8'
what is the two year survival rate of a person with vascular insufficiency of intestine - due to low cardiac output?
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 allergy (allergyid number,patientunitstayid number,drugname text,allergyna...
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
Tell me the role of festival theatre
CREATE TABLE table_32108 ("Year" real,"Play" text,"Role" text,"Theatre" text,"Location" text)
SELECT "Role" FROM table_32108 WHERE "Theatre" = 'festival theatre'
What was the away team that scored 8.15 (63)?
CREATE TABLE table_4541 ("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_4541 WHERE "Away team score" = '8.15 (63)'
What was the time for a round less than 3?
CREATE TABLE table_name_35 (time VARCHAR,round INTEGER)
SELECT time FROM table_name_35 WHERE round < 3
What is the lowest mintage in a year earlier than 2005?
CREATE TABLE table_10334 ("Year" real,"Park" text,"Artist" text,"Mintage" real,"Issue Price" text)
SELECT MIN("Mintage") FROM table_10334 WHERE "Year" < '2005'
What is the result of the away game played on August 4?
CREATE TABLE table_name_15 (result VARCHAR,home_away VARCHAR,date VARCHAR)
SELECT result FROM table_name_15 WHERE home_away = "away" AND date = "august 4"
How many tournaments were held at Alabama?
CREATE TABLE table_2433 ("Date" text,"Tournament" text,"Location" text,"Purse ($)" real,"Winner" text,"Score" text,"1st Prize ($)" text)
SELECT COUNT("Score") FROM table_2433 WHERE "Location" = 'Alabama'
How much Capacity has a Vehicle of 2003 holden commodore ute?
CREATE TABLE table_name_97 (capacity VARCHAR,vehicle VARCHAR)
SELECT COUNT(capacity) FROM table_name_97 WHERE vehicle = "2003 holden commodore ute"
Which Laps have a Time of +39.476, and a Grid larger than 11?
CREATE TABLE table_name_15 (laps INTEGER,time VARCHAR,grid VARCHAR)
SELECT AVG(laps) FROM table_name_15 WHERE time = "+39.476" AND grid > 11
what was the last heart rate in patient 15794's body on the current icu visit?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx ...
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 = 15794) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHE...
What is the average roll of a school with state authority and a decile of 9?
CREATE TABLE table_14693 ("Name" text,"Years" text,"Area" text,"Authority" text,"Decile" real,"Roll" real)
SELECT AVG("Roll") FROM table_14693 WHERE "Authority" = 'state' AND "Decile" = '9'
what are the top three most frequent procedures patients had received during the same hospital visit after they were diagnosed with metabolic acidosis - increased anion gap until 2104?
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 t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'metab...
how many patients in the 285 ward?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight nu...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 285
What is the average number of points for places over 7 and having a draw order of 4?
CREATE TABLE table_name_49 (points INTEGER,place VARCHAR,draw VARCHAR)
SELECT AVG(points) FROM table_name_49 WHERE place > 7 AND draw = 4
What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
CREATE TABLE addresses (address_id number,line_1_number_building text,city text,zip_postcode text,state_province_county text,country text)CREATE TABLE customer_payments (customer_id number,datetime_payment time,payment_method_code text,amount_payment number)CREATE TABLE vehicles (vehicle_id number,vehicle_details text)...
SELECT phone_number, email_address FROM customers WHERE amount_outstanding > 2000
What is the organisation in 2011 that was nominated and the award of best info-ed programme host?
CREATE TABLE table_name_8 (organisation VARCHAR,award VARCHAR,year VARCHAR,result VARCHAR)
SELECT organisation FROM table_name_8 WHERE year = 2011 AND result = "nominated" AND award = "best info-ed programme host"
Count the number of patients who underwent other open incisional hernia repair with graft or prosthesis and died in or before the year 2131.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2131.0" AND procedures.short_title = "Open incis hern-grft NEC"
what is item id and lab test value of subject id 3343?
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 lab.itemid, lab.value_unit FROM lab WHERE lab.subject_id = "3343"
Compare the total enrollment in each county with a bar chart, and list by the names from low to high please.
CREATE TABLE budget (School_id int,Year int,Budgeted int,total_budget_percent_budgeted real,Invested int,total_budget_percent_invested real,Budget_invested_percent text)CREATE TABLE endowment (endowment_id int,School_id int,donator_name text,amount real)CREATE TABLE School (School_id text,School_name text,Location text...
SELECT County, SUM(Enrollment) FROM School GROUP BY County ORDER BY County
What is the date for 45,000 in attendance?
CREATE TABLE table_45707 ("Date" text,"Opponent" text,"Site" text,"Result" text,"Attendance" text)
SELECT "Date" FROM table_45707 WHERE "Attendance" = '45,000'
provide the number of patients who have the procedure long title as hemodialysis.
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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Hemodialysis"
Name the date for faro
CREATE TABLE table_14789 ("Date" text,"Location" text,"Lineup" text,"Assist/pass" text,"Score" text,"Result" text,"Competition" text)
SELECT "Date" FROM table_14789 WHERE "Location" = 'faro'
what was the name of the first intake of patient 23070 that they had on last month/30?
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 admissions (row_id number,subject_id number,hadm_id ...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070)) AND DATETIME(inputevents_cv....
What is the lowest metal total when the Bronze metals are larger than 0, the Gold medals are smaller than 1, and the nation is Switzerland?
CREATE TABLE table_11989 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Total") FROM table_11989 WHERE "Bronze" > '0' AND "Nation" = 'switzerland' AND "Gold" < '1'
how many days have it been since the time patient 015-59552 was admitted to hospital?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '015-59552' AND patient.hospitaldischargetime IS NULL
indicate the daily average amount of arterial bp [systolic] for patient 9474.
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TAB...
SELECT AVG(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 = 9474)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arter...
Count the number of patients who died on or before 2158 with complete heart block as the primary disease.
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 text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COMPLETE HEART BLOCK" AND demographic.dod_year <= "2158.0"
How many times is the new points 2690?
CREATE TABLE table_24431348_20 (status VARCHAR,new_points VARCHAR)
SELECT COUNT(status) FROM table_24431348_20 WHERE new_points = 2690
Users with most answers in a given tag.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE Users (Id number,Reputation number,Creati...
SELECT a.OwnerUserId AS "user_link", a.OwnerDisplayName, COUNT(a.Id) AS "question_count", SUM(a.Score) AS "total_score" FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE (a.PostTypeId = 2) AND (q.PostTypeId = 1) AND (q.Tags LIKE '%<##tagName?data-explorer##>%') GROUP BY a.OwnerUserId, a.OwnerDisplayName ...
what was the marital status of patient 85169 during their first hospital visit?
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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE cost (row_id number,...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 85169 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
What Status does Freddie Jackson have?
CREATE TABLE table_name_32 (status VARCHAR,artist VARCHAR)
SELECT status FROM table_name_32 WHERE artist = "freddie jackson"
what are the flights available in the morning between BOSTON and DENVER
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections ...
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, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER...
how many patients who had bradycardia had stayed in the hospital for more than 27 days?
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.diagnosis = "BRADYCARDIA" AND demographic.days_stay > "27"
how many more silver medals were handed out than gold ?
CREATE TABLE table_204_413 (id number,"medal" text,"name" text,"sport" text,"event" text,"date" text)
SELECT (SELECT COUNT(*) FROM table_204_413 WHERE "medal" = 'silver') - (SELECT COUNT(*) FROM table_204_413 WHERE "medal" = 'gold')
Return the apartment numbers of the apartments with type code 'Flat'.
CREATE TABLE apartments (apt_id number,building_id number,apt_type_code text,apt_number text,bathroom_count number,bedroom_count number,room_count text)CREATE TABLE apartment_bookings (apt_booking_id number,apt_id number,guest_id number,booking_status_code text,booking_start_date time,booking_end_date time)CREATE TABLE...
SELECT apt_number FROM apartments WHERE apt_type_code = "Flat"
What was the losing bonus for the 20 played, and 353 points?
CREATE TABLE table_name_89 (losing_bonus VARCHAR,played VARCHAR,points_for VARCHAR)
SELECT losing_bonus FROM table_name_89 WHERE played = "20" AND points_for = "353"
What is the 4th largest where the 2nd largest is Minab?
CREATE TABLE table_48111 ("Province" text,"Largest city" text,"2nd Largest" text,"3rd Largest" text,"4th largest" text)
SELECT "4th largest" FROM table_48111 WHERE "2nd Largest" = 'minab'
how many times did a cardiology consultation procedure last year be done?
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 COUNT(*) FROM treatment WHERE treatment.treatmentname = 'cardiology consultation' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
What track was used in 1926?
CREATE TABLE table_49525 ("Year" text,"Designated Grand Prix" text,"Track" text,"250 cc" text,"350 cc" text,"500 cc" text,"Report" text)
SELECT "Track" FROM table_49525 WHERE "Year" = '1926'
A bar chart for what are the number of the names of all races held between 2009 and 2011?
CREATE TABLE driverStandings (driverStandingsId INTEGER,raceId INTEGER,driverId INTEGER,points REAL,position INTEGER,positionText TEXT,wins INTEGER)CREATE TABLE lapTimes (raceId INTEGER,driverId INTEGER,lap INTEGER,position INTEGER,time TEXT,milliseconds INTEGER)CREATE TABLE seasons (year INTEGER,url TEXT)CREATE TABLE ...
SELECT name, COUNT(name) FROM races WHERE year BETWEEN 2009 AND 2011 GROUP BY name
Which Venue has an Against of 25?
CREATE TABLE table_48934 ("Opposing Team" text,"Against" real,"Date" text,"Venue" text,"Status" text)
SELECT "Venue" FROM table_48934 WHERE "Against" = '25'
Who was the high rebounds of team @ Detroit?
CREATE TABLE table_29812 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "High rebounds" FROM table_29812 WHERE "Team" = '@ Detroit'
What year was Incumbent Ed Towns elected with a district smaller than 10?
CREATE TABLE table_5858 ("District" real,"Incumbent" text,"Party" text,"Elected" real,"Status" text)
SELECT AVG("Elected") FROM table_5858 WHERE "Incumbent" = 'ed towns' AND "District" < '10'
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and employee_id , and visualize them by a bar chart.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
What is the number of gold medals for Lithuania (ltu), when the total is more than 1?
CREATE TABLE table_name_57 (gold INTEGER,nation VARCHAR,total VARCHAR)
SELECT MAX(gold) FROM table_name_57 WHERE nation = "lithuania (ltu)" AND total > 1
what is the frequency when the city of license is belleville?
CREATE TABLE table_63262 ("City of license" text,"Identifier" text,"Frequency" text,"Power" text,"Class" text,"RECNet" text)
SELECT "Frequency" FROM table_63262 WHERE "City of license" = 'belleville'
What event did Soa Palelei fight against son hai suk?
CREATE TABLE table_9454 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Event" FROM table_9454 WHERE "Opponent" = 'son hai suk'
Rep:Answer ratio for users with rep between x,y.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownCon...
SELECT Posts.Id, Posts.AnswerCount, Users.Reputation FROM Posts, Users WHERE Users.Id = Posts.Id AND Users.Reputation > '##x##' AND Users.Reputation < '##y##' LIMIT 100
what was the name of the procedure that until 18 months ago patient 005-16601 has received two times?
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 t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
What is the # when u.s. viewers (million) is 17.44?
CREATE TABLE table_25539 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"U.S. viewers (million)" text,"Rank (week)" text,"Original air date" text)
SELECT COUNT("#") FROM table_25539 WHERE "U.S. viewers (million)" = '17.44'
when was the first time patient 028-45936 sao2 was measured greater than 99.0 until 94 days ago.
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,...
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 = '028-45936')) AND vitalperiodic.sao2 > 99.0 AND NOT ...
Which driver had a grid number of 10?
CREATE TABLE table_name_11 (driver VARCHAR,grid VARCHAR)
SELECT driver FROM table_name_11 WHERE grid = 10
name the game site with the highest number of attendance .
CREATE TABLE table_204_443 (id number,"week" number,"date" text,"opponent" text,"result" text,"game site" text,"attendance" number,"bye" text)
SELECT "game site" FROM table_204_443 ORDER BY "attendance" DESC LIMIT 1
On which island is Esperadinha airport located?
CREATE TABLE table_name_53 (island VARCHAR,airportname VARCHAR)
SELECT island FROM table_name_53 WHERE airportname = "esperadinha airport"
look for the number of patients with private health insurance who were admitted before year 2173.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admityear < "2173"
What is the episode name for series number 45?
CREATE TABLE table_29960651_5 (episode VARCHAR,no_for_series VARCHAR)
SELECT episode FROM table_29960651_5 WHERE no_for_series = 45
tell me the amount of d5w patient 15447 was given on the current icu visit.
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 tex...
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15447) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid F...
Show the number of courses each instructor taught in a bar chart, show in asc by the X.
CREATE TABLE STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varchar(15),STU_INIT varchar(1),STU_DOB datetime,STU_HRS int,STU_CLASS varchar(2),STU_GPA float(8),STU_TRANSFER numeric,DEPT_CODE varchar(18),STU_PHONE varchar(4),PROF_NUM int)CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CO...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY EMP_FNAME ORDER BY EMP_FNAME
A scatter chart shows the correlation between address_id and monthly_rental .
CREATE TABLE Teachers (teacher_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(80),last_name VARCHAR(80),gender VARCHAR(1),cell_mobile_number VARCHAR(40),email_address VARCHAR(40),other_details VARCHAR(255))CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR(10),detention_type_descript...
SELECT address_id, monthly_rental FROM Student_Addresses ORDER BY monthly_rental DESC
how many hours have there been since when patient 92788 was first diagnosed with old myocardial infarct on the current hospital encounter?
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 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'old myocardial infarct') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admi...
Name the number of titles written by adam i. lapidus
CREATE TABLE table_12030612_9 (title VARCHAR,written_by VARCHAR)
SELECT COUNT(title) FROM table_12030612_9 WHERE written_by = "Adam I. Lapidus"
What is the A Score when the B Score is more than 9.05, and the total is less than 16.525?
CREATE TABLE table_name_54 (a_score VARCHAR,b_score VARCHAR,total VARCHAR)
SELECT COUNT(a_score) FROM table_name_54 WHERE b_score > 9.05 AND total < 16.525
What tournament located is mississippi was nov 5
CREATE TABLE table_name_83 (tournament VARCHAR,date VARCHAR,location VARCHAR)
SELECT tournament FROM table_name_83 WHERE date = "nov 5" AND location = "mississippi"
among those with age 40s until 2102, what are the top three most frequent lab tests?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunits...
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND STRFTIME('%y', lab.labresulttime) <= '2102' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 3
Which courses besides 218 are available with Prof. Jorge Martinez ?
CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE ta (campus_job_id int,student_id int,locati...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number <> 218 AND instructor.name LIKE '%Jorge Martinez%' AND offering_instructor.instructor_id = instructor.instructor_id AND offerin...
What is the greatest lost where played is less than 9?
CREATE TABLE table_42900 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT MAX("Lost") FROM table_42900 WHERE "Played" < '9'
What was the result in the election where Hale Boggs was the incumbent?
CREATE TABLE table_18508 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Result" FROM table_18508 WHERE "Incumbent" = 'Hale Boggs'
tell me the name of the capital with an area of 20,4.
CREATE TABLE table_57096 ("car plates (since 1937)" text,"Voivodeship Separate city" text,"Capital" text,"Area in 1000km\u00b2 (1930)" text,"Population in 1000 (1931)" text)
SELECT "Capital" FROM table_57096 WHERE "Area in 1000km\u00b2 (1930)" = '20,4'
What year had a score of 4 6, 7 6, 7 5?
CREATE TABLE table_64681 ("Outcome" text,"Year" text,"Tournament" text,"Surface" text,"Opponent in the final" text,"Score" text)
SELECT "Year" FROM table_64681 WHERE "Score" = '4–6, 7–6, 7–5'
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date, and count them by a bar chart, order by the Y-axis in asc.
CREATE TABLE Payments (Payment_ID INTEGER,Settlement_ID INTEGER,Payment_Method_Code VARCHAR(255),Date_Payment_Made DATE,Amount_Payment INTEGER)CREATE TABLE Customer_Policies (Policy_ID INTEGER,Customer_ID INTEGER,Policy_Type_Code CHAR(15),Start_Date DATE,End_Date DATE)CREATE TABLE Customers (Customer_ID INTEGER,Custome...
SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims) ORDER BY COUNT(Date_Claim_Made)
What is the score of the match on June 4, 2008?
CREATE TABLE table_37248 ("Goal" real,"Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Score" FROM table_37248 WHERE "Date" = 'june 4, 2008'
What was the Week on September 5, 1993?
CREATE TABLE table_name_37 (week VARCHAR,date VARCHAR)
SELECT week FROM table_name_37 WHERE date = "september 5, 1993"
What was the lowest lab for Gilera with a grid less than 12?
CREATE TABLE table_name_81 (laps INTEGER,manufacturer VARCHAR,grid VARCHAR)
SELECT MIN(laps) FROM table_name_81 WHERE manufacturer = "gilera" AND grid < 12
What is the city with the most customers?
CREATE TABLE staff (staff_id number,staff_address_id number,nickname text,first_name text,middle_name text,last_name text,date_of_birth time,date_joined_staff time,date_left_staff time)CREATE TABLE lessons (lesson_id number,customer_id number,lesson_status_code text,staff_id number,vehicle_id number,lesson_date time,le...
SELECT T2.city FROM customers AS T1 JOIN addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC LIMIT 1
For those records from the products and each product's manufacturer, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart, display x axis in asc order please.
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 T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name
which station name has the same amount of population served as lincoln university ?
CREATE TABLE table_204_863 (id number,"state" text,"city/county" text,"population served" number,"charter type" text,"station name" text,"web site" text)
SELECT "station name" FROM table_204_863 WHERE "station name" <> 'lincoln university' AND "population served" = (SELECT "population served" FROM table_204_863 WHERE "station name" = 'lincoln university')
What visiting team played at the home of the Chicago Black Hawks with a record of 1-1?
CREATE TABLE table_62183 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Visitor" FROM table_62183 WHERE "Home" = 'chicago black hawks' AND "Record" = '1-1'
Show me a line chart of how the number of creation change over the creation
CREATE TABLE management (department_ID int,head_ID int,temporary_acting text)CREATE TABLE head (head_ID int,name text,born_state text,age real)CREATE TABLE department (Department_ID int,Name text,Creation text,Ranking int,Budget_in_Billions real,Num_Employees real)
SELECT Creation, COUNT(Creation) FROM department
What was the score from the game where Dallas played Home and Edmonton was visiting?
CREATE TABLE table_51695 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Score" FROM table_51695 WHERE "Home" = 'dallas' AND "Visitor" = 'edmonton'
how many drivers raced in the preliminary round ?
CREATE TABLE table_203_780 (id number,"rank" number,"diver" text,"preliminary\npoints" number,"preliminary\nrank" number,"final\npoints" number,"final\nrank" number,"final\ntotal" number)
SELECT COUNT("diver") FROM table_203_780 WHERE NOT "preliminary\npoints" IS NULL
During next semester , what classes will Dr. Jonathan Bulkley be teaching ?
CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Jonathan Bulkley%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor....
Whose talent was ballet en pointe?
CREATE TABLE table_name_56 (name VARCHAR,talent VARCHAR)
SELECT name FROM table_name_56 WHERE talent = "ballet en pointe"
What is the proportion of the minimum price of the rooms for each different decor? Show me a pie chart!
CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)
SELECT decor, MIN(basePrice) FROM Rooms GROUP BY decor
how many patients have a married marital status and were diagnosed with surgical operation with implant of artificial internal device causing abnormal patient reaction, or later complication,without mention of misadventure at time of operation?
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Surgical operation with implant of artificial internal device causing abnormal patient reaction, or later complication,w...
i would like to fly from PITTSBURGH to SAN FRANCISCO
CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int...
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, flight 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.city_name = 'SAN...
What is the 1991 when 1992 and 1990 are 1R?
CREATE TABLE table_name_69 (Id VARCHAR)
SELECT 1991 FROM table_name_69 WHERE 1992 = "1r" AND 1990 = "1r"
what is maximum age of patients whose insurance is government and admission year is greater than or equal to 2177?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Government" AND demographic.admityear >= "2177"