instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Users with the most X badges.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE ...
SELECT UserId AS "user_link", COUNT(*) AS "badge_count" FROM Badges WHERE Name = '##Badge:string##' GROUP BY UserId HAVING COUNT(*) > 1 ORDER BY 'badge_count' DESC LIMIT 100
what month were the most games played ?
CREATE TABLE table_203_672 (id number,"week" number,"date" text,"opponent" text,"result" text,"venue" text,"attendance" number)
SELECT "date" FROM table_203_672 GROUP BY "date" ORDER BY COUNT(*) DESC LIMIT 1
what is the maximum ties played where player is josip palada category:articles with hcards
CREATE TABLE table_10294071_1 (ties_played INTEGER,player VARCHAR)
SELECT MAX(ties_played) FROM table_10294071_1 WHERE player = "Josip Palada Category:Articles with hCards"
what is the date when the opponent is real espa a?
CREATE TABLE table_name_41 (date VARCHAR,opponent VARCHAR)
SELECT date FROM table_name_41 WHERE opponent = "real españa"
what is patient 003-50177's height for the first time on the last hospital visit?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,obs...
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-50177' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionheight IS NULL ORDER...
Name the leader battle for plamen
CREATE TABLE table_25920798_2 (leader_battle VARCHAR,eliminated VARCHAR)
SELECT leader_battle FROM table_25920798_2 WHERE eliminated = "Plamen"
Name the airport with IATA of dmk
CREATE TABLE table_name_74 (airport VARCHAR,iata VARCHAR)
SELECT airport FROM table_name_74 WHERE iata = "dmk"
What are the first names and offices of history professors who don't have Ph.D.s?
CREATE TABLE enroll (class_code text,stu_num number,enroll_grade text)CREATE TABLE student (stu_num number,stu_lname text,stu_fname text,stu_init text,stu_dob time,stu_hrs number,stu_class text,stu_gpa number,stu_transfer number,dept_code text,stu_phone text,prof_num number)CREATE TABLE class (class_code text,crs_code ...
SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree <> 'Ph.D.'
indicate the yearly minimum amount of arterial bp [diastolic] for patient 5142 since 07/2103.
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)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,ethnicit...
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5142)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arter...
how many female patients were given the drug with drug code acet1000i?
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,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "ACET1000I"
What season had Kanto Gakuin University as the winner, with an attendance of n/a, and a title of 37th?
CREATE TABLE table_name_62 (season VARCHAR,title VARCHAR,winner VARCHAR,attendance VARCHAR)
SELECT season FROM table_name_62 WHERE winner = "kanto gakuin university" AND attendance = "n/a" AND title = "37th"
what is the top-5 when the tournament is totals and the top-25 is more than 4?
CREATE TABLE table_name_80 (top_5 INTEGER,tournament VARCHAR,top_25 VARCHAR)
SELECT AVG(top_5) FROM table_name_80 WHERE tournament = "totals" AND top_25 > 4
which patients have cyclosporine (sandimmune) prescription?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime 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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "CycloSPORINE (Sandimmune)"
Has PERIODON 789 been taught by David Canter ?
CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE ...
SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'PERIODON' AND course.number = 789 AND instructor.name LIKE '%David Canter%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instruct...
What country does Round 4 come from?
CREATE TABLE table_name_12 (nationality VARCHAR,round VARCHAR)
SELECT nationality FROM table_name_12 WHERE round = 4
When John Mcenroe won at Montreal, what was the score?
CREATE TABLE table_name_43 (score VARCHAR,location VARCHAR,champion VARCHAR)
SELECT score FROM table_name_43 WHERE location = "montreal" AND champion = "john mcenroe"
Which patients with infected right thigh graft as their primary disease have long term care as their hospital discharge?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND demographic.diagnosis = "INFECTED RIGHT THIGH GRAFT"
What was the score of the home team when the away team scored 14.12 (96)?
CREATE TABLE table_74747 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team score" FROM table_74747 WHERE "Away team score" = '14.12 (96)'
Did any team score games that totaled up to 860.5?
CREATE TABLE table_16195 ("Rank" real,"Member Association" text,"Points" text,"Group stage" real,"Play-off" real,"AFC Cup" real)
SELECT "Play-off" FROM table_16195 WHERE "Points" = '860.5'
Which Geological Trend has an Operator(s) of woc?
CREATE TABLE table_15217 ("Field" text,"Geological Trend" text,"Reserves" text,"Discovery" text,"Operator(s)" text)
SELECT "Geological Trend" FROM table_15217 WHERE "Operator(s)" = 'woc'
What is the height for less than 45 storeys in Scotia Centre?
CREATE TABLE table_5243 ("Years" text,"Building" text,"City" text,"Height" text,"Storeys" real)
SELECT "Height" FROM table_5243 WHERE "Storeys" < '45' AND "Building" = 'scotia centre'
What is Name, when Overall is less than 175, and when College is 'Georgia'?
CREATE TABLE table_name_83 (name VARCHAR,overall VARCHAR,college VARCHAR)
SELECT name FROM table_name_83 WHERE overall < 175 AND college = "georgia"
Which college did the player attend that went to Mission Viejo High School?
CREATE TABLE table_11677691_4 (college VARCHAR,school VARCHAR)
SELECT college FROM table_11677691_4 WHERE school = "Mission Viejo High school"
What is Germany's lowest heat ranked after 24?
CREATE TABLE table_13437 ("Rank" real,"Heat" real,"Lane" real,"Name" text,"Nationality" text,"Time" text)
SELECT MIN("Heat") FROM table_13437 WHERE "Nationality" = 'germany' AND "Rank" > '24'
jan schulz is ranked immediately below which player ?
CREATE TABLE table_203_507 (id number,"#" text,"player" text,"\u03c3 points" number,"qual." number,"final" number)
SELECT "player" FROM table_203_507 WHERE id = (SELECT id FROM table_203_507 WHERE "player" = 'jan schulz') - 1
What are the exact Cubic inches of the Unit of kruzhka?
CREATE TABLE table_35533 ("Unit" text,"Russian" text,"Translation" text,"Ratio" text,"Cubic inches (exact)" text,"Metric value" text,"Imperial value" text,"US Customary" text)
SELECT "Cubic inches (exact)" FROM table_35533 WHERE "Unit" = 'kruzhka'
what is the total number of patients who had sternal wound infection and lab test for blood gas?
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.diagnosis = "STERNAL WOUND INFECTION" AND lab."CATEGORY" = "Blood Gas"
Show the GPA of the students with the top 5 GPAs in a bar chart.
CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE STUDEN...
SELECT STU_FNAME, STU_GPA FROM STUDENT ORDER BY STU_GPA DESC LIMIT 5
Which Pop/Area (1/km ) has a No P. larger than 1, and a Name of albergaria-a-velha?
CREATE TABLE table_name_84 (pop_area__1_km²_ INTEGER,no_p VARCHAR,name VARCHAR)
SELECT AVG(pop_area__1_km²_) FROM table_name_84 WHERE no_p > 1 AND name = "albergaria-a-velha"
A bar chart about how many classes are held in each department?
CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varch...
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE
Return a bar chart about the distribution of All_Home and the average of Team_ID , and group by attribute All_Home, and list All_Home in desc order.
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 All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
What position did he finish in the year his average start was 16.8?
CREATE TABLE table_2480 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text)
SELECT "Position" FROM table_2480 WHERE "Avg. Start" = '16.8'
What is School Year, when Cross Country is Lexington, when Soccer is Ashland, and when Volleyball is Wooster?
CREATE TABLE table_name_9 (school_year VARCHAR,volleyball VARCHAR,cross_country VARCHAR,soccer VARCHAR)
SELECT school_year FROM table_name_9 WHERE cross_country = "lexington" AND soccer = "ashland" AND volleyball = "wooster"
Name the least week for l 26 42
CREATE TABLE table_28663 ("Week" real,"Date" text,"Kickoff" text,"Opponent" text,"Final score" text,"Team record" text,"Game site" text,"Attendance" real)
SELECT MIN("Week") FROM table_28663 WHERE "Final score" = 'L 26–42'
Count of self-answers on a specific tag, record holders.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment te...
SELECT MIN(Tags.TagName) AS TagName, Q.OwnerUserId AS "user_link", COUNT(*) AS Count FROM Posts AS Q, Posts AS A, PostTags, Tags WHERE A.ParentId = Q.Id AND PostTags.PostId = Q.Id AND Q.OwnerUserId > 0 AND Q.OwnerUserId = A.OwnerUserId AND Tags.Id = PostTags.TagId GROUP BY PostTags.TagId, Q.OwnerUserId ORDER BY Count D...
Could you explain to me about the special topics classes for the next Winter ?
CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,categ...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE (course.number = 398 OR course.number = 498 OR course.number = 598) AND course.department = 'E...
What is the lowest attendance of a game that has the result of 2-0?
CREATE TABLE table_38002 ("Date" text,"Round" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real,"Scorers" text)
SELECT MIN("Attendance") FROM table_38002 WHERE "Result" = '2-0'
What was the highest score of t5 place finisher brandt jobe?
CREATE TABLE table_78561 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text)
SELECT MAX("Score") FROM table_78561 WHERE "Place" = 't5' AND "Player" = 'brandt jobe'
In what district was keith ellison the incumbent?
CREATE TABLE table_27292 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "District" FROM table_27292 WHERE "Incumbent" = 'Keith Ellison'
When an away team scored 6.12 (48), what was the home team?
CREATE TABLE table_56080 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_56080 WHERE "Away team score" = '6.12 (48)'
What are the names of all aicrafts that have never won any match?
CREATE TABLE pilot (pilot_id number,name text,age number)CREATE TABLE airport (airport_id number,airport_name text,total_passengers number,%_change_2007 text,international_passengers number,domestic_passengers number,transit_passengers number,aircraft_movements number,freight_metric_tonnes number)CREATE TABLE match (ro...
SELECT aircraft FROM aircraft WHERE NOT aircraft_id IN (SELECT winning_aircraft FROM match)
If the poverty rate is 12.9%, what is the market income per capita?
CREATE TABLE table_25356 ("County" text,"Population" real,"Unemployment Rate" text,"Market Income Per Capita" text,"Poverty Rate" text,"Status" text)
SELECT "Market Income Per Capita" FROM table_25356 WHERE "Poverty Rate" = '12.9%'
Who constructed the car that retired due to brakes with a grid larger than 17?
CREATE TABLE table_11851 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Constructor" FROM table_11851 WHERE "Grid" > '17' AND "Time/Retired" = 'brakes'
provide the number of patients who have been diagnosed with unspecified encephalopathy and abnormal lab test status.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Encephalopathy NOS" AND lab.flag = "abnormal"
Which Date has a Region of france?
CREATE TABLE table_name_90 (date VARCHAR,region VARCHAR)
SELECT date FROM table_name_90 WHERE region = "france"
severe chronic liver disease ( child pugh score of 11 15 ) ,
CREATE TABLE table_train_5 ("id" int,"pregnancy_or_lactation" bool,"severe_sepsis" bool,"protein_c" int,"liver_disease" bool,"chronic_respiratory_disease" bool,"child_pugh_score" int,"septic_shock" bool,"myocardial_infarction" bool,"NOUSE" float)
SELECT * FROM table_train_5 WHERE liver_disease = 1 OR (child_pugh_score > 11 AND child_pugh_score < 15)
Who wrote the episodes watched by 1.816 million people in Canada?
CREATE TABLE table_18424435_3 (written_by VARCHAR,canadian_viewers__million_ VARCHAR)
SELECT written_by FROM table_18424435_3 WHERE canadian_viewers__million_ = "1.816"
What was the players position in 2013 who had 29 seasons in the second tier
CREATE TABLE table_1560673_1 (position_in_2013 VARCHAR,number_of_seasons_in_second_tier VARCHAR)
SELECT position_in_2013 FROM table_1560673_1 WHERE number_of_seasons_in_second_tier = "29"
what's the wine style with village being puligny-montrachet [d ]
CREATE TABLE table_13981938_1 (wine_style VARCHAR,village VARCHAR)
SELECT wine_style FROM table_13981938_1 WHERE village = "Puligny-Montrachet [d ]"
what is the gpu model when the frequency is 3.4 ghz and the sspec number is sr00b(d2)?
CREATE TABLE table_13844 ("Model number" text,"sSpec number" text,"Cores" text,"Frequency" text,"Turbo" text,"L2 cache" text,"L3 cache" text,"GPU model" text,"GPU frequency" text,"Socket" text,"I/O bus" text,"Release date" text,"Part number(s)" text,"Release price (USD)" text)
SELECT "GPU model" FROM table_13844 WHERE "Frequency" = '3.4 ghz' AND "sSpec number" = 'sr00b(d2)'
Who was the Centerfild model that used Bruce Willis as her Interview subject?
CREATE TABLE table_41915 ("Date" text,"Cover model" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text)
SELECT "Centerfold model" FROM table_41915 WHERE "Interview subject" = 'bruce willis'
after you complete deganya road , what portion comes next ?
CREATE TABLE table_203_108 (id number,"kilometers" number,"name" text,"location" text,"intersecting routes" text)
SELECT "name" FROM table_203_108 WHERE id = (SELECT id FROM table_203_108 WHERE "name" = 'deganya road') + 1
What is the acronym for the English name Northern management and technological institute?
CREATE TABLE table_name_21 (acronym VARCHAR,name_in_english VARCHAR)
SELECT acronym FROM table_name_21 WHERE name_in_english = "northern management and technological institute"
List title of albums have the number of tracks greater than 10.
CREATE TABLE albums (title VARCHAR,id VARCHAR)CREATE TABLE tracks (album_id VARCHAR)
SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10
which type of drug is ferrous sulfate?
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 prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Ferrous Sulfate"
What is the lowest Draws, when Byes is less than 2?
CREATE TABLE table_name_6 (draws INTEGER,byes INTEGER)
SELECT MIN(draws) FROM table_name_6 WHERE byes < 2
What is the oldest age for each gender of student? Return a bar chart, and order by the x axis in asc please.
CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Has_amenity (dormid INTEGER,amenid 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 Lives_in (stuid INTEGER,dormid INT...
SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY Sex
What is the weight of the display that has an internal storage of 16-64 GB and uses a wi-fi, 3G wireless network?
CREATE TABLE table_name_33 (weight VARCHAR,internal_storage VARCHAR,wireless_network VARCHAR)
SELECT weight FROM table_name_33 WHERE internal_storage = "16-64 gb" AND wireless_network = "wi-fi, 3g"
Zach Banner is a player at which school?
CREATE TABLE table_11677691_5 (school VARCHAR,player VARCHAR)
SELECT school FROM table_11677691_5 WHERE player = "Zach Banner"
What was the record for the game where the cardinals scored 7 points?
CREATE TABLE table_24003 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Cardinals points" real,"Opponents" real,"Record" text)
SELECT "Record" FROM table_24003 WHERE "Cardinals points" = '7'
What is the Opponent with a time of 2:05 p.m., and the results were w 26 20?
CREATE TABLE table_name_62 (opponent VARCHAR,time VARCHAR,result VARCHAR)
SELECT opponent FROM table_name_62 WHERE time = "2:05 p.m." AND result = "w 26–20"
count the number of patients who had been discharged from the hospital.
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,va...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL
What is the average credit score for customers who have never taken a loan?
CREATE TABLE customer (cust_id text,cust_name text,acc_type text,acc_bal number,no_of_loans number,credit_score number,branch_id number,state text)CREATE TABLE bank (branch_id number,bname text,no_of_customers number,city text,state text)CREATE TABLE loan (loan_id text,loan_type text,cust_id text,branch_id text,amount ...
SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
What was the decision when the attendance was 19,592?
CREATE TABLE table_name_6 (decision VARCHAR,attendance VARCHAR)
SELECT decision FROM table_name_6 WHERE attendance = "19,592"
what's the three most frequent drugs that were prescribed in the same hospital encounter to the male patients of age 20s after they have been diagnosed with atrial fibrillation until 2 years ago?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod 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 text,ethnicity text,a...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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_...
How many silver medals had a rank of 3 with bronze larger than 0?
CREATE TABLE table_38404 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Silver") FROM table_38404 WHERE "Rank" = '3' AND "Bronze" > '0'
what is the number of patients whose days of hospital stay is greater than 1?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "1"
With a Col (m) larger than 2012, what is Mount Kazbek's Prominence (m)?
CREATE TABLE table_79477 ("Peak" text,"Country" text,"Elevation (m)" real,"Prominence (m)" real,"Col (m)" real)
SELECT "Prominence (m)" FROM table_79477 WHERE "Col (m)" > '2012' AND "Peak" = 'mount kazbek'
What is the max 1-min wind mph when the minimum press is 997?
CREATE TABLE table_name_57 (max_1_min_wind_mph__km_h_ VARCHAR,min_press___mbar__ VARCHAR)
SELECT max_1_min_wind_mph__km_h_ FROM table_name_57 WHERE min_press___mbar__ = "997"
What's the highest silver and 1 gold that the nation of djibouti received with a total less than 3?
CREATE TABLE table_name_25 (silver INTEGER,total VARCHAR,gold VARCHAR,nation VARCHAR)
SELECT MAX(silver) FROM table_name_25 WHERE gold = 1 AND nation = "djibouti" AND total < 3
give me the flights from DENVER to BALTIMORE on UA
CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,...
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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DEN...
What was the top first place prize in 1997?
CREATE TABLE table_80307 ("Year" real,"Winner" text,"Country" text,"Purse ($)" real,"Score" text,"First Prize ($)" real)
SELECT MAX("First Prize ( $ )") FROM table_80307 WHERE "Year" = '1997'
What is the total 30 to 34 when the 40 to 44 is greater than 3,003, and the 50 to 54 is greater than 4,184?
CREATE TABLE table_77334 ("C/W 15+" real,"Oblast\\Age" text,"15 to 17" real,"18 to 19" real,"20 to 24" real,"25 to 29" real,"30 to 34" real,"35 to 39" real,"40 to 44" real,"45 to 49" real,"50 to 54" real,"55 to 59" real,"60 to 64" real,"65 to 69" real)
SELECT SUM("30 to 34") FROM table_77334 WHERE "40 to 44" > '3,003' AND "50 to 54" > '4,184'
how many teams competed in the 1998 marlboro grand prix of miami ?
CREATE TABLE table_204_477 (id number,"pos" number,"no" number,"driver" text,"team" text,"laps" number,"time/retired" text,"grid" number,"points" number)
SELECT COUNT("team") FROM table_204_477
Which house has an abbreviation of D?
CREATE TABLE table_name_24 (house VARCHAR,abbr VARCHAR)
SELECT house FROM table_name_24 WHERE abbr = "d"
what is the name of the drug that patient 015-59552 was prescribed for within 2 days after having been diagnosed since 123 months ago with anemia?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult nu...
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-59552') AND diagnosis.diagnos...
Find out the maximum age of patients who were admitted in or after 2151 and have aortic valve insufficiency/aortic valve replacement/sda as their primary disease.
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,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.admityear >= "2151"
Which Round has a Name of john goodyear?
CREATE TABLE table_50405 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT "Round" FROM table_50405 WHERE "Name" = 'john goodyear'
What's the lowest DCSF number in Aycliffe Drive but an Ofsted number smaller than 117335?
CREATE TABLE table_name_77 (dcsf_number INTEGER,name VARCHAR,ofsted_number VARCHAR)
SELECT MIN(dcsf_number) FROM table_name_77 WHERE name = "aycliffe drive" AND ofsted_number < 117335
what flights are available from SAN FRANCISCO to PITTSBURGH on thursday evening
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE days (days...
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, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 24 AND date_day.month_number = 5 A...
When was the private/baptist school founded?
CREATE TABLE table_28403 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" real,"Joined" text)
SELECT "Founded" FROM table_28403 WHERE "Type" = 'Private/Baptist'
Which 2nd leg has a 1st leg of 2 0?
CREATE TABLE table_8158 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "2nd leg" FROM table_8158 WHERE "1st leg" = '2–0'
What is the date of the game that had a visitor of Chicago?
CREATE TABLE table_75063 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Date" FROM table_75063 WHERE "Visitor" = 'chicago'
Which policy type has the most records in the database?
CREATE TABLE customers (customer_id number,customer_name text)CREATE TABLE settlements (settlement_id number,claim_id number,effective_date time,settlement_amount number)CREATE TABLE services (service_id number,service_name text)CREATE TABLE customers_policies (customer_id number,policy_id number,date_opened time,date_...
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
who is taller garreth lodge or ross campbell ?
CREATE TABLE table_203_418 (id number,"#" number,"player" text,"position" text,"height" number,"current club" text)
SELECT "player" FROM table_203_418 WHERE "player" IN ('garreth lodge', 'ross campbell') ORDER BY "height" DESC LIMIT 1
What's the chassis for alexander wurz's playlife fb02 engine?
CREATE TABLE table_name_7 (chassis VARCHAR,engine_† VARCHAR,driver VARCHAR)
SELECT chassis FROM table_name_7 WHERE engine_† = "playlife fb02" AND driver = "alexander wurz"
Show the county name and population of all counties Show bar chart, rank in asc by the y-axis.
CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text,Party int,First_Elected real,Committee text)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,Comptroll...
SELECT County_name, Population FROM county ORDER BY Population
For each director who directed more than one movie, for each movie title, bin their dates of release into Year interval and count the total number in each bucket using a line chart, and list by the X-axis in asc.
CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Movie (mID int,title text,year int,director text)
SELECT year, COUNT(year) FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title GROUP BY title ORDER BY year
What party is incumbent virgil chapman from?
CREATE TABLE table_18568 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Party" FROM table_18568 WHERE "Incumbent" = 'Virgil Chapman'
give the primary disease of jane dillard.
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 demographic.diagnosis FROM demographic WHERE demographic.name = "Jane Dillard"
What stage was 1,648 km achieved?
CREATE TABLE table_32696 ("Year" text,"Date" text,"Stages" text,"Distance" text,"Winner" text)
SELECT "Stages" FROM table_32696 WHERE "Distance" = '1,648 km'
A line chart for returning the number of the dates of birth for entrepreneurs who have either the investor Simon Woodroffe or Peter Jones, could you order X in descending order?
CREATE TABLE entrepreneur (Entrepreneur_ID int,People_ID int,Company text,Money_Requested real,Investor text)CREATE TABLE people (People_ID int,Name text,Height real,Weight real,Date_of_Birth text)
SELECT Date_of_Birth, COUNT(Date_of_Birth) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" ORDER BY Date_of_Birth DESC
What points larger than 1950 has a maserati straight-6 engine?
CREATE TABLE table_name_68 (points VARCHAR,year VARCHAR,engine VARCHAR)
SELECT points FROM table_name_68 WHERE year > 1950 AND engine = "maserati straight-6"
What was the margin of victory at the Hawaiian Open tournament?
CREATE TABLE table_1514634_2 (margin_of_victory VARCHAR,tournament VARCHAR)
SELECT margin_of_victory FROM table_1514634_2 WHERE tournament = "Hawaiian Open"
What is the try bonus when the loss is 13 and the draw is 2?
CREATE TABLE table_name_51 (try_bonus VARCHAR,lost VARCHAR,drawn VARCHAR)
SELECT try_bonus FROM table_name_51 WHERE lost = "13" AND drawn = "2"
On what date was a game played at Windy Hill?
CREATE TABLE table_name_6 (date VARCHAR,venue VARCHAR)
SELECT date FROM table_name_6 WHERE venue = "windy hill"
Who's the Republican ticket with a Communist ticket of elizabeth gurley flynn?
CREATE TABLE table_40849 ("Republican ticket" text,"Democratic ticket" text,"American Labor ticket" text,"Communist ticket" text,"Socialist ticket" text)
SELECT "Republican ticket" FROM table_40849 WHERE "Communist ticket" = 'elizabeth gurley flynn'
what date were they playing in hawthorn
CREATE TABLE table_name_17 (date VARCHAR,away_team VARCHAR)
SELECT date FROM table_name_17 WHERE away_team = "hawthorn"
Who had highest points in game 5?
CREATE TABLE table_22883210_5 (high_points VARCHAR,game VARCHAR)
SELECT high_points FROM table_22883210_5 WHERE game = 5
Which forward player has the number 22?
CREATE TABLE table_11545282_10 (player VARCHAR,no VARCHAR,position VARCHAR)
SELECT player FROM table_11545282_10 WHERE no = "22" AND position = "Forward"