instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
until 1 year ago what was the three most frequently given procedure for patients 40s? | CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B... |
What is the Location when the novelty is gen? | CREATE TABLE table_41182 ("Name" text,"Novelty" text,"Status" text,"Authors" text,"Unit" text,"Location" text) | SELECT "Location" FROM table_41182 WHERE "Novelty" = 'gen' |
When the Surface was Carpet (i), what was the Outcome? | CREATE TABLE table_name_11 (outcome VARCHAR,surface VARCHAR) | SELECT outcome FROM table_name_11 WHERE surface = "carpet (i)" |
How many years have a weeks at #1 value of exactly 8? | CREATE TABLE table_74111 ("Artist" text,"Country" text,"Number-one single(s)" text,"Year" real,"Weeks at #1" real,"Straight to #1 ?" text) | SELECT COUNT("Year") FROM table_74111 WHERE "Weeks at #1" = '8' |
What team had a Ravg of 3.4? | CREATE TABLE table_name_72 (team VARCHAR,ravg VARCHAR) | SELECT team FROM table_name_72 WHERE ravg = "3.4" |
what are the flights from ST. LOUIS to CHARLOTTE NORTH CAROLINA leaving on friday | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)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 flig... | SELECT DISTINCT flight_id FROM flight WHERE ((flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 25 AND DATE_DAYalias0.month_number = 6 AND DATE_DAYalias0.year = 1991)) AND to_... |
Who wrote the series number 49 with a season larger than 4? | CREATE TABLE table_name_27 (written_by VARCHAR,season_no VARCHAR,series_no VARCHAR) | SELECT written_by FROM table_name_27 WHERE season_no > 4 AND series_no = 49 |
Median vote on accepted answers. | 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 PendingFlags (Id num... | WITH AcceptedAnswersScores AS (SELECT a.Score FROM Posts AS a INNER JOIN Posts AS q ON q.AcceptedAnswerId = a.Id WHERE a.PostTypeId = 2), Medians AS (SELECT median = PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY Score) OVER () FROM AcceptedAnswersScores) SELECT AVG(CAST(median AS FLOAT)) FROM Medians |
what is the 2008 when 2007 is A, 2011 is A and tournament is san jose? | CREATE TABLE table_9978 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2008" FROM table_9978 WHERE "2007" = 'a' AND "2011" = 'a' AND "Tournament" = 'san jose' |
What is Michael Del Zotto's nationality? | CREATE TABLE table_77135 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team (League)" text) | SELECT "Nationality" FROM table_77135 WHERE "Player" = 'michael del zotto' |
Which Runner(s)-up has a Tournament of general foods pga seniors' championship? | CREATE TABLE table_name_65 (runner_s__up VARCHAR,tournament VARCHAR) | SELECT runner_s__up FROM table_name_65 WHERE tournament = "general foods pga seniors' championship" |
What is the lowest 4 hoops, 2 clubs of the nation with a total of 38.25? | CREATE TABLE table_34373 ("Place" real,"Nation" text,"6 Ropes" real,"4 Hoops,2 Clubs" real,"Total" real) | SELECT MIN("4 Hoops, 2 Clubs") FROM table_34373 WHERE "Total" = '38.25' |
What is the nationality when the player is randy heath? | CREATE TABLE table_2679061_2 (nationality VARCHAR,player VARCHAR) | SELECT nationality FROM table_2679061_2 WHERE player = "Randy Heath" |
what is the average number of tackles this player has had over his career ? | CREATE TABLE table_204_756 (id number,"year" number,"team" text,"games" number,"combined tackles" number,"tackles" number,"assisted tackles" number,"sacks" number,"forced fumbles" number,"fumble recoveries" number,"fumble return yards" number,"interceptions" number,"interception return yards" number,"yards per intercep... | SELECT AVG("tackles") FROM table_204_756 |
Which conference is in Jackson, Mississippi? | CREATE TABLE table_10577579_3 (current_conference VARCHAR,location VARCHAR) | SELECT current_conference FROM table_10577579_3 WHERE location = "Jackson, Mississippi" |
How many documents for different document name? Draw a bar chart, could you sort in ascending by the Y? | CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document_Description VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Accounts (Account_ID INTEGER,Statement_ID INTEGER,Account_Details VARCHAR(255))CREATE TABLE Statements (S... | SELECT Document_Name, COUNT(Document_Name) FROM Documents GROUP BY Document_Name ORDER BY COUNT(Document_Name) |
On what date was the score 0-0? | CREATE TABLE table_37859 ("Date" text,"Home team" text,"Score" text,"Away team" text,"Venue" text,"Crowd" text,"Report" text) | SELECT "Date" FROM table_37859 WHERE "Score" = '0-0' |
count the number of black/cape verdean patients who were hospitalized for more than 8 days in hospital. | 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 WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay > "8" |
display the department name and number of employees in each of the department. | CREATE TABLE employees (employee_id number,first_name text,last_name text,email text,phone_number text,hire_date time,job_id text,salary number,commission_pct number,manager_id number,department_id number)CREATE TABLE job_history (employee_id number,start_date time,end_date time,job_id text,department_id number)CREATE ... | SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name |
what is the description next to medusa ? | CREATE TABLE table_204_427 (id number,"creature (other planes)" text,"page" text,"other appearances" text,"variants" text,"description" text) | SELECT "description" FROM table_204_427 WHERE "creature (other planes)" = 'medusa' |
Find the payment method code used by more than 3 parties. | CREATE TABLE individuals (individual_id number,individual_first_name text,individual_middle_name text,inidividual_phone text,individual_email text,individual_address text,individual_last_name text)CREATE TABLE services (service_id number,service_type_code text,service_name text,service_descriptio text)CREATE TABLE orga... | SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING COUNT(*) > 3 |
Show the stars of each director by a bar chart, and could you order stars in asc order? | CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Reviewer (rID int,name text) | SELECT director, stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY stars |
which university has the least in endowment ? | CREATE TABLE table_203_592 (id number,"institution" text,"location" text,"athletic nickname" text,"undergraduate enrollment" number,"graduate enrollment" number,"total enrollment" number,"2013 endowment\n(and us rank)" text,"academic staff" number,"motto" text) | SELECT "institution" FROM table_203_592 ORDER BY "2013 endowment\n(and us rank)" LIMIT 1 |
Who won in 1991? | CREATE TABLE table_name_89 (player VARCHAR,year_s__won VARCHAR) | SELECT player FROM table_name_89 WHERE year_s__won = "1991" |
What is the sum of Game with a Score that is w 104 90 (ot)? | CREATE TABLE table_42858 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"Location Attendance" text,"Record" text) | SELECT SUM("Game") FROM table_42858 WHERE "Score" = 'w 104–90 (ot)' |
For those records from the products and each product's manufacturer, give me the comparison about the average of revenue over the founder , and group by attribute founder by a bar chart, display X in descending order. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT Founder, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder DESC |
Name the result for milwaukee county stadium | CREATE TABLE table_19761 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" real) | SELECT "Result" FROM table_19761 WHERE "Game Site" = 'Milwaukee County Stadium' |
what is ba - running bear where b - bishop is rn - running stag? | CREATE TABLE table_2603017_2 (ba___running_bear VARCHAR,b___bishop VARCHAR) | SELECT ba___running_bear FROM table_2603017_2 WHERE b___bishop = "RN - Running Stag" |
Which viewers had Matt Gallagher as the director? | CREATE TABLE table_16980 ("Total No." real,"Celebrity" text,"Director" text,"Original air date" text,"Viewers" text) | SELECT "Viewers" FROM table_16980 WHERE "Director" = 'Matt Gallagher' |
what is the number of titles released by psikyo in 2004 ? | CREATE TABLE table_203_583 (id number,"title" text,"release" number,"6th gen" text,"handheld" text,"note" text) | SELECT COUNT("title") FROM table_203_583 WHERE "release" = 2004 |
What is the prime mover of the locomotive with a fa-2 model? | CREATE TABLE table_67584 ("Model" text,"Specification" text,"Build date" text,"Total produced" real,"Wheel arrangement" text,"Prime mover" text,"Power output" text) | SELECT "Prime mover" FROM table_67584 WHERE "Model" = 'fa-2' |
Name the military expenditures for 2011 for romania | CREATE TABLE table_17971449_2 (military_expenditures__2011 VARCHAR,_us$_millions_ VARCHAR,country VARCHAR) | SELECT military_expenditures__2011, _us$_millions_ FROM table_17971449_2 WHERE country = "Romania" |
What is the Theme Song of ? | CREATE TABLE table_name_5 (theme_song_s_ VARCHAR,japanese_title VARCHAR) | SELECT theme_song_s_ FROM table_name_5 WHERE japanese_title = "働きマン" |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of revenue , and group by attribute name, and sort X-axis in descending order. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | 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 DESC |
what is the difference between the gold medals won by china and its total medal winnings ? | CREATE TABLE table_203_707 (id number,"rank" number,"npc" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT "total" - "gold" FROM table_203_707 WHERE "npc" = 'china' |
Name the position for judy-ann ramirez | CREATE TABLE table_15463188_1 (position VARCHAR,name VARCHAR) | SELECT position FROM table_15463188_1 WHERE name = "judy-ann ramirez" |
how many patients until 3 years ago were prescribed acetaminophen in the same hospital visit after the therapeutic antibacterials - empiric antibacterial coverage? | 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 diagnosis (diagnosisid number,patientunitstayid numb... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'therapeutic antibacterials - empiric antibacterial coverage' AND DATETIME... |
What is the length of the track named michigan international speedway? | CREATE TABLE table_17684 ("Track Name" text,"Location" text,"Length" text,"Seating" real,"Year Opened" real,"Year Acquired [A ]" real) | SELECT "Length" FROM table_17684 WHERE "Track Name" = 'Michigan International Speedway' |
Plot how many name by grouped by name as a bar graph, order in ascending by the x-axis. | CREATE TABLE station (id int,network_name text,services text,local_authority text)CREATE TABLE route (train_id int,station_id int)CREATE TABLE weekly_weather (station_id int,day_of_week text,high_temperature int,low_temperature int,precipitation real,wind_speed_mph int)CREATE TABLE train (id int,train_number int,name t... | SELECT name, COUNT(name) FROM train GROUP BY name ORDER BY name |
Show me a bar chart for how many invoices were billed from each state?, and show by the Y-axis in desc. | CREATE TABLE customers (id INTEGER,first_name VARCHAR(40),last_name VARCHAR(20),company VARCHAR(80),address VARCHAR(70),city VARCHAR(40),state VARCHAR(40),country VARCHAR(40),postal_code VARCHAR(10),phone VARCHAR(24),fax VARCHAR(24),email VARCHAR(60),support_rep_id INTEGER)CREATE TABLE playlist_tracks (playlist_id INTE... | SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC |
Return a bar chart about the distribution of Nationality and the amount of Nationality , and group by attribute Nationality, list by the bars in desc. | CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadiu... | SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC |
what was the price of patient 16572's hospital stay until 1 year ago? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid num... | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16572) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year') |
What was the score on March 5 at Vancouver? | CREATE TABLE table_5171 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_5171 WHERE "Date" = 'march 5' |
Find the number of the 'date became customers' of the customers whose ID is between 10 and 20, and order by the Y in ascending. | CREATE TABLE Addresses (address_id INTEGER,address_content VARCHAR(80),city VARCHAR(50),zip_postcode VARCHAR(20),state_province_county VARCHAR(50),country VARCHAR(50),other_address_details VARCHAR(255))CREATE TABLE Customers (customer_id INTEGER,payment_method VARCHAR(15),customer_name VARCHAR(80),date_became_customer ... | SELECT date_became_customer, COUNT(date_became_customer) FROM Customers WHERE customer_id BETWEEN 10 AND 20 ORDER BY COUNT(date_became_customer) |
What are the dates in which the mean sea level pressure was between 30.3 and 31? | CREATE TABLE station (id number,name text,lat number,long number,dock_count number,city text,installation_date text)CREATE TABLE status (station_id number,bikes_available number,docks_available number,time text)CREATE TABLE weather (date text,max_temperature_f number,mean_temperature_f number,min_temperature_f number,m... | SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 |
What is the sum of losses for Against values over 1510? | CREATE TABLE table_name_70 (losses INTEGER,against INTEGER) | SELECT SUM(losses) FROM table_name_70 WHERE against > 1510 |
what was patient 006-47576's first prescribed time for 37.5 g tube : glucose 40 % po gel during this month? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch... | SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-47576')) AND medication.drugname = '37.5 g tube : glucose ... |
Tell me the discovery/publication for still living | CREATE TABLE table_name_55 (discovery___publication_of_name VARCHAR,fossil_record VARCHAR) | SELECT discovery___publication_of_name FROM table_name_55 WHERE fossil_record = "still living" |
What Nationality has a Position of right wing, with a #20 pick? | CREATE TABLE table_36652 ("Pick #" text,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text) | SELECT "Nationality" FROM table_36652 WHERE "Position" = 'right wing' AND "Pick #" = '20' |
how many patients whose procedure icd9 code is 8968 and drug type is main? | 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 procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "8968" AND prescriptions.drug_type = "MAIN" |
List of top-level tags ordered by counts. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostHistory (Id number,Po... | SELECT * FROM Tags WHERE ((TagName = 'ag.algebraic-geometry') OR (TagName = 'nt.number-theory')) ORDER BY Count DESC |
WHich Match has a Venue of h on 22 september 1888 with Attendances smaller than 4,000? | CREATE TABLE table_6305 ("Match" real,"Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real) | SELECT MAX("Match") FROM table_6305 WHERE "Venue" = 'h' AND "Date" = '22 september 1888' AND "Attendance" < '4,000' |
What is the title of the edition with more than 128 pages and a volume # of 5? | CREATE TABLE table_7364 ("Vol. #" real,"Title" text,"Material collected" text,"Pages" real,"ISBN" text) | SELECT "Title" FROM table_7364 WHERE "Pages" > '128' AND "Vol. #" = '5' |
how many patients whose marital status is divorced and gender is m? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.gender = "M" |
Show the names of employees with role name Editor. | CREATE TABLE documents_to_be_destroyed (document_id number,destruction_authorised_by_employee_id number,destroyed_by_employee_id number,planned_destruction_date time,actual_destruction_date time,other_details text)CREATE TABLE ref_document_types (document_type_code text,document_type_name text,document_type_description... | SELECT T1.employee_name FROM employees AS T1 JOIN roles AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Editor" |
How many cardiff wins have a draw greater than 27? | CREATE TABLE table_41682 ("Competition" text,"Total Matches" real,"Cardiff Win" real,"Draw" real,"Swansea Win" real) | SELECT COUNT("Cardiff Win") FROM table_41682 WHERE "Draw" > '27' |
With a subjunctive of du m chast what is the imperative? | CREATE TABLE table_42918 ("m\u00e5cha" text,"indicative" text,"imperative" text,"subjunctive" text,"inverse subjunctive" text) | SELECT "imperative" FROM table_42918 WHERE "subjunctive" = 'du måchast' |
Give me the comparison about Team_ID over the ACC_Regular_Season by a bar chart, rank from high to low by the Team_ID. | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT ACC_Regular_Season, Team_ID FROM basketball_match ORDER BY Team_ID DESC |
Name the net profit for eps beign 1.19 | CREATE TABLE table_20614109_1 (net_profit__€m_ VARCHAR,earnings_per_share__€_ VARCHAR) | SELECT net_profit__€m_ FROM table_20614109_1 WHERE earnings_per_share__€_ = "1.19" |
how many days elapsed since patient 25733 received his bicarbonate lab test for the last time during 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 chartevents (row_id number,subject_id number,hadm_id number,ic... | 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 = 'bicarbonate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25733 AND admissi... |
What is the total number of captains in each rank and class? Let class as X-axis, and categorize by rank with a stacked bar chart, I want to order total number from low to high order please. | CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text)CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text) | SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class) |
Name the least total when bronze is less than 2 and rank is more than 2 with silver less than 1 | CREATE TABLE table_name_24 (total INTEGER,silver VARCHAR,bronze VARCHAR,rank VARCHAR) | SELECT MIN(total) FROM table_name_24 WHERE bronze < 2 AND rank > 2 AND silver < 1 |
give me flights from SEATTLE to CHICAGO that have meals on CO | 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)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE food_service (meal... | SELECT DISTINCT flight_id FROM flight WHERE (((meal_code IN (SELECT FOOD_SERVICEalias0.meal_code FROM food_service AS FOOD_SERVICEalias0) AND to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM ... |
how much longer is the peak 2 peak gondola than the 32 aerial tramway ? | CREATE TABLE table_203_457 (id number,"tramway" text,"country" text,"city" text,"height of pylons" text,"span width,\nleaning straight line" text,"span width,\nhorizontal measurement" text,"height of cable over ground" text,"year of inauguration" number,"notes" text) | SELECT (SELECT "span width,\nleaning straight line" FROM table_203_457 WHERE "tramway" = 'peak 2 peak gondola') - (SELECT "span width,\nleaning straight line" FROM table_203_457 WHERE "tramway" = '3s aerial tramway') |
What Venue has a Status of five nations, and Against of 0? | CREATE TABLE table_name_89 (venue VARCHAR,status VARCHAR,against VARCHAR) | SELECT venue FROM table_name_89 WHERE status = "five nations" AND against = 0 |
Name the tournament for march 25, 2012 | CREATE TABLE table_67239 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Tournament" FROM table_67239 WHERE "Date" = 'march 25, 2012' |
In what Country will Dennis Bl mke play the Germany F13 Futures Tournament? | CREATE TABLE table_name_9 (country VARCHAR,singles_champions VARCHAR,tournament VARCHAR) | SELECT country FROM table_name_9 WHERE singles_champions = "dennis blömke" AND tournament = "germany f13 futures" |
What are the dates of transactions with at least 100 share count or amount bigger than 100, and count them by a bar chart, and I want to display Y-axis in ascending order. | CREATE TABLE Transactions (transaction_id INTEGER,investor_id INTEGER,transaction_type_code VARCHAR(10),date_of_transaction DATETIME,amount_of_transaction DECIMAL(19,4),share_count VARCHAR(40),other_details VARCHAR(255))CREATE TABLE Sales (sales_transaction_id INTEGER,sales_details VARCHAR(255))CREATE TABLE Purchases (... | SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count >= 100 OR amount_of_transaction >= 100 ORDER BY COUNT(date_of_transaction) |
what was the first bedside glucose value during the last hospital encounter for patient 028-39354? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,... | 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 = '028-39354' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmit... |
What region is on 11 August 2008? | CREATE TABLE table_61517 ("Region" text,"Date" text,"Label" text,"Format(s)" text,"Catalog" text) | SELECT "Region" FROM table_61517 WHERE "Date" = '11 august 2008' |
What is the average number of cuts made when there were more than 2 tournaments played in 2011? | CREATE TABLE table_40160 ("Year" real,"Tournaments played" real,"Cuts made" real,"Wins" real,"Best finish" text,"Earnings ($)" text,"Scoring average" real) | SELECT AVG("Cuts made") FROM table_40160 WHERE "Tournaments played" > '2' AND "Year" = '2011' |
What is the lowest amount of L in any season? | CREATE TABLE table_24224991_2 (l INTEGER) | SELECT MIN(l) FROM table_24224991_2 |
What is the college that Jeffrey Simmer plays for? | CREATE TABLE table_15817998_5 (college VARCHAR,player VARCHAR) | SELECT college FROM table_15817998_5 WHERE player = "Jeffrey Simmer" |
titles with trailing space and duplicate title. | CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount numb... | SELECT RTRIM(LOWER(p.Title)) FROM Posts AS p GROUP BY RTRIM(LOWER(p.Title)) HAVING (COUNT(RTRIM(LOWER(p.Title))) > 1) INTERSECT SELECT RTRIM(LOWER(Title)) FROM Posts WHERE DATALENGTH(RTRIM(Title)) != DATALENGTH(Title) AND PostTypeId = 1 |
tell me the admission time and diagnoses of chandra schulman. | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT demographic.admittime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Chandra Schulman" |
What was the final episode for Dea Agent? | CREATE TABLE table_16512 ("Character" text,"Position" text,"Actor" text,"First Episode" text,"Final Episode" text,"Duration" text,"Final Episode Count" real) | SELECT "Final Episode" FROM table_16512 WHERE "Position" = 'DEA Agent' |
How many laps were in grid 4? | CREATE TABLE table_name_97 (laps VARCHAR,grid VARCHAR) | SELECT laps FROM table_name_97 WHERE grid = 4 |
What is the 2 credits of a hand that has a 3 credits of 180? | CREATE TABLE table_52384 ("Hand" text,"1 credit" text,"2 credits" text,"3 credits" text,"4 credits" text,"5 credits" text) | SELECT "2 credits" FROM table_52384 WHERE "3 credits" = '180' |
give me the number of patients whose days of hospital stay is greater than 27 and lab test name is magnesium? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Magnesium" |
count the number of patients whose diagnosis icd9 code is 76519 and drug route is replace. | 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 procedures (subject_id text,hadm_id te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "76519" AND prescriptions.route = "REPLACE" |
How many project staff worked as leaders or started working before '1989-04-24 23:51:54'? | CREATE TABLE documents (document_id number,document_type_code text,grant_id number,sent_date time,response_received_date time,other_details text)CREATE TABLE tasks (task_id number,project_id number,task_details text,eg agree objectives text)CREATE TABLE organisation_types (organisation_type text,organisation_type_descr... | SELECT COUNT(*) FROM project_staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54' |
An offering of AUTO 513 has been made how many times ? | CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree varcha... | SELECT COUNT(DISTINCT course_offering.offering_id) FROM course, course_offering WHERE course.course_id = course_offering.course_id AND course.department = 'AUTO' AND course.number = 513 |
When the network mask is 255.255.255.224 what is the highest total usable host? | CREATE TABLE table_19706 ("Prefix size" text,"Network mask" text,"Available subnets" real,"Usable hosts per subnet" real,"Total usable hosts" real) | SELECT MAX("Total usable hosts") FROM table_19706 WHERE "Network mask" = '255.255.255.224' |
how many seats in a 100 | CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE airport_service (city... | SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = '100' |
provide the the number of black/african american patients born before 2076. | 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 WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2076" |
List the cities which have more than 2 airports sorted by the number of airports. | CREATE TABLE airports (city VARCHAR) | SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*) |
provide the number of patients whose admission type is urgent and procedure short title is int insert dual-cham dev? | 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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Int insert dual-cham dev" |
Return a pie on how many members are in each party? | CREATE TABLE member (Member_ID int,Member_Name text,Party_ID text,In_office text)CREATE TABLE party (Party_ID int,Minister text,Took_office text,Left_office text,Region_ID int,Party_name text)CREATE TABLE party_events (Event_ID int,Event_Name text,Party_ID int,Member_in_charge_ID int)CREATE TABLE region (Region_ID int,... | SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID |
What the total of Week with attendance of 53,147 | CREATE TABLE table_42292 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text) | SELECT SUM("Week") FROM table_42292 WHERE "Attendance" = '53,147' |
find the number of male patients who have diagnoses icd9 code 70703. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.icd9_code = "70703" |
Which Purpose has a Name of oak? | CREATE TABLE table_11763 ("Name" text,"Location" text,"Elevation + Height" text,"Delivery" text,"Purpose" text,"Yield" text) | SELECT "Purpose" FROM table_11763 WHERE "Name" = 'oak' |
what delegate is the same age as rita elizabeth meda cojul n | CREATE TABLE table_204_20 (id number,"represent" text,"contestant" text,"age" number,"height" text,"hometown" text) | SELECT "contestant" FROM table_204_20 WHERE "contestant" <> 'rita elizabeth meda cojulun' AND "age" = (SELECT "age" FROM table_204_20 WHERE "contestant" = 'rita elizabeth meda cojulun') |
Who is the opponent at america west arena? | CREATE TABLE table_14280 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text) | SELECT "Opponent" FROM table_14280 WHERE "Location" = 'america west arena' |
what is the number of patients whose gender is f and admission location is clinic referral/premature? | 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 WHERE demographic.gender = "F" AND demographic.admission_location = "CLINIC REFERRAL/PREMATURE" |
what is the number of days since patient 021-95970 was admitted to the hospital? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealths... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '021-95970' AND patient.hospitaldischargetime IS NULL |
How many perpetrators are there? | CREATE TABLE people (people_id number,name text,height number,weight number,home town text)CREATE TABLE perpetrator (perpetrator_id number,people_id number,date text,year number,location text,country text,killed number,injured number) | SELECT COUNT(*) FROM perpetrator |
Who was the opponent with a result of l 14 6? | CREATE TABLE table_name_6 (opponent VARCHAR,result VARCHAR) | SELECT opponent FROM table_name_6 WHERE result = "l 14–6" |
Name the upper index kcal/nm3 for 62.47 | CREATE TABLE table_22545 ("Fuel gas" text,"Upper index Kcal/ Nm 3" real,"Lower index Kcal/ Nm 3" real,"Upper index MJ/ Nm 3" text,"Lower index MJ/ Nm 3" text) | SELECT "Upper index Kcal/ Nm 3" FROM table_22545 WHERE "Lower index MJ/ Nm 3" = '62.47' |
How many silvers have more than 2 golds? | CREATE TABLE table_65826 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT COUNT("Silver") FROM table_65826 WHERE "Gold" > '2' |
Who is the operator when Roe was the bodybuilder? | CREATE TABLE table_3962 ("Operator" text,"Number purchased" real,"Variant" text,"Bodybuilder" text,"Year(s) purchased" text) | SELECT "Operator" FROM table_3962 WHERE "Bodybuilder" = 'Roe' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.