instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
count the number of patients who had had a open incis hern-grft nec procedure done two or more times since 2104. | 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 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... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'open incis hern-grft ... |
Group and count the years played to draw a bar chart, sort how many years played from low to high order please. | CREATE TABLE country (Country_id int,Country_name text,Capital text,Official_native_language text)CREATE TABLE team (Team_id int,Name text)CREATE TABLE match_season (Season real,Player text,Position text,Country int,Team int,Draft_Pick_Number int,Draft_Class text,College text)CREATE TABLE player (Player_ID int,Player t... | SELECT Years_Played, COUNT(Years_Played) FROM player GROUP BY Years_Played ORDER BY COUNT(Years_Played) |
number of gold medals earned by kazakhstan , uzbekistan , and thailand | CREATE TABLE table_204_383 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT SUM("gold") FROM table_204_383 WHERE "nation" IN ('kazakhstan', 'uzbekistan', 'thailand') |
which lyricist has the largest amount of tracks ? | CREATE TABLE table_203_574 (id number,"track number" number,"russian title" text,"english title" text,"music" text,"lyrics" text) | SELECT "lyrics" FROM table_203_574 GROUP BY "lyrics" ORDER BY COUNT("track number") DESC LIMIT 1 |
A bar chart for finding the number of the physicians who are trained in a procedure that costs more than 5000. | CREATE TABLE Trained_In (Physician INTEGER,Treatment INTEGER,CertificationDate DATETIME,CertificationExpires DATETIME)CREATE TABLE Appointment (AppointmentID INTEGER,Patient INTEGER,PrepNurse INTEGER,Physician INTEGER,Start DATETIME,End DATETIME,ExaminationRoom TEXT)CREATE TABLE Block (BlockFloor INTEGER,BlockCode INTE... | SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name |
what airlines are AC and AS | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CR... | SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AC' OR airline_code = 'AS' |
What is Party, when Left Office is '23 April 2005', when Portfolio is 'Minister of Reforms and Devolutions'? | CREATE TABLE table_name_17 (party VARCHAR,left_office VARCHAR,portfolio VARCHAR) | SELECT party FROM table_name_17 WHERE left_office = "23 april 2005" AND portfolio = "minister of reforms and devolutions" |
what was the first drug being prescribed for patient 26262 during the last hospital visit? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26262 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY prescriptions.startdate LIMIT 1 |
What is the To Par score for the player with an overall score of 71-68-69=208? | CREATE TABLE table_61277 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "To par" FROM table_61277 WHERE "Score" = '71-68-69=208' |
Show different types of ships and the average tonnage of ships of each type Show bar chart, and show from low to high by the bar. | CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text) | SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type ORDER BY Type |
what is the difference in attendees for maryland on february 10 , 1979 to february 11 , 1978 ? | CREATE TABLE table_204_807 (id number,"date" text,"winner" text,"runner-up" text,"result" text,"site" text,"attendance" number) | SELECT ABS((SELECT "attendance" FROM table_204_807 WHERE "date" = 'february 10, 1979') - (SELECT "attendance" FROM table_204_807 WHERE "date" = 'february 11, 1978')) |
Show the invoice number and the number of transactions for each invoice. | CREATE TABLE Financial_transactions (invoice_number VARCHAR) | SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number |
Which opponent had a time of 0:29? | CREATE TABLE table_71725 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text) | SELECT "Opponent" FROM table_71725 WHERE "Time" = '0:29' |
count the number of patients whose lab test name is uptake ratio? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Uptake Ratio" |
How many students are from each city, and which cities have more than one cities. Plot them as bar chart. | 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_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Lives_in (stuid INTEGER,dormid INT... | SELECT city_code, COUNT(*) FROM Student GROUP BY city_code |
Which School/Club Team has a Player of deandre liggins? | CREATE TABLE table_name_34 (school_club_team VARCHAR,player VARCHAR) | SELECT school_club_team FROM table_name_34 WHERE player = "deandre liggins" |
how many events were at the 1980 winter olympics ? | CREATE TABLE table_203_541 (id number,"games" text,"host city" text,"dates" text,"nations" number,"participants" number,"events" number) | SELECT "events" FROM table_203_541 WHERE "games" = '1980 winter olympics' |
What's Dell Curry nationality? | CREATE TABLE table_15870 ("Player" text,"No." real,"Nationality" text,"Position" text,"Years in Toronto" text,"School/Club Team" text) | SELECT "Nationality" FROM table_15870 WHERE "Player" = 'Dell Curry' |
Name the 2012 for 2009 of a and 2010 of a and 2011 of a | CREATE TABLE table_6660 ("Tournament" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2012" FROM table_6660 WHERE "2009" = 'a' AND "2010" = 'a' AND "2011" = 'a' |
Tell me the WL doubles with a debut of 1999 | CREATE TABLE table_name_73 (w_l__doubles_ VARCHAR,debut VARCHAR) | SELECT w_l__doubles_ FROM table_name_73 WHERE debut = 1999 |
Which month had a sort value under 39 and 2 deaths? | CREATE TABLE table_name_73 (month VARCHAR,sort_restore VARCHAR,deaths VARCHAR) | SELECT month FROM table_name_73 WHERE sort_restore < 39 AND deaths = "2" |
how many more people live in clear creek township than columbia township in ellsworth county , kansas ? | CREATE TABLE table_203_729 (id number,"township" text,"fips" number,"population\ncenter" text,"population" number,"population\ndensity\n/km2 (/sq mi)" text,"land area\nkm2 (sq mi)" text,"water area\nkm2 (sq mi)" text,"water %" text,"geographic coordinates" text) | SELECT (SELECT "population" FROM table_203_729 WHERE "township" = 'clear creek') - (SELECT "population" FROM table_203_729 WHERE "township" = 'columbia') |
what were the five most common diagnoses for patients who had been previously diagnosed with splenic trauma within 2 months, since 2 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 t3.diagnosisname FROM (SELECT t2.diagnosisname, 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 = 'splenic trauma' AND DATETIME(diagnosis.d... |
What is the lowest Prize amount for the Irish Derby Race? | CREATE TABLE table_54145 ("Race" text,"Dist (f)" real,"Course" text,"Class" text,"Prize (\u00a3K)" real,"Odds" text,"Runners" real,"Placing" real,"Margin" text,"Time" text,"Jockey" text,"Trainer" text) | SELECT MIN("Prize (\u00a3K)") FROM table_54145 WHERE "Race" = 'irish derby' |
What was the total number of weeks with a date of bye? | CREATE TABLE table_name_14 (week VARCHAR,date VARCHAR) | SELECT COUNT(week) FROM table_name_14 WHERE date = "bye" |
How many faculty members do we have for each gender? Draw a bar chart, could you order in desc by the Sex? | 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 Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Pa... | SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex ORDER BY Sex DESC |
Who was appointed with the title of envoy extraordinary and minister plenipotentiary, and a termination of mission of march 16, 1905? | CREATE TABLE table_71304 ("Representative" text,"Title" text,"Presentation of Credentials" text,"Termination of Mission" text,"Appointed by" text) | SELECT "Appointed by" FROM table_71304 WHERE "Title" = 'envoy extraordinary and minister plenipotentiary' AND "Termination of Mission" = 'march 16, 1905' |
What's the county of Eastern Pekin school with fewer than 774 enrolled? | CREATE TABLE table_name_54 (_number___county VARCHAR,enrollment VARCHAR,school VARCHAR) | SELECT _number___county FROM table_name_54 WHERE enrollment < 774 AND school = "eastern pekin" |
Who scored 57 points? | CREATE TABLE table_7644 ("Draw" real,"Song" text,"Performer" text,"Points" real,"Rank" text) | SELECT "Performer" FROM table_7644 WHERE "Points" = '57' |
Show the census ranking of cities whose status are not 'Village'. | CREATE TABLE city (Census_Ranking VARCHAR,Status VARCHAR) | SELECT Census_Ranking FROM city WHERE Status <> "Village" |
among patients treated with drug meto10i, how many of them were aged below 89? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "89" AND prescriptions.formulary_drug_cd = "METO10I" |
How many yards did Davin Meggett have with more than 9 Rec.? | CREATE TABLE table_name_62 (yards INTEGER,player VARCHAR,rec VARCHAR) | SELECT SUM(yards) FROM table_name_62 WHERE player = "davin meggett" AND rec > 9 |
Where is the Stadium of Gortakeegan located? | CREATE TABLE table_name_91 (location VARCHAR,stadium VARCHAR) | SELECT location FROM table_name_91 WHERE stadium = "gortakeegan" |
What was the 2008 result associated with a 2009 of A and a 2011 of 2R? | CREATE TABLE table_name_36 (Id VARCHAR) | SELECT 2008 FROM table_name_36 WHERE 2009 = "a" AND 2011 = "2r" |
What is the lowest number of sheep and goats after 1931, with fewer than 2518 cows and more than 2604.8 horses? | CREATE TABLE table_60645 ("Year" real,"Total Horses" real,"Working Horses" text,"Total Cattle" real,"Oxen" real,"Bulls" text,"Cows" real,"Pigs" real,"Sheep and Goats" real) | SELECT MIN("Sheep and Goats") FROM table_60645 WHERE "Year" > '1931' AND "Cows" < '2518' AND "Total Horses" > '2604.8' |
Who drives the abc supply sponsored cor? | CREATE TABLE table_2503102_2 (driver_s_ VARCHAR,primary_sponsor VARCHAR) | SELECT driver_s_ FROM table_2503102_2 WHERE primary_sponsor = "ABC Supply" |
How many Attendance in a match which scores 0:0 - 4:1 (pen) | CREATE TABLE table_6062 ("Venue" text,"Home" text,"Guest" text,"Score" text,"Attendance" real) | SELECT AVG("Attendance") FROM table_6062 WHERE "Score" = '0:0 - 4:1 (pen)' |
Which School has a Year Joined larger than 1926, and a Mascot of vikings? | CREATE TABLE table_name_86 (school VARCHAR,year_joined VARCHAR,mascot VARCHAR) | SELECT school FROM table_name_86 WHERE year_joined > 1926 AND mascot = "vikings" |
What was the rating of episode titled '110'? | CREATE TABLE table_21186 ("Episode number" real,"Episode" text,"Rating" text,"Share" real,"Rating/Share (18-49)" text,"Viewers (millions)" text,"Rank (Overall)" text) | SELECT "Rating" FROM table_21186 WHERE "Episode" = '110' |
Show the number of male and female assistant professors Plot them as bar chart, display in descending by the X-axis. | CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)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 Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,activity_... | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY Sex DESC |
Which Topinka happened on january 22, 2006? | CREATE TABLE table_75306 ("Source" text,"Date" text,"Blagojevich (D)" text,"Topinka (R)" text,"Remainder" text) | SELECT "Topinka (R)" FROM table_75306 WHERE "Date" = 'january 22, 2006' |
in 05/last year was lasix prescribed to patient 021-32860? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicm... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-32860')) AND medication.drugname = 'lasix' AND DATETIME(medication.dru... |
A bar chart for finding the number of the names of catalog entries with level number 8, and I want to show x-axis in desc order. | CREATE TABLE Catalog_Structure (catalog_level_number INTEGER,catalog_id INTEGER,catalog_level_name VARCHAR(50))CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id INTEGER,catalog_level_number INTEGER,attribute_id INTEGER,attribute_value VARCHAR(255))CREATE TABLE Catalogs (catalog_id INTEGER,catalog_na... | SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name DESC |
what's the winner with purse( $ ) value of bigger than 964017.2297960471 and date value of may 28 | CREATE TABLE table_16934 ("Date" text,"Tournament" text,"Location" text,"Purse($)" real,"Winner" text,"Score" text,"1st Prize($)" real) | SELECT "Winner" FROM table_16934 WHERE "Purse( $ )" > '964017.2297960471' AND "Date" = 'May 28' |
What is team 1 if Renova is team 2? | CREATE TABLE table_name_99 (team_1 VARCHAR,team_2 VARCHAR) | SELECT team_1 FROM table_name_99 WHERE team_2 = "renova" |
during their last hospital visit when did patient 025-51835 first receive the chloride test? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE cost (cos... | SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-51835' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala... |
count the number of patients whose admission location is trsf within this facility and drug code is ketr30i? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "KETR30I" |
Show the relationship between number of accounts and customer id in a scatter chart. | CREATE TABLE Product_Categories (production_type_code VARCHAR(15),product_type_description VARCHAR(80),vat_rating DECIMAL(19,4))CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DECIMAL(19,4),tr... | SELECT T1.customer_id, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id |
Which region has Stanford University as host? | CREATE TABLE table_45873 ("Region" text,"Host" text,"Venue" text,"City" text,"State" text) | SELECT "Region" FROM table_45873 WHERE "Host" = 'stanford university' |
Which length has a Bullet of 6.5 (.257)? | CREATE TABLE table_4595 ("Name" text,"Bullet" text,"Length" text,"Base" text,"Shoulder" text,"Neck" text) | SELECT "Length" FROM table_4595 WHERE "Bullet" = '6.5 (.257)' |
Which Surface has an Opponent of kerry melville reid, and a Score of 6 3, 2 6, 3 6? | CREATE TABLE table_36784 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Surface" FROM table_36784 WHERE "Opponent" = 'kerry melville reid' AND "Score" = '6–3, 2–6, 3–6' |
Which teams were in the 2006-07 season? | CREATE TABLE table_name_41 (teams VARCHAR,season VARCHAR) | SELECT teams FROM table_name_41 WHERE season = "2006-07" |
how many hours have elapsed since the first time on their current hospital visit patient 012-31752 was diagnosed with nutritional deficiency? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresul... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '012-31752... |
Which years have a Decile of 4, an Authority of state, and a Name of mapiu school? | CREATE TABLE table_name_43 (years VARCHAR,name VARCHAR,decile VARCHAR,authority VARCHAR) | SELECT years FROM table_name_43 WHERE decile = 4 AND authority = "state" AND name = "mapiu school" |
out of total number of patients with unspecified/unknown ethnic origin, calculate the number of those who were divorced | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "UNKNOWN/NOT SPECIFIED" |
on their first hospital visit was patient 002-17195 prescribed famotidine? | 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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventt... | 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 = '002-17195' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.... |
Name the number of wheel arrangement when class is d14 | CREATE TABLE table_20184 ("Class" text,"Wheel Arrangement" text,"Railway" text,"Number at Doncaster" real,"Number at Pyewipe" real,"Number at March" real) | SELECT COUNT("Wheel Arrangement") FROM table_20184 WHERE "Class" = 'D14' |
What is the proportion of average weights for each sex? | 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, AVG(Weight) FROM people GROUP BY Sex |
flights from BOSTON to PITTSBURGH | CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE compartment_class (compartment varchar,class... | 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 = 'PITTSBU... |
how many patients who died were procedured for implant of pulsation balloon? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "1" AND procedures.long_title = "Implant of pulsation balloon" |
What was the date of the game when the Lightning had a record of 9 8 1? | CREATE TABLE table_53117 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text) | SELECT "Date" FROM table_53117 WHERE "Record" = '9–8–1' |
Show the relationship between account id and the number of transactions for each account in a scatter chart. | CREATE TABLE Products (product_id INTEGER,parent_product_id INTEGER,production_type_code VARCHAR(15),unit_price DECIMAL(19,4),product_name VARCHAR(80),product_color VARCHAR(20),product_size VARCHAR(20))CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type... | SELECT T1.account_id, COUNT(*) FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id |
What is the minimum age of patients whose admission type is new born and have medicare insurance? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.insurance = "Medicare" |
Return a bar chart on how many departments are in each school?, display in ascending by the names. | 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 ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50... | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE |
Who was the director of the film with the original title of 'The Patience Stone'? | CREATE TABLE table_21387 ("Year (Ceremony)" text,"Film title used in nomination" text,"Original title" text,"Language(s)" text,"Director" text,"Result" text) | SELECT "Director" FROM table_21387 WHERE "Original title" = 'The Patience Stone' |
patient 013-21980 received a alpha/beta blocker - carvedilol procedure? | 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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid numbe... | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-21980')) AND treatment.treatmentname = 'alpha/beta blocker - carvedilol' |
how long did karin enke took to finish the race ? | CREATE TABLE table_204_556 (id number,"rank" number,"athlete" text,"country" text,"time" text,"notes" text) | SELECT "time" FROM table_204_556 WHERE "athlete" = 'karin enke' |
Bluemix post count, view count, view/post ratio per day. | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu... | SELECT DATE(p.CreationDate) AS pdate, COUNT(*) AS nposts_per_day, SUM(p.ViewCount) AS nviews_per_day, SUM(p.ViewCount) / COUNT(*) AS view_post_ratio FROM Tags JOIN PostTags AS pt ON Tags.Id = pt.TagId JOIN Posts AS p ON pt.PostId = p.Id WHERE Tags.TagName = @TagName GROUP BY DATE(p.CreationDate) ORDER BY pdate DESC LIM... |
Show the number of the dates of performances with attending members whose roles are 'Violin', and could you display x-axis in asc order? | CREATE TABLE member_attendance (Member_ID int,Performance_ID int,Num_of_Pieces int)CREATE TABLE performance (Performance_ID real,Date text,Host text,Location text,Attendance int)CREATE TABLE member (Member_ID text,Name text,Nationality text,Role text) | SELECT Date, COUNT(Date) FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin" GROUP BY Date ORDER BY Date |
How many new entries when the leagues entering in the round are tff third league & turkish regional amateur league? | CREATE TABLE table_63652 ("Round" text,"Clubs remaining" real,"Clubs involved" real,"Winners from previous round" text,"New entries this round" text,"Leagues entering at this round" text) | SELECT "New entries this round" FROM table_63652 WHERE "Leagues entering at this round" = 'tff third league & turkish regional amateur league' |
Bar chart x axis date y axis the number of date, and list in asc by the y-axis. | 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 INTEGER,min_humidity INTEGER,max_sea_level_pressure_inches NUMERIC,mean_sea_level_pressure_inches NUM... | SELECT date, COUNT(date) FROM weather ORDER BY COUNT(date) |
What is Score, when Venue is Riyadh, Saudi Arabia, and when Result is 'Win'? | CREATE TABLE table_78717 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Score" FROM table_78717 WHERE "Venue" = 'riyadh, saudi arabia' AND "Result" = 'win' |
Show the number of professors who is in office DRE 102 hired in each weekday with a bar chart. | CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20)... | SELECT EMP_HIREDATE, COUNT(EMP_HIREDATE) FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102' GROUP BY EMP_LNAME |
In what location were the fatalities unknown for the Ju-52 aircraft? | CREATE TABLE table_name_12 (location VARCHAR,fatalities VARCHAR,aircraft VARCHAR) | SELECT location FROM table_name_12 WHERE fatalities = "unknown" AND aircraft = "ju-52" |
Collect all answer Ids for the Given Question Id. | CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Post... | SELECT Id, Score FROM Posts WHERE ParentId = 2158 |
What's the average year with a rank less than 3? | CREATE TABLE table_name_91 (year INTEGER,rank INTEGER) | SELECT AVG(year) FROM table_name_91 WHERE rank < 3 |
What is the average population for an area less than 433.7km and a 23013 code? | CREATE TABLE table_name_17 (population INTEGER,area__km_2__ VARCHAR,code VARCHAR) | SELECT AVG(population) FROM table_name_17 WHERE area__km_2__ < 433.7 AND code = 23013 |
Tell me the horse with faults of 0 when the total is 4.1 | CREATE TABLE table_12012 ("Rider" text,"Horse" text,"Faults" text,"Round 1 + 2A Points" text,"Total" real) | SELECT "Horse" FROM table_12012 WHERE "Faults" = '0' AND "Total" = '4.1' |
What was the year when Ch nqi Ch sh ( ) was submitted? | CREATE TABLE table_17350255_1 (year__ceremony_ VARCHAR,original_title VARCHAR) | SELECT year__ceremony_ FROM table_17350255_1 WHERE original_title = "Chūnqiū cháshì (春秋茶室)" |
Can you tell me the Opponent that has the Series of 4-2? | CREATE TABLE table_70591 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Series" text) | SELECT "Opponent" FROM table_70591 WHERE "Series" = '4-2' |
how much is a LIMOUSINE between DALLAS/FORT WORTH INTERNATIONAL international airport and DALLAS | CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE dual_carrier (main_airline varchar,l... | SELECT DISTINCT ground_service.ground_fare FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND airport.airport_name LIKE 'DALLAS/FORT WORTH INTERNATIONAL' AND city.city_code = airport_service.city_code AND city.city_name = 'DALLAS' AND ground_service.airport... |
Questions That Have An Answer With A Score Higher Than The Accepted Answer. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId numb... | SELECT q.Id AS QuestionId, q.Title, aa.Score AS AcceptedAnswerScore, Topscore.Maxscore AS HighestAnswerScore, Topscore.Maxscore - aa.Score AS ScoreDifference FROM Posts AS q JOIN Posts AS aa ON q.AcceptedAnswerId = aa.Id JOIN (SELECT a.ParentId, MAX(a.Score) AS Maxscore FROM Posts AS a JOIN Posts AS p ON a.ParentId = p... |
What is every GICS sector for free float of 0.3180? | CREATE TABLE table_23805 ("BSE Code" text,"Company" text,"City" text,"GICS Sector" text,"Free float" text,"Index weighting (%" text) | SELECT "GICS Sector" FROM table_23805 WHERE "Free float" = '0.3180' |
What are the names of all of Bob's friends? | CREATE TABLE person (name text,age number,city text,gender text,job text)CREATE TABLE personfriend (name text,friend text,year number) | SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob' |
is the value of rbc of patient 009-5001 last measured on the current hospital visit greater than the value first measured on the current hospital visit? | 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 (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 = '009-5001' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'rbc' O... |
List the number of games for each away team and group by home team in a stacked bar chart The x-axis is away team, and sort X-axis in desc order. | CREATE TABLE stadium (id int,name text,Home_Games int,Average_Attendance real,Total_Attendance real,Capacity_Percentage real)CREATE TABLE injury_accident (game_id int,id int,Player text,Injury text,Number_of_matches text,Source text)CREATE TABLE game (stadium_id int,id int,Season int,Date text,Home_team text,Away_team ... | SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Home_team, Away_team ORDER BY Away_team DESC |
What is the wins number when the points were smaller than 27, and goals against was 41? | CREATE TABLE table_79024 ("Position" real,"Club" text,"Played" real,"Points" real,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT SUM("Wins") FROM table_79024 WHERE "Points" < '27' AND "Goals against" = '41' |
who are the writers when the production code is 8011? | CREATE TABLE table_73416 ("Season no." real,"Series no." real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. Viewers (millions)" text) | SELECT "Written by" FROM table_73416 WHERE "Production code" = '8011' |
What party represents the district with john g. jackson? | CREATE TABLE table_2668378_18 (party VARCHAR,incumbent VARCHAR) | SELECT party FROM table_2668378_18 WHERE incumbent = "John G. Jackson" |
Show the church names for the weddings of all people older than 30. | CREATE TABLE wedding (male_id VARCHAR,female_id VARCHAR,church_id VARCHAR)CREATE TABLE people (people_id VARCHAR,age VARCHAR)CREATE TABLE church (name VARCHAR,church_id VARCHAR) | SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30 |
What is Builder, when Date is 1953? | CREATE TABLE table_name_71 (builder VARCHAR,date VARCHAR) | SELECT builder FROM table_name_71 WHERE date = "1953" |
What is the sum of all mintage created by Pierre Leduc? | CREATE TABLE table_10335 ("Year" real,"Park" text,"Artist" text,"Mintage" real,"Issue Price" text) | SELECT SUM("Mintage") FROM table_10335 WHERE "Artist" = 'pierre leduc' |
WHich in 2010 11 has an Event of autumn gold? | CREATE TABLE table_name_99 (event VARCHAR) | SELECT 2010 AS _11 FROM table_name_99 WHERE event = "autumn gold" |
What Team had a 1:24.152 Best? | CREATE TABLE table_name_51 (team VARCHAR,best VARCHAR) | SELECT team FROM table_name_51 WHERE best = "1:24.152" |
Name of rivelino had how many highest caps? | CREATE TABLE table_33860 ("Name" text,"Caps" real,"Goals" real,"First cap" text,"Latest cap" text) | SELECT MAX("Caps") FROM table_33860 WHERE "Name" = 'rivelino' |
Name the replaced by for slaven belupo | CREATE TABLE table_29364 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text,"Position in table" text) | SELECT "Replaced by" FROM table_29364 WHERE "Team" = 'Slaven Belupo' |
What player went to Ohio State College? | CREATE TABLE table_10812938_5 (player VARCHAR,college VARCHAR) | SELECT player FROM table_10812938_5 WHERE college = "Ohio State" |
Tell me the object type which has an apparent magnitude more than 10.6 and declination of 44 07 | CREATE TABLE table_56022 ("NGC number" real,"Object type" text,"Constellation" text,"Right ascension (J2000)" text,"Declination (J2000)" text,"Apparent magnitude" real) | SELECT "Object type" FROM table_56022 WHERE "Apparent magnitude" > '10.6' AND "Declination ( J2000 )" = '°44′07″' |
what was the top -lrb- most frequent -rrb- fate reported for losses ? | CREATE TABLE table_203_148 (id number,"date" text,"name" text,"nationality" text,"tonnage\n(grt)" number,"fate" text) | SELECT "fate" FROM table_203_148 GROUP BY "fate" ORDER BY COUNT(*) DESC LIMIT 1 |
how many days has elapsed since the last time in their current hospital encounter patient 24132 had received a po2 lab test? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'po2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24132 AND admissions.disc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.