instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
what is the average for 2005 when 1995 is more than 3, 1996 is less than 4, and 2011 is more than 5? | CREATE TABLE table_67535 ("Country" text,"2012" real,"2011" real,"2010" real,"2009" real,"2008" real,"2007" real,"2006" real,"2005" real,"2004" real,"2003" real,"2002" real,"2001" real,"2000" real,"1999" real,"1998" real,"1997" real,"1996" real,"1995" real,"1994" real,"1993" real,"1992" real,"1991" real,"1990" real,"19... | SELECT AVG("2005") FROM table_67535 WHERE "1995" > '3' AND "1996" < '4' AND "2011" > '5' |
Find the average age of all students living in the each city. | CREATE TABLE student (city_code VARCHAR,age INTEGER) | SELECT AVG(age), city_code FROM student GROUP BY city_code |
Which circuit did Jim Clark win in 1962? | CREATE TABLE table_48461 ("Year" text,"Date" text,"Circuit" text,"Winning driver" text,"Winning constructor" text,"Report" text) | SELECT "Circuit" FROM table_48461 WHERE "Winning driver" = 'jim clark' AND "Year" = '1962' |
What is the episode number of the episode that originally aired on February 4, 2008? | CREATE TABLE table_58230 ("Production no." real,"Episode no." real,"Original Airdate" text,"Episode Title" text,"Host" text) | SELECT "Episode no." FROM table_58230 WHERE "Original Airdate" = 'february 4, 2008' |
How many apartment bookings for each weekday? Draw a bar chart binning booking start date by weekday interval, I want to list by the total number from low to high. | CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Apartment_Bookings (apt_booking_id INTEGER,apt_id INTEGER,guest_id ... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id ORDER BY COUNT(booking_start_date) |
What Week 5 has a Week 1 of mysti sherwood? | CREATE TABLE table_12981 ("Week 1" text,"Week 2" text,"Week 3" text,"Week 4" text,"Week 5" text) | SELECT "Week 5" FROM table_12981 WHERE "Week 1" = 'mysti sherwood' |
tell me the name of the output patient 24029 had first on 05/15/last year? | 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 labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE prescriptions (row_id numbe... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24029)) AND DATETIME(outputevents.charttim... |
during the last year, what are the top five most frequent lab tests ordered for patients within 2 months after the diagnosis of hypophosphatemia? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE lab (labid number,patientunitstayid num... | SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypophosphatemia' AND DATETIME(diagnosis.diagnosisti... |
What was the score in the game where the record was 10-9-7? | CREATE TABLE table_name_94 (score VARCHAR,record VARCHAR) | SELECT score FROM table_name_94 WHERE record = "10-9-7" |
Which Draws has a Wins of 10, and a Peel of south mandurah, and a Byes larger than 0? | CREATE TABLE table_name_28 (draws INTEGER,byes VARCHAR,wins VARCHAR,peel VARCHAR) | SELECT AVG(draws) FROM table_name_28 WHERE wins = 10 AND peel = "south mandurah" AND byes > 0 |
For all employees who have the letters D or S in their first name, visualize a line chart about the change of salary over hire_date , could you sort HIRE_DATE from high to low order? | 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),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGIO... | SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC |
A bar chart about what are the destinations and number of flights to each one?, display by the X-axis in ascending please. | CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),departure_date date,arrival_date date,price number(7,2),aid number(9,0))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TABLE employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TA... | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY destination |
What country was Danissa Zurek from? | CREATE TABLE table_25461827_2 (country VARCHAR,contestant VARCHAR) | SELECT country FROM table_25461827_2 WHERE contestant = "Danissa Zurek" |
Return a pie chart about the proportion of All_Games and ACC_Percent. | 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_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT All_Games, ACC_Percent FROM basketball_match |
What is the smallest amount of points had a lost number of 2 when the position was less than 1? | CREATE TABLE table_42833 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text) | SELECT MIN("Points") FROM table_42833 WHERE "Lost" = '2' AND "Position" < '1' |
what is the average hospital cost that involves a anticonvulsants - valproate in the previous year? | 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 patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid... | SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'anticonvulsants - valproate')) AND DATETIME(... |
how many patients whose ethnicity is hispanic or latino and age is less than 48? | 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 WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.age < "48" |
when patient 011-53628 had a systemicsystolic measured for the first time since 03/14/2105? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,obs... | 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 = '011-53628')) AND NOT vitalperiodic.systemicsystolic... |
was sao2 from patient 22897 less than 98.0 until 21 months ago? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 patients (row_id number,subject_id number,gender text,dob time,dod time)CR... | SELECT COUNT(*) > 0 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 = 22897)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items... |
What was the GDP for 2002-2005 for the construction center? | CREATE TABLE table_25282151_1 (supply_sector___percentage_of_gdp_in_current_prices_ VARCHAR) | SELECT 2002 AS _2005 FROM table_25282151_1 WHERE supply_sector___percentage_of_gdp_in_current_prices_ = "Construction" |
March 0.41 in July? | CREATE TABLE table_1382 ("Year" real,"January" text,"February" text,"March" text,"April" text,"May" text,"June" text,"July" text,"August" text,"September" text,"October" text,"November" text,"December" text,"Annual Additions(in millions)" text,"Average Monthly Additions(in millions)" text) | SELECT "July" FROM table_1382 WHERE "March" = '0.41' |
How many next in lines had heirs of Archduke Karl? | CREATE TABLE table_30429 ("Emperor" text,"Heir" text,"Relationship to emperor and status" text,"Became heir" text,"Ceased to be heir" text,"Next in line" text) | SELECT COUNT("Next in line") FROM table_30429 WHERE "Heir" = 'Archduke Karl' |
Which country had a total of 295? | CREATE TABLE table_name_46 (country VARCHAR,total VARCHAR) | SELECT country FROM table_name_46 WHERE total = 295 |
Where were jamie cox & scott kremerskothen paired? | CREATE TABLE table_48312 ("Wicket" text,"Runs" text,"Batsmen" text,"Opponent" text,"Venue" text,"Season" text) | SELECT "Venue" FROM table_48312 WHERE "Batsmen" = 'jamie cox & scott kremerskothen' |
Who had the highest assists in game 75? | CREATE TABLE table_29864 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High assists" FROM table_29864 WHERE "Game" = '75' |
how many patients with hypertension as the diagnosis short title had the drug route po/ng? | 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 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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hypertension NOS" AND prescriptions.route = "PO/NG" |
give me all the flights from NEW YORK to MIAMI round trip | CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE compartment_class (compartment v... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_id = ... |
what are the newly prescribed drugs for patient 99883 today compared to that yesterday? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 d_labitems (row_id number,itemid number,labe... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE... |
What is the sum of people per km2 for the sandoy region with an area of 112.1? | CREATE TABLE table_name_41 (people_per_km² INTEGER,regions VARCHAR,area VARCHAR) | SELECT SUM(people_per_km²) FROM table_name_41 WHERE regions = "sandoy" AND area = 112.1 |
What is the position of the player who is taller than 2.12? | CREATE TABLE table_name_30 (position VARCHAR,height INTEGER) | SELECT position FROM table_name_30 WHERE height > 2.12 |
Question stats for a week. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostFeedback (Id num... | SELECT COUNT(CASE WHEN Score < 0 THEN 1 ELSE 0 END) FROM Posts WHERE CreationDate BETWEEN @start AND @end |
What is te name of the constructors dated 26 march? | CREATE TABLE table_16759 ("Race Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Constructor" text,"Report" text) | SELECT "Constructor" FROM table_16759 WHERE "Date" = '26 March' |
For those payments processed with Visa, bin the payment day into Year interval and compute the average amount payment as the Y-axis, sort y axis from high to low order. | CREATE TABLE Customers (Customer_ID INTEGER,Customer_Details VARCHAR(255))CREATE TABLE Customer_Policies (Policy_ID INTEGER,Customer_ID INTEGER,Policy_Type_Code CHAR(15),Start_Date DATE,End_Date DATE)CREATE TABLE Claims (Claim_ID INTEGER,Policy_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTE... | SELECT Date_Payment_Made, AVG(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY AVG(Amount_Payment) DESC |
For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the sum of code , and group by attribute headquarter in a bar chart, could you rank y-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 T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code |
A bar chart shows the distribution of Sex and the sum of Weight , and group by attribute Sex, could you list X-axis from low to high order? | 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)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real) | SELECT Sex, SUM(Weight) FROM people GROUP BY Sex ORDER BY Sex |
Who's the opponent when Diegomar Markwell is the loss? | CREATE TABLE table_37119 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Save" text) | SELECT "Opponent" FROM table_37119 WHERE "Loss" = 'diegomar markwell' |
how many patients have had a antiemetic - serotonin antagonist procedure within 2 months after having received a therapeutic antibacterials - penicillins procedure until 4 years ago? | 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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'therapeutic antibacterials - penicillins' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), ... |
Visualize a bar chart about the distribution of date_address_from and the sum of monthly_rental , and group by attribute other_details and bin date_address_from by time. | CREATE TABLE Ref_Address_Types (address_type_code VARCHAR(15),address_type_description VARCHAR(80))CREATE TABLE Assessment_Notes (notes_id INTEGER,student_id INTEGER,teacher_id INTEGER,date_of_notes DATETIME,text_of_notes VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Behavior_Incident (incident_id INTEGER,incide... | SELECT date_address_from, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC |
Which colleges does each player with a name that starts with the letter D who tried out go to? | CREATE TABLE player (pid number,pname text,ycard text,hs number)CREATE TABLE tryout (pid number,cname text,ppos text,decision text)CREATE TABLE college (cname text,state text,enr number) | SELECT T1.cname FROM tryout AS T1 JOIN player AS T2 ON T1.pid = T2.pid WHERE T2.pname LIKE 'D%' |
How many picks on average did Jay Bruchak have before round 6? | CREATE TABLE table_65728 ("Round" real,"Pick" real,"Player" text,"Nationality" text,"College" text) | SELECT AVG("Pick") FROM table_65728 WHERE "Player" = 'jay bruchak' AND "Round" < '6' |
What U.S. Rap has life in the concrete jungle as the album? | CREATE TABLE table_63575 ("Year" real,"U.S. Hot 100" text,"U.S. R&B" text,"U.S. Rap" text,"Album" text) | SELECT "U.S. Rap" FROM table_63575 WHERE "Album" = 'life in the concrete jungle' |
which is the minimun amount of gold medals? | CREATE TABLE table_24950 ("Rank" real,"Athlete" text,"Nation" text,"Olympics" text,"Gold" real,"Silver" real,"Bronze" real,"Total(min. 2 medals)" real) | SELECT MIN("Gold") FROM table_24950 |
Answers to Duplicate Questions by User. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,... | SELECT 'post_link' = p.Id, a.Score, Answer = CASE WHEN p.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END FROM Posts AS p INNER JOIN Posts AS a ON a.ParentId = p.Id WHERE EXISTS(SELECT 1 FROM PostLinks AS pl WHERE pl.PostId = p.Id AND pl.LinkTypeId = 3) |
Who was the opponent when the record was 11-6-2? | CREATE TABLE table_name_25 (opponent VARCHAR,record VARCHAR) | SELECT opponent FROM table_name_25 WHERE record = "11-6-2" |
count the number of patients whose year of death is less than or equal to 2126? | 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 WHERE demographic.dod_year <= "2126.0" |
what is the number of patients whose admission location is trsf within this facility and primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis? | 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.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS" |
What is the rank of Etihad Tower 5, with less than 62 floors? | CREATE TABLE table_36691 ("Rank" real,"Name" text,"Height* m (ft)" text,"Floors" real,"Year* (est.)" text,"City" text) | SELECT MIN("Rank") FROM table_36691 WHERE "Floors" < '62' AND "Name" = 'etihad tower 5' |
What is the series sorted value for the episode released December 2009? | CREATE TABLE table_47745 ("Series Sorted" text,"Title" text,"Doctor" text,"Featuring" text,"Released" text) | SELECT "Series Sorted" FROM table_47745 WHERE "Released" = 'december 2009' |
What was the score of the 1999 fifa world cup qualification (uefa) on Nov 23, 1997? | CREATE TABLE table_58275 ("Competition" text,"Stage" text,"Venue" text,"Date" text,"Result" text) | SELECT "Result" FROM table_58275 WHERE "Competition" = '1999 fifa world cup qualification (uefa)' AND "Date" = 'nov 23, 1997' |
Which player played in 2007? | CREATE TABLE table_name_17 (player VARCHAR,season VARCHAR) | SELECT player FROM table_name_17 WHERE season = "2007" |
What was the maximum vertical measurement if the horizon measurement is 640? | CREATE TABLE table_272313_1 (vertical INTEGER,horizontal VARCHAR) | SELECT MAX(vertical) FROM table_272313_1 WHERE horizontal = 640 |
is the albumin of patient 010-5308 measured at 2105-01-30 13:41:00 that was less than measured at 2105-01-24 11:08:00? | 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 (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-5308')) AND lab.labname = 'albumin' AND lab.labresulttime = '2105-01-30 13:... |
What is the time for Cuba, with a notes entry of QS? | CREATE TABLE table_name_54 (time VARCHAR,notes VARCHAR,country VARCHAR) | SELECT time FROM table_name_54 WHERE notes = "qs" AND country = "cuba" |
What is the rank of player Jason Dunstall? | CREATE TABLE table_name_55 (rank VARCHAR,player VARCHAR) | SELECT rank FROM table_name_55 WHERE player = "jason dunstall" |
male aged from 18 to 85 and postmenopausal female aged up to 85 years, | CREATE TABLE table_test_3 ("id" int,"gender" string,"pregnancy_or_lactation" bool,"severe_hemodynamic_instability" bool,"consent" bool,"hemoglobin_a1c_hba1c" float,"metallic_implants" bool,"allergy_to_aspirin" bool,"creatinine_clearance_cl" float,"post_menopausal" bool,"clinical_evidence_of_active_bleeding" bool,"cardi... | SELECT * FROM table_test_3 WHERE (gender = 'male' AND (age >= 18 AND age <= 85)) OR (gender = 'female' AND post_menopausal = 1 AND age <= 85) |
Which Age (as of 1 February 2014) has a Rank smaller than 9, and a Death date of 24 january 2007? | CREATE TABLE table_name_3 (age__as_of_1_february_2014_ VARCHAR,rank VARCHAR,death_date VARCHAR) | SELECT age__as_of_1_february_2014_ FROM table_name_3 WHERE rank < 9 AND death_date = "24 january 2007" |
was patient 52604 given any sort of diagnosis during their first 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 chartevents (row_id number,subject_id number,hadm_id number,ic... | SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52604 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) |
For earnings greater than 4,689,368, what is the greatest rank? | CREATE TABLE table_10152 ("Rank" real,"Player" text,"Country" text,"Earnings($)" real,"Wins" real) | SELECT MAX("Rank") FROM table_10152 WHERE "Earnings( $ )" > '4,689,368' |
What is the nationality of the swimmer with a rank over 2 with a time of 55.77? | CREATE TABLE table_name_47 (nationality VARCHAR,rank VARCHAR,time VARCHAR) | SELECT nationality FROM table_name_47 WHERE rank > 2 AND time = "55.77" |
what is the result for October 14, 1956? | CREATE TABLE table_14984039_1 (result VARCHAR,date VARCHAR) | SELECT result FROM table_14984039_1 WHERE date = "October 14, 1956" |
What Label released an album in August 1996? | CREATE TABLE table_77117 ("Title" text,"Release Date" text,"Format" text,"Release" text,"Label" text,"Code" text) | SELECT "Label" FROM table_77117 WHERE "Release Date" = 'august 1996' |
how many patients whose days of hospital stay is greater than 3 and 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 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,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "3" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
Bar chart of minimal salary from each dept name | CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),grade varchar(2))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE classroom (building... | SELECT dept_name, MIN(salary) FROM instructor GROUP BY dept_name |
now i need a one way flight from PITTSBURGH to DENVER | CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE state (state_code text,state_name text,country_na... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = ... |
A bar chart for what are the number of the descriptions of the service types with product price above 100?, and order by the X-axis in ascending. | CREATE TABLE Bookings (Booking_ID INTEGER,Customer_ID INTEGER,Workshop_Group_ID VARCHAR(100),Status_Code CHAR(15),Store_ID INTEGER,Order_Date DATETIME,Planned_Delivery_Date DATETIME,Actual_Delivery_Date DATETIME,Other_Order_Details VARCHAR(255))CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID INTEGER,Address_ID IN... | SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY Service_Type_Description |
severe kidney disease ( renal creatinine clearance < 30 ml / min ) | CREATE TABLE table_test_12 ("id" int,"serum_potassium" float,"left_ventricular_ejection_fraction_lvef" int,"systolic_blood_pressure_sbp" int,"haemoglobin" float,"consent" bool,"hemoglobin_a1c_hba1c" float,"heart_disease" bool,"renal_disease" bool,"anaemia" bool,"creatinine_clearance_cl" float,"estimated_glomerular_filt... | SELECT * FROM table_test_12 WHERE kidney_disease = 1 OR creatinine_clearance_cl < 30 |
What away team had a score of 7.9 (51)? | CREATE TABLE table_51202 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Date" text) | SELECT "Away team" FROM table_51202 WHERE "Away team score" = '7.9 (51)' |
What is the total attendance on April 25? | CREATE TABLE table_46725 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Series" text) | SELECT COUNT("Attendance") FROM table_46725 WHERE "Date" = 'april 25' |
accept answer under question with accepted answer. | CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number... | SELECT c.Id, c.Id AS "comment_link", c.CreationDate FROM Comments AS c INNER JOIN Posts AS q ON q.Id = c.PostId AND q.PostTypeId = 1 AND LENGTH(c.Text) <= 75 AND LOWER(c.Text) LIKE '%forget%accept%' ORDER BY c.CreationDate DESC |
The theme Auditioner's Choice has what song choice? | CREATE TABLE table_26250199_1 (song_choice VARCHAR,theme VARCHAR) | SELECT song_choice FROM table_26250199_1 WHERE theme = "Auditioner's Choice" |
Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia. | CREATE TABLE branch (name VARCHAR,branch_id VARCHAR)CREATE TABLE membership_register_branch (branch_id VARCHAR,member_id VARCHAR)CREATE TABLE member (member_id VARCHAR,Hometown VARCHAR) | SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member ... |
Where is the location with a record of 50-19? | CREATE TABLE table_name_34 (location VARCHAR,record VARCHAR) | SELECT location FROM table_name_34 WHERE record = "50-19" |
Who were the candidates in the district where the incumbent was Nathaniel Macon? | CREATE TABLE table_2668367_14 (candidates VARCHAR,incumbent VARCHAR) | SELECT candidates FROM table_2668367_14 WHERE incumbent = "Nathaniel Macon" |
How many institutions are there? | CREATE TABLE inst (Id VARCHAR) | SELECT COUNT(*) FROM inst |
how many times did patient 59049 have the platelet count tested since 2105? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE patients (row_id number,subject_id number,gender te... | SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'platelet count') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 59049) AND STRFTIME('%y', labevents.charttime) >= '2105' |
What is Opponent, when Result is Win, and when Date is Aug 7? | CREATE TABLE table_name_67 (opponent VARCHAR,result VARCHAR,date VARCHAR) | SELECT opponent FROM table_name_67 WHERE result = "win" AND date = "aug 7" |
Hom many albums does the artist 'Metallica' have? | CREATE TABLE ALBUM (ArtistId VARCHAR)CREATE TABLE ARTIST (ArtistId VARCHAR,Name VARCHAR) | SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica" |
Name the number of advocate #1 that aired on april 2, 2008 | CREATE TABLE table_20296 ("#" real,"Advocate # 1" text,"Advocate # 2" text,"Root of All Evil" text,"Poll winner" text,"Original air date" text) | SELECT COUNT("Advocate # 1") FROM table_20296 WHERE "Original air date" = 'April 2, 2008' |
What is the total reputation of site X?. | CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId ... | SELECT SUM(Reputation) AS totalRep FROM Users WHERE ((@excludes = 'y' AND Reputation > 200) OR (@excludes != 'y')) |
How old was the conservative party member that left the house in 2001? | CREATE TABLE table_name_43 (age_on_leaving VARCHAR,political_party VARCHAR,left_house VARCHAR) | SELECT age_on_leaving FROM table_name_43 WHERE political_party = "conservative" AND left_house = "2001" |
What date did the episode with Andy Murray as Jamie and John's guest first broadcast? | CREATE TABLE table_29141354_4 (first_broadcast VARCHAR,jamie_and_johns_guest VARCHAR) | SELECT first_broadcast FROM table_29141354_4 WHERE jamie_and_johns_guest = "Andy Murray" |
Name the result for goal # more than 4 | CREATE TABLE table_name_92 (result VARCHAR,goal__number INTEGER) | SELECT result FROM table_name_92 WHERE goal__number > 4 |
What is the size of the rest bit field when the leading bits are more than 110 and the start address is 224.0.0.0? | CREATE TABLE table_name_12 (size_of_rest_bit_field VARCHAR,leading_bits VARCHAR,start_address VARCHAR) | SELECT size_of_rest_bit_field FROM table_name_12 WHERE leading_bits > 110 AND start_address = "224.0.0.0" |
In What Week was the Attendance 75,866? | CREATE TABLE table_name_59 (week VARCHAR,attendance VARCHAR) | SELECT week FROM table_name_59 WHERE attendance = "75,866" |
What is the average crowd size when the home team is North Melbourne? | CREATE TABLE table_name_36 (crowd INTEGER,home_team VARCHAR) | SELECT AVG(crowd) FROM table_name_36 WHERE home_team = "north melbourne" |
How many aircrafts do we have? | CREATE TABLE aircraft (aid number,name text,distance number)CREATE TABLE flight (flno number,origin text,destination text,distance number,departure_date time,arrival_date time,price number,aid number)CREATE TABLE employee (eid number,name text,salary number)CREATE TABLE certificate (eid number,aid number) | SELECT COUNT(*) FROM aircraft |
has patient 006-171217 had any allergies in the last year? | 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 COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-171217')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(CURR... |
What was the TO par for the player who scored 70-68-74-70=282? | CREATE TABLE table_name_26 (to_par VARCHAR,score VARCHAR) | SELECT to_par FROM table_name_26 WHERE score = 70 - 68 - 74 - 70 = 282 |
let me know the lab test item id of patient stephanie suchan. | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT lab.itemid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Stephanie Suchan" |
What is the largest attendance at Memorial Stadium on December 12, 1965? | CREATE TABLE table_name_51 (attendance INTEGER,game_site VARCHAR,date VARCHAR) | SELECT MAX(attendance) FROM table_name_51 WHERE game_site = "memorial stadium" AND date = "december 12, 1965" |
What is the release date for the Chinese title ? | CREATE TABLE table_name_46 (released_date VARCHAR,chinese_title VARCHAR) | SELECT released_date FROM table_name_46 WHERE chinese_title = "摸摸瓦力欧制造" |
Give a me a bar graph to show the friends's name, and ages of all people who are older than the average age of a person, show by the X-axis in desc please. | CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT) | SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person) ORDER BY T1.name DESC |
Find the number of students who is older than 20 in each dorm. Plot them as bar chart. | CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTE... | SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name |
Who was the away team when Footscray scored 11.14 (80)? | CREATE TABLE table_58326 ("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_58326 WHERE "Home team score" = '11.14 (80)' |
Find the number of scientists involved for each project name. | CREATE TABLE AssignedTo (Scientist int,Project char(4))CREATE TABLE Projects (Code Char(4),Name Char(50),Hours int)CREATE TABLE Scientists (SSN int,Name Char(30)) | SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T1.Name |
only player to serve as captain from 1998-2007 | CREATE TABLE table_204_342 (id number,"#" number,"player" text,"span" text,"caps" number,"total caps" number,"win %" text) | SELECT "player" FROM table_204_342 WHERE "span" = '1998-2007' |
what is patient 1114's gender? | 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 labevents (row_id number,subject_id number,hadm_id numb... | SELECT patients.gender FROM patients WHERE patients.subject_id = 1114 |
What is the highest round of the player with an overall of 152? | CREATE TABLE table_name_38 (round INTEGER,overall VARCHAR) | SELECT MAX(round) FROM table_name_38 WHERE overall = 152 |
Find the number of amenities for each of the dorms that can accommodate more than 100 students. | CREATE TABLE has_amenity (dormid VARCHAR)CREATE TABLE dorm (dormid VARCHAR,student_capacity INTEGER) | SELECT COUNT(*), T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid |
how much of a change is patient 19161's weight change second measured on the first hospital visit compared to the value first measured on the first hospital visit? | CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,sp... | 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 = 19161 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.