instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
How many patients with item id 51438 were married? | 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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "51438" |
what's the tries against with tries for being 47 | CREATE TABLE table_12828723_3 (tries_against VARCHAR,tries_for VARCHAR) | SELECT tries_against FROM table_12828723_3 WHERE tries_for = "47" |
For those employees who do not work in departments with managers that have ids between 100 and 200, find hire_date and the average of manager_id bin hire_date by time, and visualize them by a bar chart, and could you sort Y-axis in ascending order? | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAI... | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID) |
Name the broadcast network for chiba prefecture | CREATE TABLE table_2413 ("Broadcast scope" text,"Broadcast network" text,"Broadcast term" text,"Broadcast day and timings (in JST)" text,"Broadcast format" text) | SELECT "Broadcast network" FROM table_2413 WHERE "Broadcast scope" = 'Chiba Prefecture' |
When troy is the regular season winner what is the conference tournament? | CREATE TABLE table_3002 ("Conference" text,"Regular Season Winner" text,"Conference Player of the Year" text,"Conference Tournament" text,"Tournament Venue (City)" text,"Tournament Winner" text) | SELECT "Conference Tournament" FROM table_3002 WHERE "Regular Season Winner" = 'Troy' |
What record has loss as the res., 1 for the round, and akira maeda as the opponent? | CREATE TABLE table_name_9 (record VARCHAR,opponent VARCHAR,res VARCHAR,round VARCHAR) | SELECT record FROM table_name_9 WHERE res = "loss" AND round = "1" AND opponent = "akira maeda" |
what number of dates were won by the chicago bears ? | CREATE TABLE table_204_855 (id number,"year" number,"date" text,"winner" text,"result" text,"loser" text,"attendance" number,"location" text) | SELECT COUNT("date") FROM table_204_855 WHERE "winner" = 'chicago bears' |
Highest upvote of question, answer - MSE. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,Own... | SELECT * FROM Votes LIMIT 10 |
Top 2000 users ranked by average answer score. | CREATE TABLE PostTags (PostId number,TagId 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,LastEditorUserId number,LastEditorDisplayName text,Las... | SELECT Users.Id AS "user_link", SUM(Posts.Score) AS "Upvotes", COUNT(*) AS "Answers", 1.0 * SUM(Posts.Score) / COUNT(*) AS "Ave. score", MAX(Posts.Score) AS "Highest score", 1.0 * MAX(Posts.Score) / SUM(Posts.Score) AS "Fraction votes from highest scoring answer" FROM Posts LEFT JOIN Users ON Posts.OwnerUserId = Users.... |
What was the total score where Toronto was played? | CREATE TABLE table_name_71 (game INTEGER,team VARCHAR) | SELECT SUM(game) FROM table_name_71 WHERE team = "toronto" |
What poor law union is Curradonohoe a part of? | CREATE TABLE table_30120555_1 (poor_law_union VARCHAR,townland VARCHAR) | SELECT poor_law_union FROM table_30120555_1 WHERE townland = "Curradonohoe" |
What is the venue for the Status of Five Nations and 0 againts? | CREATE TABLE table_name_38 (venue VARCHAR,status VARCHAR,against VARCHAR) | SELECT venue FROM table_name_38 WHERE status = "five nations" AND against = 0 |
Plot how many minister by grouped by minister as a bar graph, display y-axis in ascending order. | CREATE TABLE party (Party_ID int,Minister text,Took_office text,Left_office text,Region_ID int,Party_name text)CREATE TABLE member (Member_ID int,Member_Name text,Party_ID text,In_office text)CREATE TABLE region (Region_ID int,Region_name text,Date text,Label text,Format text,Catalogue text)CREATE TABLE party_events (E... | SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY COUNT(Minister) |
what is the album when the year is later than 2008? | CREATE TABLE table_name_77 (album VARCHAR,year INTEGER) | SELECT album FROM table_name_77 WHERE year > 2008 |
count yearid for visualizing a line chart, and sort X in asc order. | CREATE TABLE college (college_id TEXT,name_full TEXT,city TEXT,state TEXT,country TEXT)CREATE TABLE manager_award (player_id TEXT,award_id TEXT,year INTEGER,league_id TEXT,tie TEXT,notes NUMERIC)CREATE TABLE batting (player_id TEXT,year INTEGER,stint INTEGER,team_id TEXT,league_id TEXT,g INTEGER,ab NUMERIC,r NUMERIC,h ... | SELECT yearid, COUNT(yearid) FROM hall_of_fame ORDER BY yearid |
How many n are listed for berbers from siwa? | CREATE TABLE table_73306 ("Region" text,"Population" text,"Country" text,"Language" text,"N" real,"Total%" text,"R1b1c (R-V88)" text,"R1b1a2 (R-M269)" text,"R1b1c* (R-V88*)" text,"R1b1c4 (R-V69)" text) | SELECT COUNT("N") FROM table_73306 WHERE "Population" = 'Berbers from Siwa' |
How many patients living patients operated with circumcission? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Circumcision" |
what is the number of races won in in 2012 by etienne bax ? | CREATE TABLE table_203_425 (id number,"season" number,"driver" text,"equipment" text,"position" number,"points" number,"races" number,"wins" number,"second" number,"third" number) | SELECT "wins" FROM table_203_425 WHERE "season" = 2012 AND "driver" = 'etienne bax' |
return me all the organizations in Databases area . | CREATE TABLE cite (cited int,citing int)CREATE TABLE keyword (keyword varchar,kid int)CREATE TABLE domain_author (aid int,did int)CREATE TABLE domain_publication (did int,pid int)CREATE TABLE domain_keyword (did int,kid int)CREATE TABLE journal (homepage varchar,jid int,name varchar)CREATE TABLE publication_keyword (ki... | SELECT organization.name FROM author, domain, domain_author, organization WHERE domain_author.aid = author.aid AND domain.did = domain_author.did AND domain.name = 'Databases' AND organization.oid = author.oid |
What is the score for the team with a record of 2-1? | CREATE TABLE table_name_81 (score VARCHAR,record VARCHAR) | SELECT score FROM table_name_81 WHERE record = "2-1" |
What year did a school leave that was founded in 1880? | CREATE TABLE table_17010 ("Institution" text,"Location" text,"Founded" real,"Type" text,"Enrollment" real,"Nickname" text,"Joined" real,"Left" real,"Current Conference" text) | SELECT "Left" FROM table_17010 WHERE "Founded" = '1880' |
what was the drug patient 009-7776 was prescribed for the first time using the iv push route in this month? | 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 medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-7776')) AND medication.routeadmin = 'iv push' AND DATETIME(medi... |
previous hemorrhagic stroke | CREATE TABLE table_test_30 ("id" int,"ejection_fraction_ef" int,"multiple_long_bone_fractures" bool,"extracellular_volume_expansion" bool,"pregnancy_or_lactation" bool,"bleeding" int,"serum_potassium" float,"prosthetic_heart_valve" bool,"hbg" int,"anticoagulation" bool,"incomplete_spinal_cord_injury" bool,"complex_pelv... | SELECT * FROM table_test_30 WHERE previous_hemorrhagic_stroke = 1 |
What is the highest total that has andrea sinko as the name, with an all around greater than 9.65? | CREATE TABLE table_78978 ("Place" real,"Name" text,"All Around" real,"Clubs" real,"Total" real) | SELECT MAX("Total") FROM table_78978 WHERE "Name" = 'andrea sinko' AND "All Around" > '9.65' |
On what date was a record set in the team pursuit (8 laps) event? | CREATE TABLE table_49191 ("Event" text,"Time" text,"Name" text,"Nation" text,"Games" text,"Date" text) | SELECT "Date" FROM table_49191 WHERE "Event" = 'team pursuit (8 laps)' |
which king ruled the longest ? | CREATE TABLE table_204_125 (id number,"state" text,"type" text,"name" text,"title" text,"royal house" text,"from" text,"to" text) | SELECT "name" FROM table_204_125 ORDER BY "from" - "to" DESC LIMIT 1 |
What is the mark for Grenada in group A? | CREATE TABLE table_64536 ("Rank" text,"Group" text,"Name" text,"Nationality" text,"Mark" text) | SELECT "Mark" FROM table_64536 WHERE "Group" = 'a' AND "Nationality" = 'grenada' |
what is the space where the next one was mike turnesa | CREATE TABLE table_28456 ("Year" real,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text) | SELECT "Margin" FROM table_28456 WHERE "Runner(s)-up" = 'Mike Turnesa' |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me the trend about department_id over hire_date with a line chart, show by the X in desc. | 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(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE ... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE DESC |
Just show the first name of the employee and list their manager's id in the Y-axis of the bar chart, could you sort in asc by the x-axis? | 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 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 departments (D... | SELECT FIRST_NAME, MANAGER_ID FROM employees ORDER BY FIRST_NAME |
Which Round has a School/Club Team of cal-poly slo, and a Pick smaller than 238? | CREATE TABLE table_77131 ("Round" real,"Pick" real,"Player" text,"Position" text,"School/Club Team" text) | SELECT MAX("Round") FROM table_77131 WHERE "School/Club Team" = 'cal-poly slo' AND "Pick" < '238' |
Which Date has a Result of 0 0? | CREATE TABLE table_name_42 (date VARCHAR,result VARCHAR) | SELECT date FROM table_name_42 WHERE result = "0–0" |
What is the to par for the score 72-69-68=209? | CREATE TABLE table_name_11 (to_par VARCHAR,score VARCHAR) | SELECT to_par FROM table_name_11 WHERE score = 72 - 69 - 68 = 209 |
what is admission type and diagnoses short title of subject id 91588? | 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 demographic.admission_type, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "91588" |
How many laps have a +0.4865 time/retired? | CREATE TABLE table_name_34 (laps VARCHAR,time_retired VARCHAR) | SELECT laps FROM table_name_34 WHERE time_retired = "+0.4865" |
Name the most vote % with election of 1946 | CREATE TABLE table_name_53 (vote__percentage INTEGER,election VARCHAR) | SELECT MAX(vote__percentage) FROM table_name_53 WHERE election = "1946" |
what is the id and trade name of the medicines can interact with at least 3 enzymes?, and I want to show by the x axis from high to low. | CREATE TABLE medicine_enzyme_interaction (enzyme_id int,medicine_id int,interaction_type text)CREATE TABLE medicine (id int,name text,Trade_Name text,FDA_approved text)CREATE TABLE enzyme (id int,name text,Location text,Product text,Chromosome text,OMIM int,Porphyria text) | SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY Trade_Name DESC |
Create a bar chart showing how many location across location | CREATE TABLE host (Host_ID int,Name text,Nationality text,Age text)CREATE TABLE party_host (Party_ID int,Host_ID int,Is_Main_in_Charge bool)CREATE TABLE party (Party_ID int,Party_Theme text,Location text,First_year text,Last_year text,Number_of_hosts int) | SELECT Location, COUNT(Location) FROM party GROUP BY Location |
Name the opponent with loss of sanderson (9-8) | CREATE TABLE table_75609 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Save" text) | SELECT "Opponent" FROM table_75609 WHERE "Loss" = 'sanderson (9-8)' |
When the Home team of collingwood played, what was the opposing Away team score? | CREATE TABLE table_name_49 (away_team VARCHAR,home_team VARCHAR) | SELECT away_team AS score FROM table_name_49 WHERE home_team = "collingwood" |
how many patients whose insurance is government and lab test name is po2? | 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 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.insurance = "Government" AND lab.label = "pO2" |
What Player has a To par of +1 and the Score 75-70-71-73=289? | CREATE TABLE table_name_10 (player VARCHAR,to_par VARCHAR,score VARCHAR) | SELECT player FROM table_name_10 WHERE to_par = "+1" AND score = 75 - 70 - 71 - 73 = 289 |
how many treatment of hyperkalemia - insulin / glucose procedures have occurred since 2100? | 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(*) FROM treatment WHERE treatment.treatmentname = 'treatment of hyperkalemia - insulin / glucose' AND STRFTIME('%y', treatment.treatmenttime) >= '2100' |
Show the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group by course code, and show by the bars from low to high please. | CREATE TABLE STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varchar(15),STU_INIT varchar(1),STU_DOB datetime,STU_HRS int,STU_CLASS varchar(2),STU_GPA float(8),STU_TRANSFER numeric,DEPT_CODE varchar(18),STU_PHONE varchar(4),PROF_NUM int)CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION v... | SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY CRS_CODE, EMP_FNAME ORDER BY EMP_FNAME |
had patient 032-4849 when they visited the hospital first time been admitted to an er? | 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(*) > 0 FROM patient WHERE patient.uniquepid = '032-4849' AND patient.hospitaladmitsource = 'emergency department' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1 |
Give me the comparison about All_Games_Percent over the All_Neutral by a bar chart, I want to order by the x axis in desc. | 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_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT All_Neutral, All_Games_Percent FROM basketball_match ORDER BY All_Neutral DESC |
when was patient 62977 in 2101 admitted for the first time to the hospital? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id ... | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 62977 AND STRFTIME('%y', admissions.admittime) = '2101' ORDER BY admissions.admittime LIMIT 1 |
What is the low goal for kenny miller with an average smaller than 0.261? | CREATE TABLE table_54660 ("Name" text,"Scotland career" text,"Caps" real,"Goals" real,"Average" real) | SELECT MIN("Goals") FROM table_54660 WHERE "Name" = 'kenny miller' AND "Average" < '0.261' |
platelets >= 100000 / mm3 | CREATE TABLE table_dev_35 ("id" int,"white_blood_cell_count_wbc" int,"platelets" int,"neutrophil_count" int,"serum_creatinine" float,"albumin" float,"NOUSE" float) | SELECT * FROM table_dev_35 WHERE platelets >= 100000 |
Return a scatter chart about the correlation between People_ID and Height , and group by attribute Sex. | CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real) | SELECT People_ID, Height FROM people GROUP BY Sex |
How many civilians died in the conflict that left 178, excluding foreigners, dead? | CREATE TABLE table_name_19 (civilian_deaths VARCHAR,total_deaths__not_including_foreigners_ VARCHAR) | SELECT civilian_deaths FROM table_name_19 WHERE total_deaths__not_including_foreigners_ = "178" |
In Tie #18, who was the away team? | CREATE TABLE table_name_76 (away_team VARCHAR,tie_no VARCHAR) | SELECT away_team FROM table_name_76 WHERE tie_no = "18" |
Draw a bar chart showing the total number of every ship type by categorizing by nationality, could you sort bars in asc order? | CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text) | SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY Type |
what was the total number of points scored in the game held on 2013-05-21 ? | CREATE TABLE table_204_375 (id number,"#" number,"season" number,"competition" text,"date" text,"round" text,"opponent" text,"h / a" text,"result" text,"scorer (s)" text) | SELECT "result" + "result" FROM table_204_375 WHERE "date" = '2013-05-21' |
Can you tell me the Season that has the Score of 1-0? | CREATE TABLE table_name_34 (season VARCHAR,score VARCHAR) | SELECT season FROM table_name_34 WHERE score = "1-0" |
What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa, and count them by a bar chart, I want to display by the Y in descending. | CREATE TABLE payment (payment_id SMALLINT UNSIGNED,customer_id SMALLINT UNSIGNED,staff_id TINYINT UNSIGNED,rental_id INT,amount DECIMAL(5,2),payment_date DATETIME,last_update TIMESTAMP)CREATE TABLE film_actor (actor_id SMALLINT UNSIGNED,film_id SMALLINT UNSIGNED,last_update TIMESTAMP)CREATE TABLE staff (staff_id TINYIN... | SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' ORDER BY COUNT(payment_date) DESC |
When the transmission make/type/speed is eaton fs 5306-a manual synchromesh 6 speed, what is the value of the gcm (kg) technical capacity? | CREATE TABLE table_245 ("Model" text,"Engine make/Capacity" text,"Power kW@rpm" text,"Torque Nm@rpm" text,"Transmission Make/Type/Speed" text,"GVM (kg) Technical Capacity" text,"GCM (kg) Technical Capacity" text) | SELECT "GCM (kg) Technical Capacity" FROM table_245 WHERE "Transmission Make/Type/Speed" = 'Eaton FS 5306-A Manual Synchromesh 6 Speed' |
with year greater than 1988 what is the total number of points? | CREATE TABLE table_name_62 (points VARCHAR,year INTEGER) | SELECT COUNT(points) FROM table_name_62 WHERE year > 1988 |
What is the number of hispanic or latino-puerto rican patients who had ventriculo puncture through previously implanted catheter? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND procedures.long_title = "Ventriculopuncture through previously implanted catheter" |
What was the par for the t5 place player Steve Jones? | CREATE TABLE table_44634 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "To par" FROM table_44634 WHERE "Place" = 't5' AND "Player" = 'steve jones' |
Who had an evening gown score of 9.78? | CREATE TABLE table_11690135_1 (interview VARCHAR,evening_gown VARCHAR) | SELECT interview FROM table_11690135_1 WHERE evening_gown = "9.78" |
How much Enrollment has a School of shakamak? | CREATE TABLE table_name_56 (enrollment VARCHAR,school VARCHAR) | SELECT COUNT(enrollment) FROM table_name_56 WHERE school = "shakamak" |
who was executed during president charles de gaulle's reign for thr crime of child murder after rape? | CREATE TABLE table_2861364_1 (executed_person VARCHAR,under_president VARCHAR,crime VARCHAR) | SELECT executed_person FROM table_2861364_1 WHERE under_president = "Charles de Gaulle" AND crime = "Child murder after rape" |
what airlines fly into SALT LAKE CITY | CREATE TABLE code_description (code varchar,description text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE ground_service (city_code text,airpo... | SELECT DISTINCT airline.airline_code FROM airline, airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'SALT LAKE CITY' AND flight.airline_code = airline.airline_code AND flight.from_airport = airport_service.airport_code |
Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops. | CREATE TABLE manufacturer (name VARCHAR,open_year VARCHAR,num_of_shops VARCHAR,Num_of_Factories VARCHAR) | SELECT name, open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10 |
What Elector has the Place of Birth listed as Bavaria? | CREATE TABLE table_64899 ("Elector" text,"Place of birth" text,"Cardinalatial title" text,"Elevated" text,"Elevator" text) | SELECT "Elector" FROM table_64899 WHERE "Place of birth" = 'bavaria' |
Sum of m. night shyamalan ranks? | CREATE TABLE table_45195 ("Rank" real,"Title" text,"Studio" text,"Director(s)" text,"Worldwide Gross" text) | SELECT SUM("Rank") FROM table_45195 WHERE "Director(s)" = 'm. night shyamalan' |
uncontrolled diabetes defined as a fpg level of > 240 mg / dl at screening | CREATE TABLE table_train_179 ("id" int,"systolic_blood_pressure_sbp" int,"fasting_plasma_glucose_fpg" float,"diastolic_blood_pressure_dbp" int,"diabetes" bool,"body_mass_index_bmi" float,"triglyceride_tg" float,"hypertension" bool,"age" float,"NOUSE" float) | SELECT * FROM table_train_179 WHERE diabetes = 1 OR fasting_plasma_glucose_fpg > 240 |
what does patient 13686 age be in their first hospital visit? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE transfers (row_id num... | SELECT admissions.age FROM admissions WHERE admissions.subject_id = 13686 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 |
return me the authors who have papers in VLDB conference before 2002 after 1995 . | CREATE TABLE domain_conference (cid int,did int)CREATE TABLE domain_author (aid int,did int)CREATE TABLE domain_publication (did int,pid int)CREATE TABLE organization (continent varchar,homepage varchar,name varchar,oid int)CREATE TABLE cite (cited int,citing int)CREATE TABLE domain (did int,name varchar)CREATE TABLE p... | SELECT author.name FROM author, conference, publication, writes WHERE conference.name = 'VLDB' AND publication.cid = conference.cid AND publication.year < 2002 AND publication.year > 1995 AND writes.aid = author.aid AND writes.pid = publication.pid |
What's Adam's score when Jade's score is greater than 5 and Peter's score is less than 0? | CREATE TABLE table_38657 ("Discipline" text,"Peter" real,"Adam" real,"Jade" real,"Plat'num" real) | SELECT AVG("Adam") FROM table_38657 WHERE "Jade" > '5' AND "Peter" < '0' |
What was the venue where the result was 12th? | CREATE TABLE table_54517 ("Year" real,"Tournament" text,"Venue" text,"Result" text,"Event" text) | SELECT "Venue" FROM table_54517 WHERE "Result" = '12th' |
Who is the turbine vendor for Meenadreen in Donegal county with less than 6 turbines with a size of 0.85 MW? | CREATE TABLE table_name_85 (turbine_vendor VARCHAR,wind_farm VARCHAR,size__mw_ VARCHAR,turbines VARCHAR,county VARCHAR) | SELECT turbine_vendor FROM table_name_85 WHERE turbines < 6 AND county = "donegal" AND size__mw_ = "0.85" AND wind_farm = "meenadreen" |
What's the total diameter when longitude is 357.8e later than 1985? | CREATE TABLE table_46409 ("Name" text,"Latitude" text,"Longitude" text,"Diameter (km)" real,"Year named" real) | SELECT COUNT("Diameter (km)") FROM table_46409 WHERE "Longitude" = '357.8e' AND "Year named" > '1985' |
What is the Result with a Date with 4 september 2013? | CREATE TABLE table_name_4 (result VARCHAR,date VARCHAR) | SELECT result FROM table_name_4 WHERE date = "4 september 2013" |
tell me the change in bedside glucose levels of patient 027-178495 measured at 2102-06-02 12:25:17 compared to the value measured at 2102-06-02 00:23:17? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,... | SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-178495')) AND lab.labname = 'bedside glucose' AND lab.labresulttime = '2102... |
In what season was the final placing NC and the team SL Formula Racing? | CREATE TABLE table_25421463_1 (season VARCHAR,final_placing VARCHAR,team_name VARCHAR) | SELECT season FROM table_25421463_1 WHERE final_placing = "NC†" AND team_name = "SL Formula Racing" |
Show me about the distribution of Team_Name and Team_ID in a bar chart, and order Y-axis in asc order. | 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_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT Team_Name, Team_ID FROM basketball_match ORDER BY Team_ID |
Posts which had given tag in the past. | 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 text,EmailHash text,AccountId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Tags (Id number,Tag... | SELECT DISTINCT PostHistory.PostId AS "post_link", url = 'site://posts/' + CAST(PostHistory.PostId AS TEXT) + '/revisions', Posts.OwnerUserId AS "user_link", Posts.Score, Posts.Tags, Posts.CreationDate, Posts.LastActivityDate FROM PostHistory INNER JOIN Posts ON PostHistory.PostId = Posts.Id WHERE PostHistoryTypeId IN ... |
Show headquarters with at least two companies in the banking industry. | CREATE TABLE company (headquarters VARCHAR,main_industry VARCHAR) | SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2 |
What was the date if the driver was Robert Pressley? | CREATE TABLE table_25162 ("Year" real,"Date" text,"Driver" text,"Team" text,"Manufacturer" text,"Laps" text,"Miles (km)" text,"Race Time" text,"Average Speed (mph)" text) | SELECT "Date" FROM table_25162 WHERE "Driver" = 'Robert Pressley' |
Which upper level classes do not require 496 ? | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, program_course WHERE NOT COURSE_1.course_id IN (SELECT course_prerequisite.pre_course_id FROM course AS COURSE_0, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.cours... |
Give me the minimum and maximum bathroom count among all the apartments. | CREATE TABLE apartment_facilities (apt_id number,facility_code text)CREATE TABLE apartment_bookings (apt_booking_id number,apt_id number,guest_id number,booking_status_code text,booking_start_date time,booking_end_date time)CREATE TABLE apartments (apt_id number,building_id number,apt_type_code text,apt_number text,bat... | SELECT MIN(bathroom_count), MAX(bathroom_count) FROM apartments |
what is the next date after april 8 ? | CREATE TABLE table_204_833 (id number,"game" number,"date" text,"team" text,"score" text,"high points" text,"high rebounds" text,"high assists" text,"location\nattendance" text,"record" text) | SELECT "date" FROM table_204_833 WHERE "game" = (SELECT "game" FROM table_204_833 WHERE "date" = 'april 8') + 1 |
For CEE 650 next semester , are there any sections not on Monday ? | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday... | SELECT DISTINCT course_offering.section_number FROM course, course_offering, semester WHERE course_offering.monday = 'N' AND course.course_id = course_offering.course_id AND course.department = 'CEE' AND course.number = 650 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.ye... |
count the number of patients whose marital status is single and lab test category is blood gas? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "SINGLE" AND lab."CATEGORY" = "Blood Gas" |
For those records from the products and each product's manufacturer, find founder and the average of revenue , and group by attribute founder, and visualize them by a bar chart, I want to list X in descending order please. | 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 Founder, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder DESC |
What is the average rank that has cia world factbook as the source and a year prior to 2005? | CREATE TABLE table_name_29 (rank INTEGER,source VARCHAR,year VARCHAR) | SELECT AVG(rank) FROM table_name_29 WHERE source = "cia world factbook" AND year < 2005 |
Who placed in t5 and scored 73-69-68=210? | CREATE TABLE table_name_76 (player VARCHAR,place VARCHAR,score VARCHAR) | SELECT player FROM table_name_76 WHERE place = "t5" AND score = 73 - 69 - 68 = 210 |
which was the last canal opened in scotland ? | CREATE TABLE table_203_594 (id number,"canal" text,"length (miles)" number,"locks" number,"max length (ft)" number,"width (ft)" number,"year opened" number,"year abandoned" number,"year restored" number) | SELECT "canal" FROM table_203_594 WHERE "year opened" = (SELECT MAX("year opened") FROM table_203_594) |
show me all flights from SAN FRANCISCO to DENVER | CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arr... | 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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '... |
how many episodes were shown in season 1 ? | CREATE TABLE table_203_349 (id number,"no. in\nseries" number,"no. in\nseason" number,"title" text,"directed by" text,"written by" text,"original air date" text,"production\ncode" text,"u.s. viewers\n(millions)" number) | SELECT COUNT("title") FROM table_203_349 |
as of october 25 , 2005 , how many voters are either democratic or republican ? | CREATE TABLE table_200_35 (id number,"party" text,"active voters" number,"inactive voters" number,"total voters" number,"percentage" text) | SELECT SUM("total voters") FROM table_200_35 WHERE "party" IN ('democratic', 'republican') |
What is the lowest silver that has 2 as the bronze, with a total greater than 4? | CREATE TABLE table_name_33 (silver INTEGER,bronze VARCHAR,total VARCHAR) | SELECT MIN(silver) FROM table_name_33 WHERE bronze = 2 AND total > 4 |
How many Bronzes that has a Nation of italy? | CREATE TABLE table_name_75 (bronze INTEGER,nation VARCHAR) | SELECT MAX(bronze) FROM table_name_75 WHERE nation = "italy" |
Name the driver passenger for 394 points | CREATE TABLE table_16941304_4 (driver___passenger VARCHAR,points VARCHAR) | SELECT driver___passenger FROM table_16941304_4 WHERE points = 394 |
Who is the director when the title is 'believers'? | CREATE TABLE table_31326 ("Series #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text) | SELECT "Directed by" FROM table_31326 WHERE "Title" = 'Believers' |
My answers on Stack Exchange. | 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,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Ta... | SELECT * FROM Posts WHERE OwnerUserId = 3422261 |
How many games lost for teams with over 6 games? | CREATE TABLE table_name_46 (lost INTEGER,games INTEGER) | SELECT MIN(lost) FROM table_name_46 WHERE games > 6 |
How many marriages between women have % same-sex marriages of 1.06? | CREATE TABLE table_23098 ("Year" text,"Marriages between men" real,"Marriages between women" real,"Same-sex marriages" real,"Total marriages" real,"% same-sex marriages" text) | SELECT "Marriages between women" FROM table_23098 WHERE "% same-sex marriages" = '1.06' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.