table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_27158 ( "Tie no" real, "Home team" text, "Score 1" text, "Away team" text, "Attendance" real, "Date" text )
Who was the home team who played plymouth argyle?
SELECT "Home team" FROM table_27158 WHERE "Away team" = 'Plymouth Argyle'
CREATE TABLE table_21919 ( "Year" real, "Date" text, "Driver" text, "Manufacturer" text, "Laps" real, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text )
What manufacturer won the race on November 2?
SELECT "Manufacturer" FROM table_21919 WHERE "Date" = 'November 2'
CREATE TABLE table_26998135_2 ( manner_of_departure VARCHAR, date_of_appointment VARCHAR )
What is the manner of departure for the date of appointment 24 may 2010?
SELECT manner_of_departure FROM table_26998135_2 WHERE date_of_appointment = "24 May 2010"
CREATE TABLE table_68809 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
What position had notes of 20km and a year earlier than 2002?
SELECT "Position" FROM table_68809 WHERE "Notes" = '20km' AND "Year" < '2002'
CREATE TABLE table_37303 ( "Medal" text, "Name" text, "Games" text, "Sport" text, "Event" text )
At which games did Tunisia win a bronze in the men's 1500 m freestyle?
SELECT "Games" FROM table_37303 WHERE "Medal" = 'bronze' AND "Event" = 'men''s 1500 m freestyle'
CREATE TABLE table_72211 ( "Taxonomy" text, "Species in the world" real, "Species in Peru" real, "Species in the Peruvian Amazon" real, "Peru Vs. world (Percent)" real, "Peruvian Amazon Vs. Peru (Percent)" real )
what's the total number of species in the peruvian amazon with 8411 species in the world
SELECT COUNT("Species in the Peruvian Amazon") FROM table_72211 WHERE "Species in the world" = '8411'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
when was the first time in 12/this year that patient 015-59552 was prescribed for a medication?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-59552')) AND DATETIME(medication.drugstarttime, 'start of ...
CREATE TABLE table_46242 ( "School" text, "Location" text, "Founded" real, "Enrollment" real, "Nickname" text )
What is the most recent year founded with an enrollment of 42,708?
SELECT MAX("Founded") FROM table_46242 WHERE "Enrollment" = '42,708'
CREATE TABLE table_test_29 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "trauma" bool, "renal_disease" bool, "creatinine_clearance_cl" float, "hemorrhagic_stroke" ...
systolic blood pressure ( supine ) <= 90 mmhg;
SELECT * FROM table_test_29 WHERE systolic_blood_pressure_sbp <= 90
CREATE TABLE table_name_2 ( slalom VARCHAR, country VARCHAR )
What Slalom was Switzerland in?
SELECT slalom FROM table_name_2 WHERE country = "switzerland"
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 t...
Calculate the average age of patients with aortic insufficiency re-do sternotomy aortic valve replacement who stayed in hospital for 10 days.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.days_stay = "10"
CREATE TABLE Catalog_Structure ( catalog_level_number INTEGER, catalog_id INTEGER, catalog_level_name VARCHAR(50) ) CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, previous_entry_id INTEGER, next_entry_id INTEGER, cata...
What are the names of catalog entries with level number 8, and count them by a bar chart, and order by the X in descending.
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name DESC
CREATE TABLE table_69264 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Name the date for hard surface and tournament of fort walton beach
SELECT "Date" FROM table_69264 WHERE "Surface" = 'hard' AND "Tournament" = 'fort walton beach'
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE course ( course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) )...
How many departments for each building? Draw a bar chart, show Y from high to low order.
SELECT building, COUNT(building) FROM department GROUP BY building ORDER BY COUNT(building) DESC
CREATE TABLE table_20745444_1 ( tar_heels_points VARCHAR, result VARCHAR )
How many results finished in a loss?
SELECT COUNT(tar_heels_points) FROM table_20745444_1 WHERE result = "Loss"
CREATE TABLE table_name_36 ( date VARCHAR, visitor VARCHAR, home VARCHAR )
What was the date of the game when Colorado was the visiting team and Chicago was the home team?
SELECT date FROM table_name_36 WHERE visitor = "colorado" AND home = "chicago"
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 t...
how many patients under the age of 55 had drug route as td?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "55" AND prescriptions.route = "TD"
CREATE TABLE table_name_11 ( points INTEGER, podiums VARCHAR, wins VARCHAR, season VARCHAR )
What is the average number of points in the 2012 season, which has less than 1 wins and less than 0 podiums?
SELECT AVG(points) FROM table_name_11 WHERE wins < 1 AND season = "2012" AND podiums < 0
CREATE TABLE roller_coaster ( Status VARCHAR, LENGTH VARCHAR, Height VARCHAR )
Show the statuses of roller coasters longer than 3300 or higher than 100.
SELECT Status FROM roller_coaster WHERE LENGTH > 3300 OR Height > 100
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 te...
find the icu stay id for the patient with patient id 3343.
SELECT prescriptions.icustay_id FROM prescriptions WHERE prescriptions.subject_id = "3343"
CREATE TABLE table_62201 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
When was the result 0 3?
SELECT "Date" FROM table_62201 WHERE "Result" = '0–3'
CREATE TABLE table_13197 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the score if Millwall is the Home Team?
SELECT "Score" FROM table_13197 WHERE "Home team" = 'millwall'
CREATE TABLE table_80426 ( "Season" text, "Team Name" text, "Games" real, "Losses" real, "Points" real )
What's the lowest number of points with fewer than 8 losses and fewer than 24 games for the vancouver burrards?
SELECT MIN("Points") FROM table_80426 WHERE "Losses" < '8' AND "Team Name" = 'vancouver burrards' AND "Games" < '24'
CREATE TABLE table_204_360 ( id number, "year" number, "host" text, "gold" text, "silver" text, "bronze" text )
which years did chile place silver or bronze ?
SELECT "year" FROM table_204_360 WHERE "silver" = 'chile' OR "bronze" = 'chile'
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 ) ...
what is the number of patients whose marital status is single and procedure long title is insertion of one vascular stent?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.long_title = "Insertion of one vascular stent"
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by time.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
calculate the difference between patient 010-1155's total output and the total input on the last icu visit.
SELECT (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 = '010-1155') AND NOT patient.unitdischarge...
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is minimum age of patients whose admission type is emergency and primary disease is st elevated myocardial infarction\cardiac cath?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH"
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, ...
what are the five most frequently performed procedures for a patient who was previously diagnosed with osteomyelitis - extremity within 2 months?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'osteomyelitis - extremity') AS t1 JOIN (...
CREATE TABLE table_74958 ( "Ranking" real, "Nationality" text, "Name" text, "Years" text, "ICFC" real, "FCWC" real, "Total" real )
What is the lowest ranking associated with a total of 23?
SELECT MIN("Ranking") FROM table_74958 WHERE "Total" = '23'
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,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...
For those employees who was hired before 2002-06-21, return a scatter chart about the correlation between employee_id and department_id .
SELECT EMPLOYEE_ID, DEPARTMENT_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
provide the number of patients whose ethnicity is hispanic/latino - puerto rican and procedure short title is oth periton adhesiolysis?
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.short_title = "Oth periton adhesiolysis"
CREATE TABLE table_name_22 ( city VARCHAR, name VARCHAR )
Name the city for athous lavrensis
SELECT city FROM table_name_22 WHERE name = "athous lavrensis"
CREATE TABLE table_name_88 ( competition VARCHAR, venue VARCHAR, opponent VARCHAR )
When the venue is away and the opponents are the bracknell bees, what is the competition?
SELECT competition FROM table_name_88 WHERE venue = "away" AND opponent = "bracknell bees"
CREATE TABLE table_20896 ( "Player" text, "Team" text, "Matches" real, "Wickets" real, "Average" text, "Best Bowling" text )
What was the best bowling score when the average was 23.33?
SELECT "Best Bowling" FROM table_20896 WHERE "Average" = '23.33'
CREATE TABLE table_name_88 ( race VARCHAR, time VARCHAR )
Who holds the time of 17:11.572?
SELECT race FROM table_name_88 WHERE time = "17:11.572"
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE T...
all flights from BOSTON to WASHINGTON on 11 10
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 = 'WASHINGTON' AND date_day.day_number = 10 AND date_day.month_number = 11 A...
CREATE TABLE table_47673 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What is 1st Leg, when 2nd Leg is 0-1?
SELECT "1st leg" FROM table_47673 WHERE "2nd leg" = '0-1'
CREATE TABLE table_21977704_1 ( chassis VARCHAR, constructor VARCHAR )
Name the chassis for alta
SELECT chassis FROM table_21977704_1 WHERE constructor = "Alta"
CREATE TABLE table_46491 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
what is the round when the college is north carolina and the overall is more than 124?
SELECT SUM("Round") FROM table_46491 WHERE "College" = 'north carolina' AND "Overall" > '124'
CREATE TABLE table_name_4 ( original_name VARCHAR, country VARCHAR )
Name the original name for the one from bulgaria
SELECT original_name FROM table_name_4 WHERE country = "bulgaria"
CREATE TABLE table_name_30 ( result VARCHAR, distance VARCHAR, winner_or_2nd VARCHAR )
What is the result for the distance of 10f, and a winner or 2nd of Lampra?
SELECT result FROM table_name_30 WHERE distance = "10f" AND winner_or_2nd = "lampra"
CREATE TABLE actor ( actor_id SMALLINT UNSIGNED, first_name VARCHAR(45), last_name VARCHAR(45), last_update TIMESTAMP ) CREATE TABLE store ( store_id TINYINT UNSIGNED, manager_staff_id TINYINT UNSIGNED, address_id SMALLINT UNSIGNED, last_update TIMESTAMP ) CREATE TABLE payment ( pa...
What are the names and ids of the different categories? Show me the bar chart, sort from low to high by the X-axis.
SELECT T2.name, T1.category_id FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id ORDER BY T2.name
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, ...
was the respiration value of patient 027-120551 last measured on the last icu visit greater than the value second to last measured on the last icu visit?
SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120551') AND NOT patient.unitdischargetime ...
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 ) ...
count the number of patients who were admitted in urgent care and stayed in the hospital for 6 days.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.days_stay = "6"
CREATE TABLE table_name_43 ( horse VARCHAR, jockey VARCHAR )
What horse for jara?
SELECT horse FROM table_name_43 WHERE jockey = "jara"
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 ) C...
what is the number of patients whose ethnicity is white - russian and procedure long title is dorsal and dorsolumbar fusion of the posterior column, posterior technique?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND procedures.long_title = "Dorsal and dorsolumbar fusion of the posterior column, posterior technique"
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE diagnoses_i...
patient 70267 was diagnosed with a cl skul base fx/brf coma?
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cl skul base fx/brf coma') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70267)
CREATE TABLE table_name_82 ( report VARCHAR, date VARCHAR )
Name the report for 6 may
SELECT report FROM table_name_82 WHERE date = "6 may"
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, ...
SELECT Id, DisplayName, WebsiteUrl, Location, AccountId FROM Users;.
SELECT Id, DisplayName, WebsiteUrl, Location, AccountId FROM Users
CREATE TABLE table_79233 ( "School" text, "Mascot" text, "Location" text, "Enrollment" real, "IHSAA Class" text, "IHSAA Football Class" text, "County" text )
What IHSAA Football Class has 20 elkhart as the county?
SELECT "IHSAA Football Class" FROM table_79233 WHERE "County" = '20 elkhart'
CREATE TABLE table_13480122_5 ( high_points VARCHAR, score VARCHAR )
who is the the high points with score being w 117 93
SELECT high_points FROM table_13480122_5 WHERE score = "W 117–93"
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 ) CRE...
Unique users with post that contain {mhchem}.
SELECT DISTINCT OwnerUserId FROM Posts WHERE 'body' LIKE '%{mhchem}%'
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id ...
what was the dose of insulin that during their first hospital encounter patient 66015 was last prescribed?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 66015 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'insulin' ORDER BY prescriptions.startdate DESC LIMIT 1
CREATE TABLE table_name_69 ( away_team VARCHAR, venue VARCHAR )
What is the away team at victoria park?
SELECT away_team FROM table_name_69 WHERE venue = "victoria park"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
find out the number of alive patients who have been diagnosed with abscess of intestine.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.long_title = "Abscess of intestine"
CREATE TABLE Timed_Locations_of_Things ( thing_id INTEGER, Date_and_Time DATETIME, Location_Code CHAR(15) ) CREATE TABLE Customer_Events ( Customer_Event_ID INTEGER, customer_id INTEGER, date_moved_in DATETIME, property_id INTEGER, resident_id INTEGER, thing_id INTEGER ) CREATE TAB...
What are the number of the distinct move in dates of the residents?, could you show in ascending by the total number?
SELECT date_moved_in, COUNT(date_moved_in) FROM Residents ORDER BY COUNT(date_moved_in)
CREATE TABLE table_name_7 ( american VARCHAR, initial_syllable_open_semi_open_unstressed_vowels VARCHAR )
What is American, when Initial-Syllable Open/Semi-Open Unstressed Vowels is 'y /a , /'?
SELECT american FROM table_name_7 WHERE initial_syllable_open_semi_open_unstressed_vowels = "y /aɪ, ɨ/"
CREATE TABLE table_10840 ( "Year" real, "Title" text, "Role" text, "Leading Lady" text, "Director" text )
Who is the leading lady in a yank in the r.a.f.?
SELECT "Leading Lady" FROM table_10840 WHERE "Title" = 'a yank in the r.a.f.'
CREATE TABLE table_45770 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What is the home team with the ny rangers as the visitor team?
SELECT "Home" FROM table_45770 WHERE "Visitor" = 'ny rangers'
CREATE TABLE table_73659 ( "Episode no." real, "Airdate" text, "Viewers" real, "BBC Three weekly ranking" text, "Cable rank" text )
What is the cable rank for episode no. 4?
SELECT "Cable rank" FROM table_73659 WHERE "Episode no." = '4'
CREATE TABLE table_name_8 ( commissioned VARCHAR, pennant_number VARCHAR )
On what date was the ship with a Pennant number of Q144 commissioned?
SELECT commissioned FROM table_name_8 WHERE pennant_number = "q144"
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeri...
what is the average hospital cost that involves a procedure, called stress ulcer treatment - antacids until 2104?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'stress ulcer treatment - antacids')) AND STR...
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid ...
has patient 48706 undergone any procedures the previous year?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 48706) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
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 t...
what number of divorced patients have been daignosed with parapelgia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.long_title = "Paraplegia"
CREATE TABLE table_203_563 ( id number, "#" number, "judge" text, "state" text, "born/died" text, "active" text, "chief" text, "senior" text, "appointed by" text, "reason for\ntermination" text )
how many judges were appointed by president carter ?
SELECT COUNT("judge") FROM table_203_563 WHERE "appointed by" = 'carter'
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
Display a line chart for what is the average prices of wines for each each?
SELECT Year, AVG(Price) FROM wine GROUP BY Year
CREATE TABLE table_name_11 ( round INTEGER, position VARCHAR, college_junior_club_team__league_ VARCHAR )
Which Round has a Position of lw, and a College/Junior/Club Team (League) of swift current broncos (wchl)?
SELECT AVG(round) FROM table_name_11 WHERE position = "lw" AND college_junior_club_team__league_ = "swift current broncos (wchl)"
CREATE TABLE table_204_376 ( id number, "date" text, "venue" text, "opponents" text, "score" text, "competition" text )
who was the last opponent on the list , chronologically ?
SELECT "opponents" FROM table_204_376 ORDER BY "date" DESC LIMIT 1
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId n...
Find [A] ([B] or [C]). Search questions by tags intersection and union.
SELECT q.Id AS "post_link", q.Tags, q.LastActivityDate, q.Score, q.ViewCount, q.AnswerCount, q.OwnerUserId AS "user_link" FROM Posts AS q JOIN PostTags AS pt ON pt.PostId = q.Id JOIN PostTags AS pt2 ON pt2.PostId = q.Id JOIN Tags AS t ON t.Id = pt.TagId JOIN Tags AS t2 ON t2.Id = pt2.TagId JOIN TagSynonyms AS ts ON ts....
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, Revision...
Activity on Stack by Time.
SELECT COUNT(p.Id) AS count_of_feature, DATE(p.CreationDate) AS datetime, t.Name AS name FROM Posts AS p INNER JOIN PostTypes AS t ON p.PostTypeId = t.Id LEFT JOIN Posts AS pp ON p.ParentId = pp.Id WHERE (p.Tags LIKE '%##tagname##%') OR (pp.Tags LIKE '%##tagname##%') GROUP BY DATE(p.CreationDate), t.Name ORDER BY DATE(...
CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train ( Train_ID int, Name text, Time text, Service text ) CREATE TABLE t...
A bar chart shows how many locations, and sort from high to low by the X.
SELECT Location, COUNT(Location) FROM station GROUP BY Location ORDER BY Location DESC
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text,...
what are the five most common specimen tests performed since 6 years ago?
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 5
CREATE TABLE table_1976898_1 ( post_code INTEGER, chinese_name__simplified___traditional_ VARCHAR )
What's the post code of the county with the Chinese name / ?
SELECT MIN(post_code) FROM table_1976898_1 WHERE chinese_name__simplified___traditional_ = "潜山县 / 潛山縣"
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 ) C...
what is the number of patients whose days of hospital stay is greater than 10 and drug name is phenytoin sodium?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "10" AND prescriptions.drug = "Phenytoin Sodium"
CREATE TABLE table_18461045_1 ( michigan VARCHAR, indiana VARCHAR )
What was the little league team from Michigan when the little league team from Indiana was Terre Haute North LL Terre Haute?
SELECT michigan FROM table_18461045_1 WHERE indiana = "Terre Haute North LL Terre Haute"
CREATE TABLE table_2562572_8 ( population__2002_ INTEGER, population__2011_ VARCHAR )
What was the lowes population of 2002 when the 2011 population was 30076?
SELECT MIN(population__2002_) FROM table_2562572_8 WHERE population__2011_ = 30076
CREATE TABLE table_41451 ( "Rank" real, "Location" text, "Total Passengers" real, "Annual change" text, "Capacity" real, "Capacity in use" text )
What is the total capacity of the airport ranked less than 7, has a capacity in use of 114.2%, and has less than 13,699,657 total passengers?
SELECT COUNT("Capacity") FROM table_41451 WHERE "Rank" < '7' AND "Capacity in use" = '114.2%' AND "Total Passengers" < '13,699,657'
CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE faculty ( facid number, lname text, fname text, rank text, ...
What are the first names of the professors who do not play Canoeing or Kayaking as activities?
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE cours...
What are the classes that are available this Winter ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2016
CREATE TABLE table_9935 ( "Tournament" text, "Surface" text, "Week" text, "Winner" text, "Finalist" text, "Semifinalists" text )
Who is the Finalist, when the Surface is Clay, and when the Semifinalist is Yevgeny Kafelnikov Juan Carlos Ferrero (2)?
SELECT "Finalist" FROM table_9935 WHERE "Surface" = 'clay' AND "Semifinalists" = 'yevgeny kafelnikov juan carlos ferrero (2)'
CREATE TABLE table_204_55 ( id number, "date" text, "time" text, "opponent#" text, "rank#" text, "site" text, "tv" text, "result" text, "attendance" number )
which dates had below 80,000 in attendance ?
SELECT "date" FROM table_204_55 WHERE "attendance" < 80000
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 patient ( ...
among patients who were prescribed potassium chloride inj 2 meq/ml vial after having been diagnosed with acute respiratory distress calculate the four year survival rate.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
CREATE TABLE table_22680 ( "Name" text, "Career" text, "Matches" real, "Overs" text, "Maidens" real, "Runs" real, "Wickets" real, "Average" text, "Best" text, "5w" real, "10w" real )
What was the Best score during the game played from 1971-1984?
SELECT "Best" FROM table_22680 WHERE "Career" = '1971-1984'
CREATE TABLE table_name_90 ( score VARCHAR, competition VARCHAR, season VARCHAR )
What was the score of the league cup in the 2007-08 season?
SELECT score FROM table_name_90 WHERE competition = "league cup" AND season = "2007-08"
CREATE TABLE table_name_57 ( derivatives VARCHAR, launch_date VARCHAR )
Which Derivative has a Launch Date of july 15, 1970; 15:05 gmt?
SELECT derivatives FROM table_name_57 WHERE launch_date = "july 15, 1970; 15:05 gmt"
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 )
What is the total number of each ship type? Give me a bar chart, and list Type in desc order.
SELECT Type, COUNT(Type) FROM ship GROUP BY Type ORDER BY Type DESC
CREATE TABLE table_name_41 ( country VARCHAR, player VARCHAR )
Which country has the player Ted Schulz?
SELECT country FROM table_name_41 WHERE player = "ted schulz"
CREATE TABLE table_29361 ( "Vertical" real, "Horizontal" real, "Aspect ratio" text, "Pixel aspect ratio" text, "Scanning" text, "Frame rate ( Hz )" text )
What was the minimum vertical measurement if the aspect ratio is 16:9 and scanning is interlaced?
SELECT MIN("Vertical") FROM table_29361 WHERE "Aspect ratio" = '16:9' AND "Scanning" = 'interlaced'
CREATE TABLE table_name_39 ( tie_no VARCHAR, away_team VARCHAR )
What was the tie no when Oxford city was the away team?
SELECT tie_no FROM table_name_39 WHERE away_team = "oxford city"
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDat...
Number of questions tagged with Jetbrains.
SELECT TagName AS Tag, Count FROM Tags WHERE TagName LIKE '%fhir%'
CREATE TABLE table_74419 ( "Name" text, "Country" text, "Years" text, "Games" real, "Minutes" real, "Conceded" real, "Shutouts" real, "Int. caps" real )
When 2010 is the year what is the game?
SELECT "Games" FROM table_74419 WHERE "Years" = '2010'
CREATE TABLE table_66659 ( "Wimmera FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
How many Draws have Wins larger than 7, and a Wimmera FL of nhill, and Losses larger than 8?
SELECT SUM("Draws") FROM table_66659 WHERE "Wins" > '7' AND "Wimmera FL" = 'nhill' AND "Losses" > '8'
CREATE TABLE table_204_206 ( id number, "saros" number, "member" number, "date" text, "time\n(greatest)\nutc" text, "type" text, "location\nlat,long" text, "gamma" number, "mag." number, "width\n(km)" number, "duration\n(min:sec)" text, "ref" number )
when did the first solar saros with a magnitude of greater than 1.00 occur ?
SELECT "date" FROM table_204_206 WHERE "mag." > 1.00 ORDER BY "date" LIMIT 1
CREATE TABLE table_27948565_1 ( moto2_winner VARCHAR, circuit VARCHAR )
Name the total number of moto2 winners for laguna seca
SELECT COUNT(moto2_winner) FROM table_27948565_1 WHERE circuit = "Laguna Seca"
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number...
so what's the maximum neutrophils value of patient 64519 in 07/2104?
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64519) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'neutrophils') AND STRFTIME('%y-%m', labevents.charttime) = '2104-07'
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 t...
provide the number of patients whose admission year is less than 2120 and drug route is oral?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2120" AND prescriptions.route = "ORAL"
CREATE TABLE table_15937 ( "UN Operation name" text, "UN Operation title" text, "Location" text, "Dates of Australian involvement" text, "Number of Australians involved" text, "Australian role" text )
What is the UN operation title with the UN operation name, Uncok?
SELECT "UN Operation title" FROM table_15937 WHERE "UN Operation name" = 'UNCOK'
CREATE TABLE table_2767 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text )
What is the production code for Episode 153 in the series?
SELECT MIN("Production code") FROM table_2767 WHERE "Series #" = '153'
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 )
For those records from the products and each product's manufacturer, visualize the relationship between code and manufacturer , and group by attribute headquarter.
SELECT T1.Code, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter