table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE table_65794 ( "Edition" text, "Year" text, "City" text, "Country" text, "Date" text, "No. of Events" real, "Top Team" text )
How many Events have a Country of trinidad and tobago, and a Date of march 30-april 1?
SELECT "No. of Events" FROM table_65794 WHERE "Country" = 'trinidad and tobago' AND "Date" = 'march 30-april 1'
CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VA...
Return the lot details of lots that belong to investors with details 'l', and count them by a bar chart, and I want to rank by the bar in descending.
SELECT lot_details, COUNT(lot_details) FROM Investors AS T1 JOIN Lots AS T2 ON T1.investor_id = T2.investor_id WHERE T1.Investor_details = "l" GROUP BY lot_details ORDER BY lot_details DESC
CREATE TABLE table_41912 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text )
When was Shannon Long the Centerfold model?
SELECT "Date" FROM table_41912 WHERE "Centerfold model" = 'shannon long'
CREATE TABLE table_54093 ( "Name" text, "GNIS Feature ID" real, "State" text, "County" text, "Type" text, "USGS 7.5' Map" text )
What is the total GNIS Feature ID with a County of idaho?
SELECT SUM("GNIS Feature ID") FROM table_54093 WHERE "County" = 'idaho'
CREATE TABLE table_71517 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner-up" text )
Which runner-up has a 10 strokes margin of victory?
SELECT "Runner-up" FROM table_71517 WHERE "Margin of victory" = '10 strokes'
CREATE TABLE Research_Staff ( staff_id INTEGER, employer_organisation_id INTEGER, staff_details VARCHAR(255) ) CREATE TABLE Documents ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR(2...
What are the ids and details for all organizations that have grants of more than 6000 dollars.
SELECT T2.organisation_details, T1.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_details
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid num...
how much chest tube did patient 013-28507 produce today?
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 = '013-28507')) AND intakeoutput.celllabel = 'chest...
CREATE TABLE table_1341472_20 ( first_elected INTEGER )
What is the first election year listed?
SELECT MIN(first_elected) FROM table_1341472_20
CREATE TABLE table_16878 ( "Yard Name" text, "Location (city, state)" text, "1st Ship Delivery Date" text, "Ship Types Delivered" text, "Total Number of Ways" text, "total vessels built" text )
When was the delevery date when there were 12 ways of delivery?
SELECT "1st Ship Delivery Date" FROM table_16878 WHERE "Total Number of Ways" = '12 ways'
CREATE TABLE table_23214055_2 ( district VARCHAR, nairs VARCHAR )
Name the district for nairs 8.2
SELECT district FROM table_23214055_2 WHERE nairs = "8.2"
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE Users ( Id number, Reputation number,...
Top users: Santiago de Chile. List of Santiago-based users by reputation score. Forked from an original query by BoltClock.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%santiago%chile%' ORDER BY Reputation DESC
CREATE TABLE college ( cname text, state text, enr number ) CREATE TABLE player ( pid number, pname text, ycard text, hs number ) CREATE TABLE tryout ( pid number, cname text, ppos text, decision text )
What are the name of the players who received a card in descending order of the hours of training?
SELECT pname FROM player WHERE ycard = 'yes' ORDER BY hs DESC
CREATE TABLE table_64375 ( "Chord" text, "Root" text, "Major third" text, "Augmented fifth" text, "Minor seventh" text )
What is the listed chord for a Minor seventh of F?
SELECT "Chord" FROM table_64375 WHERE "Minor seventh" = 'f'
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_Per...
Return a bar chart about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road, and list in descending by the Y-axis.
SELECT ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road ORDER BY COUNT(ACC_Road) DESC
CREATE TABLE table_name_42 ( date VARCHAR, total VARCHAR, venue VARCHAR )
What day was the total smaller than 19 at Venue of anz stadium?
SELECT date FROM table_name_42 WHERE total < 19 AND venue = "anz stadium"
CREATE TABLE table_name_74 ( connection_with_australia VARCHAR, connection_with_america VARCHAR )
What is the connection with Australia when the connection with America shows born in the u.s.; mother is u.s. citizen?
SELECT connection_with_australia FROM table_name_74 WHERE connection_with_america = "born in the u.s.; mother is u.s. citizen"
CREATE TABLE table_65430 ( "Season" text, "1st round" text, "2nd round" text, "3rd round" text, "Finals" text )
Which 3rd round has a 1st round of ?
SELECT "3rd round" FROM table_65430 WHERE "1st round" = '—'
CREATE TABLE table_78961 ( "Goalkeeper" text, "Goals" real, "Matches" real, "Average" real, "Team" text )
What is the highest Average, when Goals is '34', and when Matches is less than 37?
SELECT MAX("Average") FROM table_78961 WHERE "Goals" = '34' AND "Matches" < '37'
CREATE TABLE table_40902 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the number of silver where the rank is higher than 4 and bronze is smaller than 1?
SELECT COUNT("Silver") FROM table_40902 WHERE "Rank" > '4' AND "Bronze" < '1'
CREATE TABLE table_27713030_11 ( team VARCHAR, score VARCHAR )
Who was the opponent for the game with a score of w 94 88 (ot)?
SELECT team FROM table_27713030_11 WHERE score = "W 94–88 (OT)"
CREATE TABLE table_name_68 ( high_rebounds VARCHAR, team VARCHAR )
What is the High rebounds with a Team that is charlotte?
SELECT high_rebounds FROM table_name_68 WHERE team = "charlotte"
CREATE TABLE table_18791 ( "City of license /Market" text, "Station" text, "Channel TV ( DT )" text, "Owned since" text, "Primary affiliation" text )
What city has channel tv (dt) 25 (31)?
SELECT "City of license /Market" FROM table_18791 WHERE "Channel TV ( DT )" = '25 (31)'
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationD...
Closed Status of All Questions by Reputation (including high-rep users). A graph what percentage of questions are closed, grouped by the reputation of the users who asked them. This graph includes high-rep users. For a zoomed in view of lower rep users (more interesting IMO) see https://data.stackexchange.com/stackover...
SELECT AVG(CAST(ROUND(Reputation, -FLOOR(LOG(10, Reputation))) AS INT)) AS UserReputation, SUM(CASE WHEN ClosedDate IS NULL THEN 1 ELSE 0 END) / CAST(COUNT(Posts.Id) AS FLOAT) AS "PercentOpen" FROM Posts INNER JOIN Users ON (Users.Id = Posts.OwnerUserId) WHERE PostTypeId = 1 GROUP BY ROUND(Reputation, -FLOOR(LOG(10, Re...
CREATE TABLE employee ( Id VARCHAR )
Find the total number of employees.
SELECT COUNT(*) FROM employee
CREATE TABLE table_name_73 ( game VARCHAR, road_team VARCHAR, date VARCHAR )
What game number was played on April 23, with Boston as the road team?
SELECT game FROM table_name_73 WHERE road_team = "boston" AND date = "april 23"
CREATE TABLE table_26558_1 ( record_low VARCHAR, precip VARCHAR )
What was the record lowest temperature with a precipitation of 1.71 in.?
SELECT record_low FROM table_26558_1 WHERE precip = "1.71 in."
CREATE TABLE table_52838 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
In which venue did the home team score 10.11 (71)
SELECT "Venue" FROM table_52838 WHERE "Home team score" = '10.11 (71)'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
what are the hospitals admission times of patient 002-35416 since 4 years ago?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '002-35416' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-4 year')
CREATE TABLE table_name_35 ( country VARCHAR, player VARCHAR )
What country is Nick Price from?
SELECT country FROM table_name_35 WHERE player = "nick price"
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
count the number of patients who are dead after being diagnosed with pneumothorax during the same month the last year.
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumothorax') AS t1 GROUP BY t1.uniquepid HAVING MIN(t1.diagnos...
CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
Return me a bar chart to show the average experience working length of journalists working on different role type.
SELECT Work_Type, AVG(Years_working) FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_ID = t2.journalist_ID GROUP BY t2.Work_Type
CREATE TABLE table_57257 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the score for the home team for the venue glenferrie oval?
SELECT "Home team score" FROM table_57257 WHERE "Venue" = 'glenferrie oval'
CREATE TABLE table_53093 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the attendence of the game on 26 April 1948 and an away team of Hawthorn?
SELECT "Crowd" FROM table_53093 WHERE "Date" = '26 april 1948' AND "Away team" = 'hawthorn'
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 the number of patients who passed away in or before the year 2131 had lab test item id 51248.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2131.0" AND lab.itemid = "51248"
CREATE TABLE party ( Party_ID int, Party_Theme text, Location text, First_year text, Last_year text, Number_of_hosts int ) 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...
Count the last year of parties with theme 'Spring' or 'Teqnology' with a bar grpah, I want to rank in descending by the Y.
SELECT Last_year, COUNT(Last_year) FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology" GROUP BY Last_year ORDER BY COUNT(Last_year) DESC
CREATE TABLE table_20431 ( "Episode Number" real, "Air Date" text, "Guest Host" text, "Musical Guest (Song performed)" text, "Who knows the most about the guest host? panelists" text, "Coat Of Cash Wearing Celebrity" text )
Name the musical guest for panelists jermaine jackson and nora sands
SELECT "Musical Guest (Song performed)" FROM table_20431 WHERE "Who knows the most about the guest host? panelists" = 'Jermaine Jackson and Nora Sands'
CREATE TABLE farm ( Farm_ID int, Year int, Total_Horses real, Working_Horses real, Total_Cattle real, Oxen real, Bulls real, Cows real, Pigs real, Sheep_and_Goats real ) CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE city ...
weekday , and could you order in ascending by the y-axis?
SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID ORDER BY COUNT(Year)
CREATE TABLE table_name_75 ( owner_s_ VARCHAR, team VARCHAR, driver_s_ VARCHAR )
Who is the owner of RSS Racing that driver Ryan Sieg belongs to?
SELECT owner_s_ FROM table_name_75 WHERE team = "rss racing" AND driver_s_ = "ryan sieg"
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number...
Posts with a score of 9.
SELECT Score, Id AS "post_link" FROM Posts WHERE Score = 9 AND TIME_TO_STR(CreationDate, '%YEAR') = 2016 ORDER BY CreationDate DESC
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
How many captains are in each rank, and show from low to high by the x axis please.
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank
CREATE TABLE table_74998 ( "Year" real, "Date" text, "Winner" text, "Result" text, "Loser" text, "Location" text )
What is the year when the Winner was the new york jets, with a Result of 24 17, played at giants stadium?
SELECT SUM("Year") FROM table_74998 WHERE "Winner" = 'new york jets' AND "Result" = '24–17' AND "Location" = 'giants stadium'
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, ...
how many hours since patient 006-124193 was admitted to hospital?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '006-124193' AND patient.hospitaldischargetime IS NULL
CREATE TABLE table_name_40 ( school VARCHAR, player VARCHAR )
What School did Terrence Jones play for?
SELECT school FROM table_name_40 WHERE player = "terrence jones"
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, ...
how many patients aged below 67 years had an elective admission type?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.age < "67"
CREATE TABLE table_51743 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the score of the away team where the home team scored 13.20 (98)?
SELECT "Away team score" FROM table_51743 WHERE "Home team score" = '13.20 (98)'
CREATE TABLE table_42191 ( "Name" text, "Start of Reign" real, "End of Reign" text, "Birth Name" text, "Title" text )
What is the end of reign for Dimitar Stojkovski?
SELECT "End of Reign" FROM table_42191 WHERE "Birth Name" = 'dimitar stojkovski'
CREATE TABLE table_name_14 ( writer VARCHAR, film VARCHAR )
Who is the writer of the film Run?
SELECT writer FROM table_name_14 WHERE film = "run"
CREATE TABLE trip ( id number, duration number, start_date text, start_station_name text, start_station_id number, end_date text, end_station_name text, end_station_id number, bike_id number, subscription_type text, zip_code number ) CREATE TABLE status ( station_id numb...
Count the number of trips that did not end in San Francisco city.
SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> "San Francisco"
CREATE TABLE table_name_3 ( partner VARCHAR, outcome VARCHAR, opponents_in_the_final VARCHAR )
WHich Partner has a Outcome of winner, and a Opponents in the final of rick leach jim pugh?
SELECT partner FROM table_name_3 WHERE outcome = "winner" AND opponents_in_the_final = "rick leach jim pugh"
CREATE TABLE table_22512 ( "Year" real, "1st Place Team" text, "2nd Place Team" text, "3rd Place Team" text, "4th Place Team" text, "Host Location" text )
How many years was the 2nd place team merchants, tampico, il?
SELECT COUNT("Year") FROM table_22512 WHERE "2nd Place Team" = 'Merchants, Tampico, IL'
CREATE TABLE table_name_3 ( analog_channel VARCHAR, digital_channel VARCHAR )
Digital channel of 32 belongs to what analog channel?
SELECT analog_channel FROM table_name_3 WHERE digital_channel = "32"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
what is the total number of inputs that patient 010-8740 has received on the first icu visit?
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-8740') AND NOT patient.unitdischargetime IS ...
CREATE TABLE table_14395920_2 ( winner VARCHAR, stage VARCHAR )
Who won stage 18?
SELECT winner FROM table_14395920_2 WHERE stage = 18
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 ) ...
give me the procedure icd9 code and drug type of subject id 18480.
SELECT procedures.icd9_code, prescriptions.drug_type FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "18480"
CREATE TABLE table_77997 ( "Round" text, "Date" text, "Opponent" text, "Venue" text, "Result" text )
What is the Round with a Opponent with blackburn?
SELECT "Round" FROM table_77997 WHERE "Opponent" = 'blackburn'
CREATE TABLE table_train_126 ( "id" int, "childhood_febrile_seizure" bool, "neurodegenerative_disease" bool, "cns_disease" bool, "head_injury" bool, "stroke" bool, "renal_disease" bool, "cerebrovascular_disease" bool, "hepatic_disease" bool, "headache" bool, "cardiovascular_d...
history of head trauma with prolonged loss of consciousness ( > 10 minutes ) or any neurological condition including stroke or seizure ( excluding childhood febrile seizure ) or history of migraine headache.
SELECT * FROM table_train_126 WHERE head_injury = 1 OR (neurological_disease = 1 OR stroke = 1 OR (seizure_disorder = 1 AND childhood_febrile_seizure = 0) OR headache = 1)
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 number of patients whose admission type is elective that had a procedure named umbilical vein catheterization.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Umbilical vein catheterization"
CREATE TABLE table_204_905 ( id number, "team" text, "wins" number, "losses" number, "win %" number, "gb" number )
how many teams won at least 85 games ?
SELECT COUNT("team") FROM table_204_905 WHERE "wins" >= 85
CREATE TABLE table_77982 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
Which school is in Riverside, CA?
SELECT "School" FROM table_77982 WHERE "Hometown" = 'riverside, ca'
CREATE TABLE table_name_9 ( area VARCHAR, years VARCHAR, name VARCHAR )
Which area has Years of 1 8, and a Name of broomfield school?
SELECT area FROM table_name_9 WHERE years = "1–8" AND name = "broomfield school"
CREATE TABLE aircraft ( Aircraft_ID int(11), Aircraft varchar(50), Description varchar(50), Max_Gross_Weight varchar(50), Total_disk_area varchar(50), Max_disk_Loading varchar(50) ) CREATE TABLE pilot ( Pilot_Id int(11), Name varchar(50), Age int(11) ) CREATE TABLE airport_aircraft...
List the names of aircrafts and the number of times it won matches Plot them as bar chart, and order by the X-axis in descending.
SELECT Aircraft, COUNT(*) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY Aircraft DESC
CREATE TABLE table_name_79 ( game_site VARCHAR, week VARCHAR )
What was the game site week 15?
SELECT game_site FROM table_name_79 WHERE week = 15
CREATE TABLE table_name_40 ( team VARCHAR, score VARCHAR )
Which Team has a Score of 89-123?
SELECT team FROM table_name_40 WHERE score = "89-123"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
count how many hospital visits patient 015-66570 has in this year.
SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '015-66570' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, ...
Are there classes in the morning that are RELIGION 347 ?
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'RELIGION' AND course.number = 347 AND semester.semester = 'WN' AND semester.semester_id = course...
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), CO...
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the average of manager_id bin hire_date by time in a bar chart, could you list from low to high by the the average of manager id please?
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(MANAGER_ID)
CREATE TABLE table_48797 ( "Rider" text, "Manufacturer" text, "Laps" text, "Time/Retired" text, "Grid" text )
Who is the rider with 22 laps and a +19.435 time/retired?
SELECT "Rider" FROM table_48797 WHERE "Laps" = '22' AND "Time/Retired" = '+19.435'
CREATE TABLE table_12534 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text, "Streak" text )
Which Opponent has a Score of 92 93?
SELECT "Opponent" FROM table_12534 WHERE "Score" = '92–93'
CREATE TABLE table_54830 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When st kilda played as the away team, what date was that?
SELECT "Date" FROM table_54830 WHERE "Away team" = 'st kilda'
CREATE TABLE table_29666 ( "Episode Air Date" text, "Audition City" text, "Audition Date" text, "Audition Venue" text, "Guest Fourth Judge" text )
List all episode air dates whose audition venues were Nego Quirido Sambadrome?
SELECT "Episode Air Date" FROM table_29666 WHERE "Audition Venue" = 'Nego Quirido Sambadrome'
CREATE TABLE table_name_44 ( year VARCHAR, venue VARCHAR, score VARCHAR )
when is the venue nikos goumas stadium and the score is 2 2 4 4 a.e.t. 6 5 pso?
SELECT year FROM table_name_44 WHERE venue = "nikos goumas stadium" AND score = "2–2 4–4 a.e.t. 6–5 pso"
CREATE TABLE table_name_49 ( Id VARCHAR )
what is 2005 when 2003 is A, 2007 is 2r and 2012 is 3r?
SELECT 2005 FROM table_name_49 WHERE 2003 = "a" AND 2007 = "2r" AND 2012 = "3r"
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE admissions ( row_id numb...
has there been any swab microbiology test since 2105 for patient 63676?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 63676) AND microbiologyevents.spec_type_desc = 'swab' AND STRFTIME('%y', microbiologyevents.charttime) >= '2105'
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
what is a procedure patient 74392 received for the first time until 2102?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 74392) AND STRFTIME('%y', procedures_icd.charttime) <= '2102' ORDER ...
CREATE TABLE table_name_85 ( place VARCHAR, to_par VARCHAR )
What is the place number for the player with a To Par score of 'E'?
SELECT place FROM table_name_85 WHERE to_par = "e"
CREATE TABLE table_53198 ( "Player" text, "Car." real, "Yards" text, "Avg." text, "TD's" real, "Long" text )
What is the long for the player with 26 carries?
SELECT "Long" FROM table_53198 WHERE "Car." = '26'
CREATE TABLE table_name_37 ( owgr_pts INTEGER, dates VARCHAR )
Which OWGR pts has Dates of may 10-13?
SELECT SUM(owgr_pts) FROM table_name_37 WHERE dates = "may 10-13"
CREATE TABLE table_name_79 ( opponent VARCHAR, time VARCHAR )
Which opponent has a time of 1:50?
SELECT opponent FROM table_name_79 WHERE time = "1:50"
CREATE TABLE table_58555 ( "Country" text, "Interview" real, "Swimsuit" real, "Evening Gown" real, "Average" real )
What is the total average for swimsuits smaller than 9.62 in Colorado?
SELECT SUM("Average") FROM table_58555 WHERE "Swimsuit" < '9.62' AND "Country" = 'colorado'
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, ...
Top Users in Tag (in UK).
SELECT Users.DisplayName, Users.Location, SUM(Posts.Score) AS TotalScore, 'https://stackoverflow.com/users/' + CAST(Users.Id AS TEXT) AS Profile FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id INNER JOIN PostTags ON Posts.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE TagName = '##ta...
CREATE TABLE table_20688030_1 ( mccain_percentage VARCHAR, obama_percentage VARCHAR )
What are McCain's Percent when Obama has 36.47%?
SELECT mccain_percentage FROM table_20688030_1 WHERE obama_percentage = "36.47%"
CREATE TABLE table_66704 ( "Year" text, "Births (000s)" real, "Deaths" real, "Natural Growth" real, "Total Fertility Rate" text )
What was the amount of deaths that had a natural growth smaller than 3.4, and a total fertility rate of 1.63?
SELECT "Deaths" FROM table_66704 WHERE "Natural Growth" < '3.4' AND "Total Fertility Rate" = '1.63'
CREATE TABLE table_62004 ( "Date" text, "Tournament" text, "Winning score" text, "To par" text, "Margin of victory" text, "Runner(s)-up" text, "Winner's share ( $ )" real )
What winning score has in-kyung kim as the runner(s)-up?
SELECT "Winning score" FROM table_62004 WHERE "Runner(s)-up" = 'in-kyung kim'
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_Per...
Give me the comparison about Team_ID over the All_Road by a bar chart, I want to list by the X-axis in ascending please.
SELECT All_Road, Team_ID FROM basketball_match ORDER BY All_Road
CREATE TABLE film ( film_id number, rank_in_series number, number_in_season number, title text, directed_by text, original_air_date text, production_code text ) CREATE TABLE schedule ( cinema_id number, film_id number, date text, show_times_per_day number, price number )...
What is total number of show times per dat for each cinema?
SELECT T2.name, SUM(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id
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 days of hospital stay is greater than 20 and drug code is ipra2h?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "20" AND prescriptions.formulary_drug_cd = "IPRA2H"
CREATE TABLE table_name_18 ( social_software VARCHAR, charting VARCHAR, discussion VARCHAR, time_tracking VARCHAR )
WHAT IS THE SOCIAL SOFTWARE WITH NO DISCUSSION, NO TIME TRACKING, AND NO CHARTING?
SELECT social_software FROM table_name_18 WHERE discussion = "no" AND time_tracking = "no" AND charting = "no"
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 is the number of patients whose year of birth is less than 2121 and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
CREATE TABLE Posts ( 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...
Questions by Time of Day and Day of Week. Designed to consider whether 'night' questions have more visibility than 'day' questions
SELECT ((TIME_TO_STR(Posts.CreationDate, '%W')) + (TIME_TO_STR(Posts.CreationDate, '%h')) / 24.0) AS HourOfWeek, COUNT(Posts.Id) AS Questions FROM Posts WHERE PostTypeId = 1 GROUP BY TIME_TO_STR(Posts.CreationDate, '%W'), TIME_TO_STR(Posts.CreationDate, '%h') ORDER BY HourOfWeek
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE inputevents_cv ( row_id nu...
how much is the total medical bill of patient 73423 until 4 years ago during their stay?
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73423) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year')
CREATE TABLE table_724 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
who is the incumbent where the district is florida 9?
SELECT "Incumbent" FROM table_724 WHERE "District" = 'Florida 9'
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, O...
mean answer score as function of response time.
WITH a AS (SELECT pa.Score, pq.CreationDate AS question_date, pa.CreationDate AS answer_date, DATEDIFF(day, pq.CreationDate, CreationDate) AS daydiff FROM Posts AS pa JOIN Posts AS pq ON pa.ParentId = pq.Id) SELECT daydiff, AVG(1.00 * Score) AS quality FROM a WHERE daydiff >= 0 AND daydiff <= 300 GROUP BY daydiff ORDER...
CREATE TABLE table_46647 ( "Pick" real, "Player" text, "Nationality" text, "New WNBA Team" text, "Former WNBA Team" text, "College/Country/Team" text )
What Player is from Connecticut?
SELECT "Player" FROM table_46647 WHERE "College/Country/Team" = 'connecticut'
CREATE TABLE table_21566 ( "1391 Carelia" text, "1398 Donnera" text, "1405 Sibelius" text, "1406 Komppa" text, "1407 Lindel\u00f6f" text )
what is the 1406 komppa of asteroid which 1391 carelia is 1460 haltia
SELECT "1406 Komppa" FROM table_21566 WHERE "1391 Carelia" = '1460 Haltia'
CREATE TABLE table_204_909 ( id number, "pollutant" text, "units" text, "emission standard" number, "coal-fired" text, "petroleum coke-fired" text )
at most part , how many emission standards are equal to or less than 1.1 ?
SELECT COUNT("emission standard") FROM table_204_909 WHERE "emission standard" = '≤ 1.1'
CREATE TABLE table_73343 ( "Team" text, "Stadium" text, "Match played" text, "Highest" real, "Lowest" real, "Average" real )
Which team has a match played of 10 4?
SELECT "Team" FROM table_73343 WHERE "Match played" = '10 4'
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
Users receiving multiple bounties from the same person.
SELECT CAST(N'2016-03-08T08:00:00' AS DATETIME)
CREATE TABLE table_46367 ( "Year" real, "Show" text, "Season" real, "Episode" text, "Episode number" real, "Original airdate" text )
What is the average Episode Number, when Original Airdate is March 21, 2010, and when Season is less than 3?
SELECT AVG("Episode number") FROM table_46367 WHERE "Original airdate" = 'march 21, 2010' AND "Season" < '3'
CREATE TABLE table_name_2 ( venue VARCHAR, round VARCHAR, result VARCHAR )
Which Venue has a Round of gs, and a Result of 0 3?
SELECT venue FROM table_name_2 WHERE round = "gs" AND result = "0–3"
CREATE TABLE table_name_42 ( producer_s_ VARCHAR, recipient VARCHAR )
Which producer worked for Animus Films LTD?
SELECT producer_s_ FROM table_name_42 WHERE recipient = "animus films ltd"