instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
How many countries were sampled in the index created by The Economist, published in 2007 and ranked 2nd in the LA Ranking? | CREATE TABLE table_19948664_1 (countries_sampled INTEGER,ranking_la__2_ VARCHAR,author___editor___source VARCHAR,year_of_publication VARCHAR) | SELECT MAX(countries_sampled) FROM table_19948664_1 WHERE author___editor___source = "The Economist" AND year_of_publication = "2007" AND ranking_la__2_ = "2nd" |
how many times did patient 002-62161 receive the -polys test in 2105? | 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 diagnosis... | SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-62161')) AND lab.labname = '-polys' AND STRFTIME('%y', lab.labresulttime) = '2105' |
how many patients died after having been diagnosed with hemorrhage within the same hospital visit until 1 year 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 t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ... |
What is the total time for one south broad? | CREATE TABLE table_name_79 (year INTEGER,name VARCHAR) | SELECT SUM(year) FROM table_name_79 WHERE name = "one south broad" |
in 08/last year, what organism was found in patient 031-23724's last blood, venipuncture test? | 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 microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23724')) AND microlab.culturesite = 'blood, venipuncture' AND DATETIM... |
Which To par has a Place of t2, and a Player of mark james? | CREATE TABLE table_62064 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "To par" FROM table_62064 WHERE "Place" = 't2' AND "Player" = 'mark james' |
What was the box score during a game that had a score of 86-96? | CREATE TABLE table_76724 ("Date" text,"Home team" text,"Score" text,"Away team" text,"Venue" text,"Box Score" text,"Report" text) | SELECT "Box Score" FROM table_76724 WHERE "Score" = '86-96' |
Who was the songwriter for Track 4, produced by nigel wright and john smits? | CREATE TABLE table_name_84 (songwriter_s_ VARCHAR,production_credits VARCHAR,track VARCHAR) | SELECT songwriter_s_ FROM table_name_84 WHERE production_credits = "nigel wright and john smits" AND track = 4 |
What club/province does the prop player with over 45 caps play for? | CREATE TABLE table_51556 ("Player" text,"Position" text,"Date of Birth (Age)" text,"Caps" real,"Club/province" text) | SELECT "Club/province" FROM table_51556 WHERE "Caps" > '45' AND "Position" = 'prop' |
What is the smallest electorate with 78,076 quota and less than 13 candidates? | CREATE TABLE table_35411 ("Constituency" text,"Electorate" real,"Turnout" text,"Spoilt" text,"Valid Poll" real,"Quota" text,"Seats" real,"Candidates" real) | SELECT MIN("Electorate") FROM table_35411 WHERE "Quota" = '78,076' AND "Candidates" < '13' |
Can you tell me the 2010 that has the 2008 of grand slam tournaments? | CREATE TABLE table_60383 ("Tournament" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"2013" text) | SELECT "2010" FROM table_60383 WHERE "2008" = 'grand slam tournaments' |
What was the surface when the opponent was sergiy stakhovsky mikhail youzhny? | CREATE TABLE table_62290 ("Outcome" text,"Date" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text) | SELECT "Surface" FROM table_62290 WHERE "Opponents" = 'sergiy stakhovsky mikhail youzhny' |
Which category was the berlin file up to win in 2013? | CREATE TABLE table_55137 ("Year" real,"Award" text,"Category" text,"Nominated work" text,"Result" text) | SELECT "Category" FROM table_55137 WHERE "Year" = '2013' AND "Nominated work" = 'the berlin file' |
For those products with a price between 60 and 120, return a bar chart about the distribution of name and code , and I want to rank by the x-axis in asc. | 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 Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name |
In what Event did Dorcus Inzikuru compete? | CREATE TABLE table_62586 ("Medal" text,"Name" text,"Games" text,"Sport" text,"Event" text) | SELECT "Event" FROM table_62586 WHERE "Name" = 'dorcus inzikuru' |
What nationality is Mark Hirth from Michigan State University (NCAA)? | CREATE TABLE table_name_24 (nationality VARCHAR,college_junior_club_team VARCHAR,player VARCHAR) | SELECT nationality FROM table_name_24 WHERE college_junior_club_team = "michigan state university (ncaa)" AND player = "mark hirth" |
What year was Mother's Live remix created? | CREATE TABLE table_name_46 (year INTEGER,version VARCHAR) | SELECT SUM(year) FROM table_name_46 WHERE version = "mother's live remix" |
count the number of patients whose lab test fluid is blood. | 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.fluid = "Blood" |
What is the average price of products with manufacturer codes equal to 2? | CREATE TABLE manufacturers (code number,name text,headquarter text,founder text,revenue number)CREATE TABLE products (code number,name text,price number,manufacturer number) | SELECT AVG(price) FROM products WHERE manufacturer = 2 |
Which regions had a production (bbl/day) of 1,213,000 (21st)? | CREATE TABLE table_20924 ("Country" text,"Region" text,"Joined OPEC" real,"Population (July 2012)" real,"Area (km\u00b2)" real,"Production (bbl /day)" text) | SELECT "Region" FROM table_20924 WHERE "Production ( bbl /day)" = '1,213,000 (21st)' |
Who had high assists in the game played at Oklahoma city arena 17,509? | CREATE TABLE table_3842 ("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_3842 WHERE "Location Attendance" = 'Oklahoma City Arena 17,509' |
Who is the writer of episode 13? | CREATE TABLE table_2226817_8 (written_by VARCHAR,no_in_season VARCHAR) | SELECT COUNT(written_by) FROM table_2226817_8 WHERE no_in_season = 13 |
What is the record of the Hartford Whalers home team with the April 13 game date? | CREATE TABLE table_35779 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Record" FROM table_35779 WHERE "Home" = 'hartford whalers' AND "Date" = 'april 13' |
What is the year founded for the team Dinos? | CREATE TABLE table_27599216_6 (founded INTEGER,team VARCHAR) | SELECT MAX(founded) FROM table_27599216_6 WHERE team = "Dinos" |
Who was the home team when FK kom were the guests? | CREATE TABLE table_name_84 (home VARCHAR,guest VARCHAR) | SELECT home FROM table_name_84 WHERE guest = "fk kom" |
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by weekday, order from low to high by the Y please. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE loc... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(DEPARTMENT_ID) |
When completing 182 laps, what was the qual.? | CREATE TABLE table_name_67 (qual VARCHAR,laps VARCHAR) | SELECT qual FROM table_name_67 WHERE laps = 182 |
what game was played on june 14 | CREATE TABLE table_34459 ("Date" text,"City" text,"Opponent" text,"Results\u00b9" text,"Type of game" text) | SELECT "Type of game" FROM table_34459 WHERE "Date" = 'june 14' |
what is the number of patients whose gender is f and admission type is newborn? | 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.gender = "F" AND demographic.admission_type = "NEWBORN" |
what is patient 42757's age during their first hospital visit? | CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE procedures_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,admission_location text,disc... | SELECT admissions.age FROM admissions WHERE admissions.subject_id = 42757 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 |
provide the number of patients whose admission location is clinic referral/premature and diagnoses short title is chr tot occlus cor artry? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.short_title = "Chr tot occlus cor artry" |
Which Electorate is from vic, a labor party, and is David Charles a member of? | CREATE TABLE table_name_6 (electorate VARCHAR,member VARCHAR,state VARCHAR,party VARCHAR) | SELECT electorate FROM table_name_6 WHERE state = "vic" AND party = "labor" AND member = "david charles" |
Who is the manager for the fc inter club? | CREATE TABLE table_29250534_1 (manager VARCHAR,club VARCHAR) | SELECT manager FROM table_29250534_1 WHERE club = "FC Inter" |
Show the title and publication dates of books. | CREATE TABLE book (Title VARCHAR,Book_ID VARCHAR)CREATE TABLE publication (Publication_Date VARCHAR,Book_ID VARCHAR) | SELECT T1.Title, T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID |
how many days have elapsed since patient 006-158338 had received an ph lab test for the first time in the current hospital encounter? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientun... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '006-158338' AND patient.hosp... |
am flights from ATLANTA to PHILADELPHIA | CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE month (month_number int,month_name te... | 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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILA... |
what were the four most frequently prescribed drugs to the patients aged 20s within 2 months after they had been diagnosed with diaphragmatic hernia until 1 year ago? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE transfers (row_id number,subject_id number,hadm_id numbe... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
Which Precincts has a G. Hager of 2,260 (15%)? | CREATE TABLE table_name_88 (precincts VARCHAR,g_hager VARCHAR) | SELECT precincts FROM table_name_88 WHERE g_hager = "2,260 (15%)" |
Who broadcasts in malaysia? | CREATE TABLE table_name_12 (broadcaster VARCHAR,territory VARCHAR) | SELECT broadcaster FROM table_name_12 WHERE territory = "malaysia" |
Which Position has a College of washington, and an Overall of 46? | CREATE TABLE table_name_18 (position VARCHAR,college VARCHAR,overall VARCHAR) | SELECT position FROM table_name_18 WHERE college = "washington" AND overall = 46 |
What CFL team obtained a draft pick from North Dakota who plays OL position? | CREATE TABLE table_25085059_1 (cfl_team VARCHAR,position VARCHAR,college VARCHAR) | SELECT cfl_team FROM table_25085059_1 WHERE position = "OL" AND college = "North Dakota" |
Find the average number of followers for the users who do not have any tweet. | CREATE TABLE tweets (followers INTEGER,UID VARCHAR)CREATE TABLE user_profiles (followers INTEGER,UID VARCHAR) | SELECT AVG(followers) FROM user_profiles WHERE NOT UID IN (SELECT UID FROM tweets) |
provide me the number of patients taking base type drug prescription who have diagnoses icd9 code 28860. | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "28860" AND prescriptions.drug_type = "BASE" |
Name the men's doubles for 2010 | CREATE TABLE table_38971 ("Year" text,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text) | SELECT "Men's doubles" FROM table_38971 WHERE "Year" = '2010' |
What is the home team of Lake Oval? | CREATE TABLE table_name_21 (home_team VARCHAR,venue VARCHAR) | SELECT home_team FROM table_name_21 WHERE venue = "lake oval" |
Show me a bar chart for how many faculty members do we have for each faculty rank? | CREATE TABLE Faculty_Participates_in (FacID 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 Activity (actid INTEGER,activity_name varchar(25))CREATE TABLE Participates_in (stuid INTEG... | SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank |
For each submission, group its acceptance result and count them Visualize them in a bar chart, and could you order by the Y in desc? | CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text)CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text) | SELECT Result, COUNT(Result) FROM Acceptance GROUP BY Result ORDER BY COUNT(Result) DESC |
Give me the comparison about School_ID over the Team_Name . | 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 Team_Name, School_ID FROM basketball_match |
Who has an away team score of 2.2 (14)? | CREATE TABLE table_57415 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Date" text) | SELECT "Home team" FROM table_57415 WHERE "Away team score" = '2.2 (14)' |
What is the lowest numbered hydroelectric power when the renewable electricity demand is 21.5%? | CREATE TABLE table_18843 ("Autonomous Community" text,"Hydroelectric power" real,"Wind power" real,"Solar power" real,"Biomass power" real,"Solid waste power" real,"Total Renewable Generation" real,"Total Electricity Demand" real,"% Renewable of Total Electricity Demand" text) | SELECT MIN("Hydroelectric power") FROM table_18843 WHERE "% Renewable of Total Electricity Demand" = '21.5%' |
what is drug route of drug name influenza virus vaccine? | 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 prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Influenza Virus Vaccine" |
Where did Richmond play as the away team? | CREATE TABLE table_name_51 (venue VARCHAR,away_team VARCHAR) | SELECT venue FROM table_name_51 WHERE away_team = "richmond" |
How many teams did inge 6 have the high assists with? | CREATE TABLE table_31459 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT COUNT("Team") FROM table_31459 WHERE "High assists" = 'Inge – 6' |
what is the number of patients whose ethnicity is black/haitian and drug name is fentanyl citrate? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND prescriptions.drug = "Fentanyl Citrate" |
how many total laps did alex figge complete ? | CREATE TABLE table_203_761 (id number,"pos" number,"no" number,"driver" text,"team" text,"laps" number,"time/retired" text,"grid" number,"points" number) | SELECT "laps" FROM table_203_761 WHERE "driver" = 'alex figge' |
what is discharge location of subject id 6983? | 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 demographic.discharge_location FROM demographic WHERE demographic.subject_id = "6983" |
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, and display from low to high by the y axis. | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE regions (REGIO... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY) |
Type the record details if any result has L 3-6 in it? | CREATE TABLE table_19502 ("Week" real,"Opponent" text,"Result" text,"Stadium" text,"Record" text,"Attendance" real) | SELECT "Record" FROM table_19502 WHERE "Result" = 'L 3-6' |
Number of times that questions have gone through the Reopen review queue. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLi... | SELECT ReviewTasks.PostId AS "post_link", COUNT(*) AS NumberOfReviews, Posts.CreationDate FROM ReviewTasks JOIN Posts ON ReviewTasks.PostId = Posts.Id WHERE ReviewTasks.ReviewTaskTypeId = 6 GROUP BY ReviewTasks.PostId, Posts.CreationDate ORDER BY NumberOfReviews DESC |
show all nonstop flights from BOSTON to SAN FRANCISCO | CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,we... | 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 = 'SAN FR... |
What is the Year of the Coin with an Issue Price of $1089.95 and Mintage less than 900? | CREATE TABLE table_79104 ("Year" real,"Theme" text,"Face Value" text,"Weight" text,"Diameter" text,"Mintage" real,"Issue Price" text) | SELECT SUM("Year") FROM table_79104 WHERE "Issue Price" = '$1089.95' AND "Mintage" < '900' |
Get the number of patients who had a creatine kinase mb isoenzyme lab test that are taking a base type drug. | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "BASE" AND lab.label = "Creatine Kinase, MB Isoenzyme" |
what are the top five most common output events since 5 years ago? | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE 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 n... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 5) |
Name the overall nt points for 2nd m 127.5 | CREATE TABLE table_23649 ("Rank" real,"Name" text,"Nationality" text,"1st (m)" text,"2nd (m)" text,"Points" text,"Overall NT points" text,"Overall WC points (Rank)" text) | SELECT "Overall NT points" FROM table_23649 WHERE "2nd (m)" = '127.5' |
How many different PPI does the model with ppcm of 87 have? | CREATE TABLE table_29703 ("Model" text,"PPI (pixels per inch)" real,"ppcm (pixels per cm)" real,"Resolution" text,"Typical viewing distance (in/cm)" text,"Pixels per degree (PPD)" real) | SELECT COUNT("PPI (pixels per inch )") FROM table_29703 WHERE "ppcm (pixels per cm )" = '87' |
when was the last time patient 009-2181 had a stool output since 218 days ago? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemic... | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-2181')) AND intakeoutput.cellpath LIKE '%output%'... |
with shares of 45.3% and total seats less than 166. what is the greatest number of seat? | CREATE TABLE table_51791 ("Election" text,"D\u00e1il" text,"Share of votes" text,"Seats" real,"Total seats" real) | SELECT MAX("Seats") FROM table_51791 WHERE "Share of votes" = '45.3%' AND "Total seats" < '166' |
What's the title of the episode written by Harry Winkler? | CREATE TABLE table_2342078_5 (title VARCHAR,written_by VARCHAR) | SELECT title FROM table_2342078_5 WHERE written_by = "Harry Winkler" |
how many patients whose admission type is emergency and admission year is less than 2164? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admityear < "2164" |
What are the maximum and minimum population of the counties? | CREATE TABLE county (county_id number,county_name text,population number,zip_code text)CREATE TABLE election (election_id number,counties_represented text,district number,delegate text,party number,first_elected number,committee text)CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_go... | SELECT MAX(population), MIN(population) FROM county |
What is the data limit for vodafone? | CREATE TABLE table_name_8 (data_limit__gb VARCHAR,company VARCHAR) | SELECT data_limit__gb FROM table_name_8 WHERE company = "vodafone" |
what is the number of patients whose discharge location is short term hospital and procedure long title is intravenous infusion of clofarabine? | 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.discharge_location = "SHORT TERM HOSPITAL" AND procedures.long_title = "Intravenous infusion of clofarabine" |
Who had the most rebounds in the game against Chicago? | CREATE TABLE table_50146 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High rebounds" FROM table_50146 WHERE "Team" = 'chicago' |
What is Method, when Time is '3:20'? | CREATE TABLE table_name_40 (method VARCHAR,time VARCHAR) | SELECT method FROM table_name_40 WHERE time = "3:20" |
What was the team that held the race title of Mallala? | CREATE TABLE table_52276 ("Race Title" text,"Circuit" text,"City / State" text,"Date" text,"Winner" text,"Team" text) | SELECT "Team" FROM table_52276 WHERE "Race Title" = 'mallala' |
Name the No. 5 which has a No. 8 of logan, and a No. 10 of ethan, and a No. 4 of jacob? | CREATE TABLE table_43791 ("Region (year)" text,"No. 1" text,"No. 2" text,"No. 3" text,"No. 4" text,"No. 5" text,"No. 6" text,"No. 7" text,"No. 8" text,"No. 9" text,"No. 10" text) | SELECT "No. 5" FROM table_43791 WHERE "No. 8" = 'logan' AND "No. 10" = 'ethan' AND "No. 4" = 'jacob' |
Name the record for score of l 93 104 (ot) | CREATE TABLE table_17288825_8 (record VARCHAR,score VARCHAR) | SELECT record FROM table_17288825_8 WHERE score = "L 93–104 (OT)" |
what number of hours has passed since patient 018-20179 was admitted to the hospital? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientu... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '018-20179' AND patient.hospitaldischargetime IS NULL |
What is NK Rijeka's away score in Round 2? | CREATE TABLE table_5968 ("Round" real,"Club" text,"Home" text,"Away" text,"Aggregate" text) | SELECT "Away" FROM table_5968 WHERE "Round" < '2' AND "Club" = 'nk rijeka' |
Which platform was Red Dead Redemption for? | CREATE TABLE table_66449 ("Year" real,"Game" text,"Genre" text,"Platform(s)" text,"Developer(s)" text) | SELECT "Platform(s)" FROM table_66449 WHERE "Game" = 'red dead redemption' |
what is the status for seed 14 | CREATE TABLE table_29572583_20 (status VARCHAR,seed VARCHAR) | SELECT status FROM table_29572583_20 WHERE seed = 14 |
what is the number of ranked teams georgia played in 2006 ? | CREATE TABLE table_203_809 (id number,"date" text,"time" text,"opponent#" text,"rank#" text,"site" text,"tv" text,"result" text,"attendance" number) | SELECT COUNT(*) FROM table_203_809 WHERE NOT "rank#" IS NULL |
What is the number of tries for the player who is larger than 16? | CREATE TABLE table_4693 ("Played" real,"Lost" real,"Drawn" real,"Tries" real,"Points" real,"% Won" real) | SELECT SUM("Tries") FROM table_4693 WHERE "Played" > '16' |
What is the pinyin name for the english name xin county? | CREATE TABLE table_2847477_2 (pinyin VARCHAR,english_name VARCHAR) | SELECT pinyin FROM table_2847477_2 WHERE english_name = "Xin County" |
when was the last hospital admission time that patient 022-166510 was admitted through an acute care/floor 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 patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '022-166510' AND patient.hospitaladmitsource = 'acute care/floor' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
the number of patients who have been admitted to hospital in 2102. | 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 diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE STRFTIME('%y', patient.hospitaladmittime) = '2102' |
Get the list of patients diagnosed with personal history of malignant neoplasm of bladder who have a prescription for base type drug. | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hx of bladder malignancy" AND prescriptions.drug_type = "BASE" |
Return a bar chart about the number of counties for all appellations?, and could you display in ascending by the Y? | CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT) | SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County) |
What are the number of the last names for all scholarship students?, and show in ascending by the x-axis. | CREATE TABLE SportsInfo (StuID INTEGER,SportName VARCHAR(32),HoursPerWeek INTEGER,GamesPlayed INTEGER,OnScholarship VARCHAR(1))CREATE TABLE Plays_Games (StuID INTEGER,GameID INTEGER,Hours_Played INTEGER)CREATE TABLE Video_Games (GameID INTEGER,GName VARCHAR(40),GType VARCHAR(40))CREATE TABLE Student (StuID INTEGER,LNam... | SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY LName |
what is the total enteral tubefeed dose that patient 016-6134 had received until 03/22/2103? | 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 patient (... | SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-6134')) AND intakeoutput.celllabel = 'entera... |
For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the amount of headquarter , and group by attribute headquarter in a bar chart, I want to order total number in desc order. | 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 Headquarter, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY COUNT(Headquarter) DESC |
Which Local name has a Network of nova tv? | CREATE TABLE table_40039 ("Country" text,"Local name" text,"Host" text,"Network" text,"Date premiered" text) | SELECT "Local name" FROM table_40039 WHERE "Network" = 'nova tv' |
What is the highest Losses, when Wins is greater than 1, and when Last Appearance is 2003? | CREATE TABLE table_name_88 (losses INTEGER,wins VARCHAR,last_appearance VARCHAR) | SELECT MAX(losses) FROM table_name_88 WHERE wins > 1 AND last_appearance = "2003" |
What is the production number for the episode called 'Random on Purpose'? | CREATE TABLE table_29540 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Prod. No." real,"Viewers (millions)" text) | SELECT "Prod. No." FROM table_29540 WHERE "Title" = 'Random on Purpose' |
count the number of patients whose marital status is divorced and lab test name is lactate dehydrogenase (ld)? | 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 demographic.marital_status = "DIVORCED" AND lab.label = "Lactate Dehydrogenase (LD)" |
What is Release Date, when Title is Aladdin Time? | CREATE TABLE table_8881 ("Title" text,"Writer" text,"Doctor" text,"Format" text,"Company" text,"release date" text) | SELECT "release date" FROM table_8881 WHERE "Title" = 'aladdin time' |
Tell me the time/retired for Laps larger than 63 and has a grid of 20 | CREATE TABLE table_name_97 (time_retired VARCHAR,laps VARCHAR,grid VARCHAR) | SELECT time_retired FROM table_name_97 WHERE laps > 63 AND grid = 20 |
What was the score that has a To par of 3, for Branden Grace? | CREATE TABLE table_13482 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text) | SELECT "Score" FROM table_13482 WHERE "To par" = '−3' AND "Player" = 'branden grace' |
calculate the length of the hospital stay of patient 013-12480's first intensive care unit stay. | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsy... | SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-12480') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
What are the top 10 states that have the highest average math score and federal revenue they got through different categories? | CREATE TABLE finrev_fed_17 (state_code number,idcensus number,school_district text,nces_id text,yr_data number,t_fed_rev number,c14 number,c25 number)CREATE TABLE finrev_fed_key_17 (state_code number,state text,#_records text)CREATE TABLE ndecoreexcel_math_grade8 (year number,state text,all_students text,average_scale_... | SELECT T2.state, SUM(c14), SUM(c25) FROM finrev_fed_17 AS T1 JOIN finrev_fed_key_17 AS T2 ON T1.state_code = T2.state_code JOIN ndecoreexcel_math_grade8 AS T3 ON T2.state = T3.state GROUP BY T2.state ORDER BY T3.average_scale_score DESC LIMIT 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.