instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Which game was played on march 2?
CREATE TABLE table_name_4 (game INTEGER,date VARCHAR)
SELECT AVG(game) FROM table_name_4 WHERE date = "march 2"
What is the played number when the points against is 179?
CREATE TABLE table_name_78 (played VARCHAR,points_against VARCHAR)
SELECT played FROM table_name_78 WHERE points_against = "179"
What was the total number of games where A. Johnson (6) gave the most high assists?
CREATE TABLE table_11961582_4 (game VARCHAR,high_assists VARCHAR)
SELECT COUNT(game) FROM table_11961582_4 WHERE high_assists = "A. Johnson (6)"
Name the young rider classification with laudelino cubino
CREATE TABLE table_17568 ("Stage" text,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Young rider classification" text,"Trofeo Fast Team" text)
SELECT "Young rider classification" FROM table_17568 WHERE "Winner" = 'Laudelino Cubino'
How long did Witold Latoszek character lasted?
CREATE TABLE table_name_53 (duration VARCHAR,character VARCHAR)
SELECT duration FROM table_name_53 WHERE character = "witold latoszek"
For those records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the average of code , and group by attribute headquarter, and rank Y-axis in ascending 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 T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code
What is the original air date of the episode with a production code of 105?
CREATE TABLE table_22815870_1 (original_air_date VARCHAR,prod_code VARCHAR)
SELECT original_air_date FROM table_22815870_1 WHERE prod_code = 105
how many patients aged below 43 year with joint fluid as the lab test fluid?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "43" AND lab.fluid = "Joint Fluid"
Who was the visitor in the game that led to a 39-20-6 record?
CREATE TABLE table_name_96 (visitor VARCHAR,record VARCHAR)
SELECT visitor FROM table_name_96 WHERE record = "39-20-6"
provide the number of patients whose diagnoses long title is obesity, unspecified and drug route is pr?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
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.long_title = "Obesity, unspecified" AND prescriptions.route = "PR"
What are the name and the nationality of the host of the highest age?
CREATE TABLE host (host_id number,name text,nationality text,age text)CREATE TABLE party_host (party_id number,host_id number,is_main_in_charge others)CREATE TABLE party (party_id number,party_theme text,location text,first_year text,last_year text,number_of_hosts number)
SELECT name, nationality FROM host ORDER BY age DESC LIMIT 1
count the number of patients whose death status is 1 and diagnoses long title is tietze's disease?
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 WHERE demographic.expire_flag = "1" AND diagnoses.long_title = "Tietze's disease"
What was the Date of the Cimmeria Issue for which the Penciller was Tom s Giorello?
CREATE TABLE table_name_67 (date VARCHAR,penciller VARCHAR,title VARCHAR)
SELECT date FROM table_name_67 WHERE penciller = "tomás giorello" AND title = "cimmeria"
In what Week was the Attendance 43,430?
CREATE TABLE table_48584 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MAX("Week") FROM table_48584 WHERE "Attendance" = '43,430'
Total Closed, Total Questions, ratio.
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 ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Review...
SELECT COUNT(*) AS TotalQuestions, (SELECT COUNT(*) AS TotalClosed FROM Posts AS C WHERE C.OwnerUserId = P.OwnerUserId AND ClosedDate != '' AND PostTypeId = 1) AS TotalClosed, (SELECT COUNT(*) AS TotalClosed FROM Posts AS C WHERE C.OwnerUserId = P.OwnerUserId AND ClosedDate != '' AND PostTypeId = 1) * 100.0 / COUNT(*) ...
If the event number is 5, what is the winner total number?
CREATE TABLE table_2534387_11 (winner VARCHAR,event__number VARCHAR)
SELECT COUNT(winner) FROM table_2534387_11 WHERE event__number = 5
Why did Geninho leave as manager?
CREATE TABLE table_74382 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Position in table" text,"Replaced by" text,"Date of appointment" text)
SELECT "Manner of departure" FROM table_74382 WHERE "Outgoing manager" = 'Geninho'
What was the date of the game against Kansas City Chiefs?
CREATE TABLE table_18023 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text,"Attendance" real)
SELECT "Date" FROM table_18023 WHERE "Opponent" = 'Kansas City Chiefs'
What was the new WNBA team of the player selected with a pick over 7?
CREATE TABLE table_name_52 (new_wnba_team VARCHAR,pick INTEGER)
SELECT new_wnba_team FROM table_name_52 WHERE pick > 7
count the number of patients whose diagnosis short title is malnutrition mild degree and lab test fluid is urine.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malnutrition mild degree" AND lab.fluid = "Urine"
Which Thumb stick has a Wrist pad of no, and a Supplier of sharkoon?
CREATE TABLE table_66744 ("Supplier" text,"Basic shape" text,"Keys (x modes)" text,"Wrist pad" text,"Thumb stick" text,"Backlit" text)
SELECT "Thumb stick" FROM table_66744 WHERE "Wrist pad" = 'no' AND "Supplier" = 'sharkoon'
Name th D 43 when R 51 + is r 30
CREATE TABLE table_52013 ("D 40 \u221a" text,"D 41 \u221a" text,"D 42 \u221a" text,"D 43 \u221a" text,"D 44 \u221a" text,"D 45 O" text,"D 46 O" text,"R 53 +" text,"R 52 +" text,"R 51 +" text)
SELECT "D 43 \u221a" FROM table_52013 WHERE "R 51 +" = 'r 30'
give me the number of patients whose primary disease is sternal wound infection and year of death is less than or equal to 2173?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STERNAL WOUND INFECTION" AND demographic.dod_year <= "2173.0"
What number(s) in the series was written by bo crese?
CREATE TABLE table_73975 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (millions)" text)
SELECT "No. in series" FROM table_73975 WHERE "Written by" = 'Bo Crese'
How many times is the player scott deibert?
CREATE TABLE table_49150 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text)
SELECT COUNT("Pick #") FROM table_49150 WHERE "Player" = 'scott deibert'
What player had the position guard/forward?
CREATE TABLE table_56710 ("Player" text,"Nationality" text,"Position" text,"Years for Jazz" text,"School/Club Team" text)
SELECT "Player" FROM table_56710 WHERE "Position" = 'guard/forward'
What is the name of the school where the year of last win is 1985-86?
CREATE TABLE table_72520 ("School" text,"Winners" real,"Finalists" real,"Total Finals" real,"Year of last win" text)
SELECT "School" FROM table_72520 WHERE "Year of last win" = '1985-86'
Bin the hire date of employees into Month interval and count them for visualizing a bar chart, list by the how many hire date from low to high.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE departments (DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees ORDER BY COUNT(HIRE_DATE)
who is the constructor when the laps is less than 68, the grid is more than 20 and the driver is thierry boutsen?
CREATE TABLE table_name_62 (constructor VARCHAR,driver VARCHAR,laps VARCHAR,grid VARCHAR)
SELECT constructor FROM table_name_62 WHERE laps < 68 AND grid > 20 AND driver = "thierry boutsen"
What is the smallest grid for a time/retired of 1:56:18.22?
CREATE TABLE table_56289 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MIN("Grid") FROM table_56289 WHERE "Time/Retired" = '1:56:18.22'
how long was the last of patient 82159's stay in the hospital?
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,admission_location text,discharge_location text,insurance text,language text,marital_status t...
SELECT STRFTIME('%j', admissions.dischtime) - STRFTIME('%j', admissions.admittime) FROM admissions WHERE admissions.subject_id = 82159 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
What are the cities that do not have any branches with more than 100 members?
CREATE TABLE membership_register_branch (member_id number,branch_id text,register_year text)CREATE TABLE branch (branch_id number,name text,open_year text,address_road text,city text,membership_amount text)CREATE TABLE purchase (member_id number,branch_id text,year text,total_pounds number)CREATE TABLE member (member_i...
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
I want to know the tournament that has a third place of magnus gustafsson
CREATE TABLE table_53829 ("Tournament" text,"Winner" text,"Runner-up" text,"Score" text,"Third Place" text)
SELECT "Tournament" FROM table_53829 WHERE "Third Place" = 'magnus gustafsson'
Which Position has a Player of bernard thompson?
CREATE TABLE table_8854 ("Pick" real,"Player" text,"Position" text,"Nationality" text,"Former Team" text)
SELECT "Position" FROM table_8854 WHERE "Player" = 'bernard thompson'
how many patients with abnormal lab test status have diagnoses of hypertensive heart disease with heart failure?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Hyp ht dis NOS w ht fail" AND lab.flag = "abnormal"
What is the largest crowd with Home team of hawthorn?
CREATE TABLE table_name_62 (crowd INTEGER,home_team VARCHAR)
SELECT MAX(crowd) FROM table_name_62 WHERE home_team = "hawthorn"
heart rate > 100 / minute
CREATE TABLE table_test_10 ("id" int,"left_ventricular_ejection_fraction_lvef" int,"systolic_blood_pressure_sbp" int,"immunosuppressive_disease" bool,"systolic_arterial_pressure_sap" int,"lymphomas" bool,"left_ventricular_dysfunction" bool,"tissue_hypoperfusion" bool,"heart_disease" bool,"renal_disease" bool,"positive_...
SELECT * FROM table_test_10 WHERE heart_rate > 100
what were the new drugs prescribed to patient 006-2586 today compared to what was prescribed yesterday?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid num...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '006-2586') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medicat...
For those records from the products and each product's manufacturer, give me the comparison about the sum of manufacturer over the name , and group by attribute name by a bar chart, could you show in desc by the y-axis?
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, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Manufacturer DESC
List document type codes and the number of documents in each code in a pie chart.
CREATE TABLE Documents_with_Expenses (Document_ID INTEGER,Budget_Type_Code CHAR(15),Document_Details VARCHAR(255))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))CREA...
SELECT Document_Type_Code, COUNT(*) FROM Documents GROUP BY Document_Type_Code
Which long range AM station has the lowest frequency and includes a webcast of listen live, was licensed in the city of Monterrey, and uses the Callsign of xet?
CREATE TABLE table_36237 ("Frequency" real,"Callsign" text,"Brand" text,"City of License" text,"Website" text,"Webcast" text)
SELECT MIN("Frequency") FROM table_36237 WHERE "Webcast" = 'listen live' AND "City of License" = 'monterrey' AND "Callsign" = 'xet'
What is the lowest height in feet for the building located in platz der einheit 1, gallus, that was built after 1961 with a height less than 130 meters?
CREATE TABLE table_47885 ("Name" text,"Height (m)" real,"Height (ft)" real,"Location" text,"Year built" real)
SELECT MIN("Height (ft)") FROM table_47885 WHERE "Year built" > '1961' AND "Location" = 'platz der einheit 1, gallus' AND "Height (m)" < '130'
Which Tournament was on the Date 6 Sep 2009?
CREATE TABLE table_53823 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Tournament" FROM table_53823 WHERE "Date" = '6 sep 2009'
Name the report on 20 may
CREATE TABLE table_name_98 (report VARCHAR,date VARCHAR)
SELECT report FROM table_name_98 WHERE date = "20 may"
What is the sum of all domestic passengers with 10.9% change and less than 4,022 tonnes in freight?
CREATE TABLE table_6268 ("Rank" real,"Airport" text,"Total Passengers" real,"% Change 2005/2006" text,"International Passengers" real,"Domestic Passengers" real,"Transit Passengers" real,"Aircraft Movements" real,"Freight (Metric Tonnes)" real)
SELECT SUM("Domestic Passengers") FROM table_6268 WHERE "% Change 2005/2006" = '10.9%' AND "Freight (Metric Tonnes)" < '4,022'
Show the number of courses each instructor taught in a bar chart, and order in descending by the names please.
CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20)...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY EMP_FNAME ORDER BY EMP_FNAME DESC
what are the four most frequent procedure that patients have received during the same month after they have received a non-invasive mech vent procedure?
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 t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi...
Show how many delegates in each party with a bar chart.
CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text...
SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party
I wan the date of vacancy for departure of resigned and outgoing manager of gordon wylde
CREATE TABLE table_name_22 (date_of_vacancy VARCHAR,manner_of_departure VARCHAR,outgoing_manager VARCHAR)
SELECT date_of_vacancy FROM table_name_22 WHERE manner_of_departure = "resigned" AND outgoing_manager = "gordon wylde"
give me the number of patients whose marital status is widowed and item id is 50911?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.itemid = "50911"
how many hours have passed since patient 012-66291 was last given a endotracheal tube during this hospital visit?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweigh...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66291...
What's the name of MKD?
CREATE TABLE table_49585 ("Nat." text,"Name" text,"Moving to" text,"Type" text,"Transfer window" text,"Transfer fee" text,"Source" text)
SELECT "Name" FROM table_49585 WHERE "Nat." = 'mkd'
Get all your comment with links, texts, dates and scores.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName ...
SELECT Score, CreationDate, Id AS "comment_link", Text FROM Comments WHERE UserId = @UserId ORDER BY CreationDate DESC
what is the full name and id of the college with the largest number of baseball players?
CREATE TABLE fielding_postseason (player_id text,year number,team_id text,league_id text,round text,pos text,g number,gs number,inn_outs number,po number,a number,e number,dp number,tp number,pb number,sb number,cs number)CREATE TABLE pitching_postseason (player_id text,year number,round text,team_id text,league_id tex...
SELECT T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC LIMIT 1
What is the Loco Nos of the e3 class?
CREATE TABLE table_name_80 (loco_nos VARCHAR,class VARCHAR)
SELECT loco_nos FROM table_name_80 WHERE class = "e3"
What is the total number of rounds at 5:36?
CREATE TABLE table_49387 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text)
SELECT COUNT("Round") FROM table_49387 WHERE "Time" = '5:36'
tell me the total amount of output amt-blake drain c that patient 002-17348 was producing until 1824 days ago.
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 microlab (microlabid number,patientunitstayid number,culturesite text,orga...
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 = '002-17348')) AND intakeoutput.celllabel = 'outpu...
How many restaurant are there in the Hazelwood district of Dallas ?
CREATE TABLE checkin (cid int,business_id varchar,count int,day varchar)CREATE TABLE tip (tip_id int,business_id varchar,text longtext,user_id varchar,likes int,year int,month varchar)CREATE TABLE review (rid int,business_id varchar,user_id varchar,rating float,text longtext,year int,month varchar)CREATE TABLE category...
SELECT COUNT(DISTINCT (business.name)) FROM business, category, neighborhood WHERE business.city = 'Dallas' AND category.business_id = business.business_id AND category.category_name = 'restaurant' AND neighborhood.business_id = business.business_id AND neighborhood.neighborhood_name = 'Hazelwood'
How many Episode Counts have an Actor of liz carr?
CREATE TABLE table_38413 ("Character" text,"Actor" text,"Years" text,"Series" text,"Episode Count" real)
SELECT COUNT("Episode Count") FROM table_38413 WHERE "Actor" = 'liz carr'
How many games has each stadium held?
CREATE TABLE stadium (id number,name text,home_games number,average_attendance number,total_attendance number,capacity_percentage number)CREATE TABLE injury_accident (game_id number,id number,player text,injury text,number_of_matches text,source text)CREATE TABLE game (stadium_id number,id number,season number,date tex...
SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id
What is the highest series number of the episode 'Til Death do us part-and make it soon'?
CREATE TABLE table_26400 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text)
SELECT MAX("Series #") FROM table_26400 WHERE "Title" = 'Til Death Do Us Part-And Make It Soon'
what were the three most frequent drugs that were prescribed to the patients aged 30s in a year before after they were diagnosed with other pulmonary insuff within 2 months?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_icd_procedures...
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 ...
What day is richmond the away side?
CREATE TABLE table_name_71 (date VARCHAR,away_team VARCHAR)
SELECT date FROM table_name_71 WHERE away_team = "richmond"
On what Date is Tie no 19?
CREATE TABLE table_name_36 (date VARCHAR,tie_no VARCHAR)
SELECT date FROM table_name_36 WHERE tie_no = "19"
how many notes were read by reader varma, idria indira varma?
CREATE TABLE table_20174050_23 (notes VARCHAR,reader VARCHAR)
SELECT COUNT(notes) FROM table_20174050_23 WHERE reader = "Varma, Idria Indira Varma"
When was the school in Philadelphia, Pennsylvania founded?
CREATE TABLE table_23159 ("Institution" text,"Nickname" text,"Location" text,"Founded" real,"Type" text,"Enrollment" real,"Joined" real,"Left" real,"Current Conference" text)
SELECT "Founded" FROM table_23159 WHERE "Location" = 'Philadelphia, Pennsylvania'
What place did R. Wenzel, who was active after 1934, have?
CREATE TABLE table_name_7 (place INTEGER,name VARCHAR,until VARCHAR)
SELECT SUM(place) FROM table_name_7 WHERE name = "r. wenzel" AND until > 1934
What is the lowest average that has a swimsuit less than 8.966, for west virginia and an evening gown less than 8.711?
CREATE TABLE table_name_15 (average INTEGER,evening_gown VARCHAR,swimsuit VARCHAR,state VARCHAR)
SELECT MIN(average) FROM table_name_15 WHERE swimsuit < 8.966 AND state = "west virginia" AND evening_gown < 8.711
what is primary disease and procedure icd9 code of subject id 18480?
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.diagnosis, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "18480"
Tag Similarity by common occurance.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName te...
SELECT COUNT(t1.PostId) AS count_match, t1.TagId, tag1.TagName, tag1.Count, t2.TagId, tag2.TagName, tag2.Count FROM PostTags AS t1 INNER JOIN PostTags AS t2 ON t1.PostId = t2.PostId INNER JOIN Tags AS tag1 ON tag1.Id = t1.TagId INNER JOIN Tags AS tag2 ON tag2.Id = t2.TagId INNER JOIN Posts ON t1.PostId = Posts.Id WHERE...
Which is the first paper by richard bellman ?
CREATE TABLE venue (venueid int,venuename varchar)CREATE TABLE author (authorid int,authorname varchar)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABLE field (fieldid int)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE ...
SELECT DISTINCT paper.paperid, paper.year FROM author, paper, writes WHERE author.authorname = 'richard bellman' AND paper.year = (SELECT MIN(PAPERalias1.year) FROM author AS AUTHORalias1, paper AS PAPERalias1, writes AS WRITESalias1 WHERE AUTHORalias1.authorname = 'richard bellman' AND WRITESalias1.authorid = AUTHORal...
How many students play each sport Show bar chart, and sort from high to low by the Y.
CREATE TABLE Video_Games (GameID INTEGER,GName VARCHAR(40),GType VARCHAR(40))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 Student (StuID INTEGER,LNam...
SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName ORDER BY COUNT(*) DESC
which polling firm was the only poll done in 2008 ?
CREATE TABLE table_203_43 (id number,"polling firm" text,"month" text,"link" text,"favor" number,"oppose" number)
SELECT "polling firm" FROM table_203_43 WHERE "month" = 2008
What is the smallest ansi code?
CREATE TABLE table_22475 ("Township" text,"County" text,"Pop. (2010)" real,"Land (sqmi)" text,"Water (sqmi)" text,"Latitude" text,"Longitude" text,"GEO ID" real,"ANSI code" real)
SELECT MIN("ANSI code") FROM table_22475
has patient 021-95970 had any allergies in 2105?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism tex...
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-95970')) AND STRFTIME('%y', allergy.allergytime) = '2105'
What is the area of the province with a density of 533.59?
CREATE TABLE table_254234_1 (area³ INTEGER,density² VARCHAR)
SELECT MAX(area³) FROM table_254234_1 WHERE density² = "533.59"
Who is the original artist for the theme 'Year they were born?
CREATE TABLE table_1334 ("Week #" text,"Theme" text,"Song choice" text,"Original artist" text,"Order #" text,"Result" text)
SELECT "Original artist" FROM table_1334 WHERE "Theme" = 'Year They Were Born'
count the number of patients diagnosed under icd9 code 57450.
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 diagnoses.icd9_code = "57450"
For each film, return the number of cinemas showing that fim in a bar chart, and display by the X-axis in descending.
CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price...
SELECT Title, COUNT(Title) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Title ORDER BY Title DESC
what is the difference in the nearest current distance and farthest current distance ?
CREATE TABLE table_203_56 (id number,"star" text,"start\nyear" number,"end\nyear" number,"maximum\nyear" number,"maximum\nmagnitude" number,"distance at\nmaximum (ly)" number,"current\ndistance" number,"current\nmagnitude" number)
SELECT MAX("current\ndistance") - MIN("current\ndistance") FROM table_203_56
Show me a bar chart for what is the total rating of channel for each channel owner?, and I want to list by the sum rating in percent in desc.
CREATE TABLE broadcast (Channel_ID int,Program_ID int,Time_of_day text)CREATE TABLE broadcast_share (Channel_ID int,Program_ID int,Date text,Share_in_percent real)CREATE TABLE program (Program_ID int,Name text,Origin text,Launch real,Owner text)CREATE TABLE channel (Channel_ID int,Name text,Owner text,Share_in_percent ...
SELECT Owner, SUM(Rating_in_percent) FROM channel GROUP BY Owner ORDER BY SUM(Rating_in_percent) DESC
What day was the result a win, the score 2-1, and the year before 2012?
CREATE TABLE table_name_7 (date VARCHAR,year VARCHAR,result VARCHAR,score VARCHAR)
SELECT date FROM table_name_7 WHERE result = "win" AND score = "2-1" AND year < 2012
Users with sufficient score for a tag badge - missing number of answers.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text...
WITH scorestags_cte AS (SELECT pt.TagId AS TagId, p.OwnerUserId AS uid, p.OwnerDisplayName AS udn, SUM(p.Score) AS sco, COUNT(p.Id) AS num FROM Posts AS p INNER JOIN Posts AS q ON q.Id = p.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId WHERE (p.CommunityOwnedDate IS NULL) GROUP BY pt.TagId, p.OwnerUserId, p.Own...
WHAT POSITION DOES THE PLAYER FROM SOUTH POINTE HIGH SCHOOL PLAY?
CREATE TABLE table_11677691_2 (position VARCHAR,school VARCHAR)
SELECT position FROM table_11677691_2 WHERE school = "South Pointe High school"
Who manufactured the vehicle that was withdrawn in 1927?
CREATE TABLE table_name_52 (manufacturer VARCHAR,year_withdrawn VARCHAR)
SELECT manufacturer FROM table_name_52 WHERE year_withdrawn = 1927
What was the week 2 prior to the when Brittany Alyse was week 3?
CREATE TABLE table_60709 ("Week 1" text,"Week 2" text,"Week 3" text,"Week 4" text,"Week 5" text)
SELECT "Week 2" FROM table_60709 WHERE "Week 3" = 'brittany alyse'
which couple was the chumps the same amount of times as chantelle and steve ?
CREATE TABLE table_204_269 (id number,"week" number,"room" text,"winning couple" text,"2nd couple" text,"3rd couple" text,"chumps" text)
SELECT "chumps" FROM table_204_269 WHERE "chumps" <> 'chantelle and steve' GROUP BY "chumps" HAVING COUNT(*) = (SELECT COUNT(*) FROM table_204_269 WHERE "chumps" = 'chantelle and steve')
What is the name of the person whose country is West Indies.
CREATE TABLE table_name_53 (name VARCHAR,country VARCHAR)
SELECT name FROM table_name_53 WHERE country = "west indies"
Answers which have outscored [user]'s answers.
CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwne...
SELECT ParentId AS "post_link", Id AS "Post Link", PostTypeId AS "Post Type", OwnerUserId AS "User Link", Score AS "Score", COUNT(*) AS Count FROM Posts AS P WHERE ParentId IN (SELECT ParentId AS "Post Link" FROM Posts AS TargetP WHERE OwnerUserId = '##TargetUserId##' AND P.Score > TargetP.Score) GROUP BY OwnerUserId, ...
What is the Intergiro classification when the points classification is Paolo Bettini, Trofeo Super Team is Davitamon-Lotto, and the Mountains classification is Jos Rujano?
CREATE TABLE table_name_16 (intergiro_classification VARCHAR,mountains_classification VARCHAR,points_classification VARCHAR,trofeo_super_team VARCHAR)
SELECT intergiro_classification FROM table_name_16 WHERE points_classification = "paolo bettini" AND trofeo_super_team = "davitamon-lotto" AND mountains_classification = "josé rujano"
what is patient 13536's last urine out foley output time on 05/03/this year?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (r...
SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13536)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urin...
Name the total number of publishers for flushed away
CREATE TABLE table_14325653_2 (publisher_s_ VARCHAR,video_game VARCHAR)
SELECT COUNT(publisher_s_) FROM table_14325653_2 WHERE video_game = "Flushed Away"
What is Mult, when Model Number is Pentium II 450?
CREATE TABLE table_49712 ("Model number" text,"Frequency" text,"L2 cache" text,"Mult." text,"Voltage" text,"Socket" text)
SELECT "Mult." FROM table_49712 WHERE "Model number" = 'pentium ii 450'
Show each apartment type code, and the maximum and minimum number of rooms for each type.
CREATE TABLE apartment_facilities (apt_id number,facility_code text)CREATE TABLE apartments (apt_id number,building_id number,apt_type_code text,apt_number text,bathroom_count number,bedroom_count number,room_count text)CREATE TABLE guests (guest_id number,gender_code text,guest_first_name text,guest_last_name text,dat...
SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM apartments GROUP BY apt_type_code
What is Score, when Game is greater than 4?
CREATE TABLE table_name_1 (score VARCHAR,game INTEGER)
SELECT score FROM table_name_1 WHERE game > 4
Number of questions per day for given tag name(s).
CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl...
SELECT TIME_TO_STR(Posts.CreationDate, '%Y') AS "Year", TIME_TO_STR(Posts.CreationDate, '%m') AS "Month", TIME_TO_STR(Posts.CreationDate, '%d') AS "Day", Tags.TagName, COUNT(*) AS "Total" FROM PostTags AS pt JOIN Posts AS posts ON pt.PostId = Posts.Id JOIN Tags AS tags ON pt.TagId = Tags.Id WHERE Tags.TagName IN ('r') ...
Show institution names along with the number of proteins for each institution, sort Y-axis from high to low order.
CREATE TABLE protein (common_name text,protein_name text,divergence_from_human_lineage real,accession_number text,sequence_length real,sequence_identity_to_human_protein text,Institution_id text)CREATE TABLE Institution (Institution_id text,Institution text,Location text,Founded real,Type text,Enrollment int,Team text,...
SELECT Institution, COUNT(*) FROM Institution AS T1 JOIN protein AS T2 ON T1.Institution_id = T2.Institution_id GROUP BY T1.Institution_id ORDER BY COUNT(*) DESC
which was the longest running ?
CREATE TABLE table_204_671 (id number,"airing\ndate" text,"english title\n(chinese title)" text,"number of episodes" number,"main cast" text,"theme song (t)\nsub-theme song (st)" text,"genre" text,"notes" text,"official website" text)
SELECT "english title\n(chinese title)" FROM table_204_671 ORDER BY "airing\ndate" - "airing\ndate" DESC LIMIT 1
which country produced the player who placed last ?
CREATE TABLE table_204_679 (id number,"place" text,"player" text,"country" text,"score" text,"to par" number,"money ($)" number)
SELECT "country" FROM table_204_679 ORDER BY "place" DESC LIMIT 1
What league has an average attendance of 1452?
CREATE TABLE table_22965 ("Year" real,"Division" real,"League" text,"Regular Season" text,"Playoffs" text,"U.S. Open Cup" text,"Avg. Attendance" real)
SELECT "League" FROM table_22965 WHERE "Avg. Attendance" = '1452'