instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
give me the number of patients whose primary disease is hyperglycemia and days of hospital stay is greater than 14? | 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 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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.days_stay > "14" |
Tell me the year for rank more than 35 and out of 167 | CREATE TABLE table_name_11 (year VARCHAR,rank VARCHAR,out_of VARCHAR) | SELECT year FROM table_name_11 WHERE rank > 35 AND out_of = 167 |
Which Surname has Throws of r, and a Position of p, and a DOB of 26 april 1989? | CREATE TABLE table_name_64 (surname VARCHAR,dob VARCHAR,throws VARCHAR,position VARCHAR) | SELECT surname FROM table_name_64 WHERE throws = "r" AND position = "p" AND dob = "26 april 1989" |
What episode in the season was episode us17 in the series? | CREATE TABLE table_19897294_11 (no_in_season VARCHAR,no_in_series VARCHAR) | SELECT COUNT(no_in_season) FROM table_19897294_11 WHERE no_in_series = "US17" |
which school has the largest enrollment ? | CREATE TABLE table_204_624 (id number,"school" text,"team name" text,"town" text,"county" text,"enrollment (2010-11 & 2011-12)" number,"primary mshsaa class*" number,"football class" number) | SELECT "school" FROM table_204_624 ORDER BY "enrollment (2010-11 & 2011-12)" DESC LIMIT 1 |
Name the average established for championships less than 1 and club of erie seawolves | CREATE TABLE table_name_53 (established INTEGER,championships VARCHAR,club VARCHAR) | SELECT AVG(established) FROM table_name_53 WHERE championships < 1 AND club = "erie seawolves" |
Closed, no answers and no activity for a week. | 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,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT q.Id AS "post_link" FROM Posts AS q WHERE ClosedDate < CURRENT_TIMESTAMP() - '##deadline##' AND NOT EXISTS(SELECT 1 FROM PostHistory AS h WHERE h.CreationDate > CURRENT_TIMESTAMP() - 7) |
What is the title of the episode with a production code of 2j5504? | CREATE TABLE table_3767 ("No." real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text) | SELECT "Title" FROM table_3767 WHERE "Production code" = '2J5504' |
If the area is 59.73, what is the official name? | CREATE TABLE table_21365 ("Official Name" text,"Status" text,"Area km 2" text,"Population" real,"Census Ranking" text) | SELECT "Official Name" FROM table_21365 WHERE "Area km 2" = '59.73' |
What was the performance length of the 1999 season in bydgoszcz, poland? | CREATE TABLE table_name_11 (performance VARCHAR,season VARCHAR,place VARCHAR) | SELECT performance FROM table_name_11 WHERE season = 1999 AND place = "bydgoszcz, poland" |
What civil paris appears when Ballynamona is the townland with 126 acres? | CREATE TABLE table_30120556_1 (civil_parish VARCHAR,townland VARCHAR,area__acres__ VARCHAR) | SELECT civil_parish FROM table_30120556_1 WHERE townland = "Ballynamona" AND area__acres__ = 126 |
When is the French Open when serena williams is the player? | CREATE TABLE table_2164 ("#" real,"Player" text,"Age" text,"Australian Open" real,"French Open" real,"Wimbledon" real,"US Open" real) | SELECT MIN("French Open") FROM table_2164 WHERE "Player" = 'Serena Williams' |
What system has a current version of 1.4e? | CREATE TABLE table_name_65 (system VARCHAR,current_version VARCHAR) | SELECT system FROM table_name_65 WHERE current_version = "1.4e" |
How much gold did South Korea get? | CREATE TABLE table_41772 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Gold") FROM table_41772 WHERE "Nation" = 'south korea' |
Tell me the year with Laps less than 197 and start of 2 | CREATE TABLE table_67788 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real) | SELECT "Year" FROM table_67788 WHERE "Laps" < '197' AND "Start" = '2' |
What is the total number of Area (km ), when Population (2007) is 6,176? | CREATE TABLE table_46182 ("Barangay" text,"Area (km\u00b2)" real,"Population (2007)" real,"Population (2010)" real,"Pop. density (per km\u00b2)" real) | SELECT COUNT("Area (km\u00b2)") FROM table_46182 WHERE "Population (2007)" = '6,176' |
Bar chart x axis policy type code y axis the total number, show by the y axis in desc please. | CREATE TABLE Claims_Processing_Stages (Claim_Stage_ID INTEGER,Next_Claim_Stage_ID INTEGER,Claim_Status_Name VARCHAR(255),Claim_Status_Description VARCHAR(255))CREATE TABLE Claim_Headers (Claim_Header_ID INTEGER,Claim_Status_Code CHAR(15),Claim_Type_Code CHAR(15),Policy_ID INTEGER,Date_of_Claim DATETIME,Date_of_Settleme... | SELECT Policy_Type_Code, COUNT(*) FROM Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC |
How many institutions are shown for the football stadium of mosaic stadium? | CREATE TABLE table_74146 ("Institution" text,"Team" text,"City" text,"Province" text,"Founded" real,"Affiliation" text,"Enrollment" real,"Endowment" text,"Football stadium" text,"Capacity" real) | SELECT COUNT("Institution") FROM table_74146 WHERE "Football stadium" = 'Mosaic Stadium' |
how many hours have passed since patient 021-80293's admission in the icu? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitsta... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '021-80293' AND patient.unitdischargetime IS NULL |
what did patient 23070 receive on the first icu visit as their last intake? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance tex... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070) AND NOT icustays.outtime IS N... |
Microservices trend (# of questions per month). | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ... | SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ... |
Give me the comparison about the average of Height over the Sex , and group by attribute Sex, order X-axis from low to high order. | 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 Sex, AVG(Height) FROM people GROUP BY Sex ORDER BY Sex |
What is the race with the track distance of 6 furlongs and spectacular bid stakes? | CREATE TABLE table_58025 ("Date" text,"Track" text,"Race" text,"Distance" text,"Surface track" text,"Winning horse" text,"Winning jockey" text) | SELECT "Track" FROM table_58025 WHERE "Distance" = '6 furlongs' AND "Race" = 'spectacular bid stakes' |
Return the average and minimum ages across artists from the United States. | CREATE TABLE exhibition_record (exhibition_id number,date text,attendance number)CREATE TABLE artist (artist_id number,name text,country text,year_join number,age number)CREATE TABLE exhibition (exhibition_id number,year number,theme text,artist_id number,ticket_price number) | SELECT AVG(age), MIN(age) FROM artist WHERE country = 'United States' |
Search usernames and about me by any keyword. | 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 Comments (Id number,PostId number,Score number,Text text,Creati... | SELECT u.Id AS "user_link", u.DisplayName, u.AboutMe FROM Users AS u WHERE u.DisplayName LIKE '%##keyword1##%' OR u.AboutMe LIKE '%##keyword1##%' ORDER BY u.CreationDate DESC LIMIT 100 |
what was the lowest elevation in april 2006? | CREATE TABLE table_27435931_1 (elevation_ft INTEGER,year VARCHAR) | SELECT MIN(elevation_ft) FROM table_27435931_1 WHERE year = "April 2006" |
What country has 50 supermarkets? | CREATE TABLE table_48910 ("Country" text,"First store" text,"Hypermarkets" text,"Supermarkets" text,"Hard Discounters" text) | SELECT "Country" FROM table_48910 WHERE "Supermarkets" = '50' |
What number pick was Danny Walters in the 1983 NFL draft? | CREATE TABLE table_27354 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text) | SELECT COUNT("Pick #") FROM table_27354 WHERE "Player" = 'Danny Walters' |
What is American, when British is ' , ', and when Initial-Syllable Open/Semi-Open Unstressed Vowels is ' / /'? | CREATE TABLE table_name_23 (american VARCHAR,british VARCHAR,initial_syllable_open_semi_open_unstressed_vowels VARCHAR) | SELECT american FROM table_name_23 WHERE british = "ɪ, ə" AND initial_syllable_open_semi_open_unstressed_vowels = "æ /ɨ/" |
What is the traffic direction of 64th street with 2nd avenue to the west and 1 lane? | CREATE TABLE table_56946 ("Street" text,"West" text,"East" text,"# of lanes" text,"Traffic direction" text) | SELECT "Traffic direction" FROM table_56946 WHERE "West" = '2nd avenue' AND "# of lanes" = '1' AND "Street" = '64th street' |
What is the number of jews where the rank is 1? | CREATE TABLE table_16622 ("Rank (WJC)" real,"Rank (ARDA)" real,"Metro area" text,"Number of Jews (WJC)" real,"Number of Jews (ASARB)" real) | SELECT COUNT("Number of Jews (WJC)") FROM table_16622 WHERE "Rank (ARDA)" = '1' |
A bar chart for what are the number of the venues of all the matches? Sort them in the descending order of match date. | CREATE TABLE hosting_city (Year int,Match_ID int,Host_City text)CREATE TABLE temperature (City_ID int,Jan real,Feb real,Mar real,Apr real,Jun real,Jul real,Aug real,Sep real,Oct real,Nov real,Dec real)CREATE TABLE city (City_ID int,City text,Hanzi text,Hanyu_Pinyin text,Regional_Population int,GDP real)CREATE TABLE mat... | SELECT Venue, COUNT(Venue) FROM match GROUP BY Venue ORDER BY Date DESC |
how many days does it have been since the last time patient 8116 stayed in ward 7 during their current hospital encounter? | 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 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8116 AND admissions.dischtime IS NULL)) AND transfers.w... |
What is the lowest capacity with an opening larger than 2015 in Trabzon? | CREATE TABLE table_name_95 (capacity INTEGER,opening VARCHAR,city VARCHAR) | SELECT MIN(capacity) FROM table_name_95 WHERE opening > 2015 AND city = "trabzon" |
what are all the date withdrawn for koningin beatrix | CREATE TABLE table_17029 ("Ships name" text,"Date entered service" text,"Date withdrawn" text,"Tonnage" real,"Type of Ship" text) | SELECT "Date withdrawn" FROM table_17029 WHERE "Ships name" = 'Koningin Beatrix' |
what builder launched 20 jun 1953? | CREATE TABLE table_34150 ("Ship" text,"Original Pennant Number" text,"Builder" text,"Laid Down" text,"Launched" text,"Commissioned" text) | SELECT "Builder" FROM table_34150 WHERE "Launched" = '20 jun 1953' |
What person was the runner-up skip when Julie Reddick was the winning skip? | CREATE TABLE table_name_61 (runner_up_skip VARCHAR,winning_skip VARCHAR) | SELECT runner_up_skip FROM table_name_61 WHERE winning_skip = "julie reddick" |
Name all the difficulties for all of the CS-LSA courses . | CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,categ... | SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course, program, program_course WHERE program_course.course_id = course.course_id AND program.name LIKE 'CS-LSA' AND program.program_id = program_course.program_id |
Who directs before 1949 with linda darnell leading and jonathan kent? | CREATE TABLE table_10839 ("Year" real,"Title" text,"Role" text,"Leading Lady" text,"Director" text) | SELECT "Director" FROM table_10839 WHERE "Year" < '1949' AND "Leading Lady" = 'linda darnell' AND "Role" = 'jonathan kent' |
Questions with close votes by tag with at least two tags (multiple tags same question). | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReaso... | SELECT ROW_NUMBER() OVER (ORDER BY p.Id), p.Id AS "post_link", p.Tags FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE v.VoteTypeId = 6 AND p.ClosedDate IS NULL AND t.TagName IN ('##Tag1:string?tagname##', '##Tag2:string... |
get count of the number of hospital visits of patient 5658 in 2103. | 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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,... | SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 5658 AND STRFTIME('%y', admissions.admittime) = '2103' |
Which channel has the host Art Rooijakkers? | CREATE TABLE table_21952 ("Country / Region" text,"Name" text,"Host(s)" text,"Channel" text,"Premiere / Aired" text,"Seasons" text) | SELECT "Channel" FROM table_21952 WHERE "Host(s)" = 'Art Rooijakkers' |
find travel arrangements for a one way flight from SAN FRANCISCO to DALLAS | CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CREATE TABLE month (month_number int,month_name text)CREATE TABLE flight_fare (flig... | 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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = ... |
What is the average when the matches are 11? | CREATE TABLE table_62798 ("Player" text,"Matches" text,"Overs" text,"Wickets" text,"Economy Rate" text,"Average" text,"Strike Rate" text) | SELECT "Average" FROM table_62798 WHERE "Matches" = '11' |
Is there a lab which belongs to 475 ? | CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_discussion varchar,has_lab varch... | SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 475 |
Which Season ha spvgg bayreuth and eintracht trier? | CREATE TABLE table_name_19 (season VARCHAR,oberliga_bayern VARCHAR,oberliga_südwest VARCHAR) | SELECT season FROM table_name_19 WHERE oberliga_bayern = "spvgg bayreuth" AND oberliga_südwest = "eintracht trier" |
Which Tonnage has a Fate of sunk, and Deaths smaller than 17, and a Date of 16 november 1940? | CREATE TABLE table_65012 ("Date" text,"Ship Name" text,"Flag" text,"Tonnage (GRT)" real,"Fate" text,"Deaths" real) | SELECT "Tonnage ( GRT )" FROM table_65012 WHERE "Fate" = 'sunk' AND "Deaths" < '17' AND "Date" = '16 november 1940' |
What school or club did number 35 play for? | CREATE TABLE table_11545282_7 (school_club_team VARCHAR,no VARCHAR) | SELECT school_club_team FROM table_11545282_7 WHERE no = 35 |
was the heartrate value of patient 022-163354 second measured on the first intensive care unit visit less than the value first measured on the first intensive care unit visit? | 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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text... | SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-163354') AND NOT patient.unitdischargetime IS... |
What is Date, when Fastest Lap is James Winslow, when Race is 1, and when Winning Driver is Leanne Tander? | CREATE TABLE table_41991 ("Round" text,"Race" real,"Circuit" text,"Date" text,"Pole Position" text,"Fastest Lap" text,"Winning driver" text,"Winning team" text) | SELECT "Date" FROM table_41991 WHERE "Fastest Lap" = 'james winslow' AND "Race" = '1' AND "Winning driver" = 'leanne tander' |
What are the student IDs and middle names of the students enrolled in at most two courses. | CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCHAR(255))CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_o... | SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id |
What year was the bridge in Kent built? | CREATE TABLE table_43872 ("Name" text,"Built" text,"Listed" text,"Location" text,"County" text) | SELECT "Built" FROM table_43872 WHERE "County" = 'kent' |
For Greek Archaeology , is there an advisory pre-requirement ? | CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE area (course_id int,area varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE ... | SELECT DISTINCT advisory_requirement FROM course WHERE name LIKE '%Greek Archaeology%' |
What is the average To Par, when Player is 'Billy Casper'? | CREATE TABLE table_49092 ("Place" text,"Player" text,"Country" text,"Score" text,"To Par" real,"Money ($)" real) | SELECT AVG("To Par") FROM table_49092 WHERE "Player" = 'billy casper' |
Name the poles for season 2006 | CREATE TABLE table_29976 ("Season" real,"Driver" text,"Owner" text,"Number" text,"Make" text,"Starts" text,"Wins" real,"Top Tens" real,"Poles" real,"Points (margin)" text) | SELECT "Poles" FROM table_29976 WHERE "Season" = '2006' |
List the number of companies for each building in a bar chart, display name from high to low order. | CREATE TABLE Companies (id int,name text,Headquarters text,Industry text,Sales_billion real,Profits_billion real,Assets_billion real,Market_Value_billion text)CREATE TABLE buildings (id int,name text,City text,Height int,Stories int,Status text)CREATE TABLE Office_locations (building_id int,company_id int,move_in_year ... | SELECT T2.name, COUNT(T2.name) FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T2.name ORDER BY T2.name DESC |
What is the total point for the year listed in 1988? | CREATE TABLE table_name_58 (points INTEGER,year VARCHAR) | SELECT SUM(points) FROM table_name_58 WHERE year = 1988 |
When was the home game for the NY Islanders? | CREATE TABLE table_10523 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Date" FROM table_10523 WHERE "Home" = 'ny islanders' |
How few acres is the area of Clashroe? | CREATE TABLE table_30120633_1 (area__acres__ INTEGER,townland VARCHAR) | SELECT MIN(area__acres__) FROM table_30120633_1 WHERE townland = "Clashroe" |
Count the number of schools. | CREATE TABLE budget (school_id number,year number,budgeted number,total_budget_percent_budgeted number,invested number,total_budget_percent_invested number,budget_invested_percent text)CREATE TABLE endowment (endowment_id number,school_id number,donator_name text,amount number)CREATE TABLE school (school_id text,school... | SELECT COUNT(*) FROM school |
what is the number of patients whose ethnicity is black/cape verdean and primary disease is chest pain? | 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 WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.diagnosis = "CHEST PAIN" |
Draft: Users filtered by location and the company name (keyword in AboutMe). | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByRev... | SELECT DISTINCT u.Id AS "user_link", CONCAT('https://stackoverflow.com/users/', u.Id) AS "profile_link", u.DisplayName, u.Location, u.WebsiteUrl, u.AboutMe, u.Views, u.UpVotes, u.DownVotes, u.EmailHash, u.Reputation FROM Users AS u WHERE UPPER(u.Location) LIKE UPPER('%##Location##%') AND UPPER(u.AboutMe) LIKE UPPER('%#... |
Who was the away team when Queensland Roar was the home team in the round less than 3? | CREATE TABLE table_79638 ("Round" real,"Date" text,"Home Team" text,"Away Team" text,"Attendance" real,"Stadium" text) | SELECT "Away Team" FROM table_79638 WHERE "Round" < '3' AND "Home Team" = 'queensland roar' |
User Count: Users in a given location - Not Case Sensitive. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE FlagTypes (Id... | WITH UsersStatedLocation AS (SELECT CASE WHEN LOWER(Location) LIKE LOWER('##Location##') THEN 'Location Input' ELSE 'Not a match' END AS StatedLocation FROM Users WHERE LENGTH(Location) > 1) SELECT UsersStatedLocation.StatedLocation, COUNT(1) AS "count" FROM UsersStatedLocation GROUP BY UsersStatedLocation.StatedLocati... |
What was the stats of Trinidad and Tobago | CREATE TABLE table_1231316_4 (wind__m_s_ VARCHAR,country VARCHAR) | SELECT wind__m_s_ FROM table_1231316_4 WHERE country = "Trinidad and Tobago" |
provide the number of patients whose ethnicity is black/haitian and diagnoses icd9 code is v4511? | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND diagnoses.icd9_code = "V4511" |
Find out the age and preferred language for the patient with patient id 2560. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT demographic.age, demographic.language FROM demographic WHERE demographic.subject_id = "2560" |
Users with reputation > 5000 who never downvoted. | 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 CloseReasonTypes (Id number,Name text,Description text)CREATE T... | SELECT u.Id AS "user_link", u.DisplayName, u.Reputation, u.DownVotes, u.UpVotes, u.LastAccessDate FROM Users AS u WHERE u.Reputation > 5000 AND u.DownVotes = 0 ORDER BY u.DownVotes, u.Reputation DESC LIMIT 500 |
give me the number of patients whose diagnoses icd9 code is 41021? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "41021" |
What is the total number of seasons with more than 0 wins and a 1st final placing? | CREATE TABLE table_55606 ("Season" real,"Series" text,"Team Name" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Final Placing" text) | SELECT COUNT("Season") FROM table_55606 WHERE "Wins" > '0' AND "Final Placing" = '1st' |
Which circuit was in Great Britain with Ireland as the winner? | CREATE TABLE table_37370 ("Date" text,"Country" text,"Circuit" text,"Sprint Winner" text,"Feature Winner" text,"Report" text) | SELECT "Circuit" FROM table_37370 WHERE "Feature Winner" = 'ireland' AND "Country" = 'great britain' |
Tell me the label for digital download for bonus tracks version | CREATE TABLE table_name_39 (label VARCHAR,format VARCHAR,edition_s_ VARCHAR) | SELECT label FROM table_name_39 WHERE format = "digital download" AND edition_s_ = "bonus tracks version" |
Which Score has a Country of england, and a Year larger than 1971? | CREATE TABLE table_name_77 (score VARCHAR,country VARCHAR,year VARCHAR) | SELECT score FROM table_name_77 WHERE country = "england" AND year > 1971 |
Which Race has a Runners of 7 and Odds of 1/3? | CREATE TABLE table_name_30 (race VARCHAR,runners VARCHAR,odds VARCHAR) | SELECT race FROM table_name_30 WHERE runners = 7 AND odds = "1/3" |
calculate the total number of patients with acute upper respiratory infections of unspecified site who had a lab test for plueral fluid. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Acute upper respiratory infections of unspecified site" AND lab.fluid = "Pleural" |
How many draws occurred when 25 points were scored? | CREATE TABLE table_18594107_1 (draws VARCHAR,scored VARCHAR) | SELECT COUNT(draws) FROM table_18594107_1 WHERE scored = 25 |
What was the attendance when they played the New Orleans Saints? | CREATE TABLE table_name_93 (attendance VARCHAR,opponent VARCHAR) | SELECT attendance FROM table_name_93 WHERE opponent = "new orleans saints" |
What is the average Matches, when Round is Third Qualifying Round? | CREATE TABLE table_name_81 (matches INTEGER,round VARCHAR) | SELECT AVG(matches) FROM table_name_81 WHERE round = "third qualifying round" |
Who directed series episode number 201? | CREATE TABLE table_26866519_1 (director VARCHAR,series__number VARCHAR) | SELECT director FROM table_26866519_1 WHERE series__number = 201 |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of headquarter and the sum of code , and group by attribute headquarter, and list from high to low by the Y-axis. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code DESC |
Who wrote the episode 'Sister Act'? | CREATE TABLE table_27049 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real) | SELECT "Written by" FROM table_27049 WHERE "Title" = 'Sister Act' |
What is the launched date of the station in cora huichol tepehuano nahuatl language? | CREATE TABLE table_name_1 (launched VARCHAR,languages VARCHAR) | SELECT launched FROM table_name_1 WHERE languages = "cora huichol tepehuano nahuatl" |
user info with top 10 tags. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate ti... | WITH tagList AS (SELECT t.TagName, COUNT(t.TagName) AS tagCount FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS q ON pt.PostId = q.Id INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = @UserId AND a.PostTypeId = 2 GROUP BY t.TagName ORDER BY tagCount DESC LIMIT 10) ... |
What is the Result of the game on November 24, 1946? | CREATE TABLE table_name_78 (result VARCHAR,date VARCHAR) | SELECT result FROM table_name_78 WHERE date = "november 24, 1946" |
tell me the maximum heart rate of patient 20033 on the first intensive care unit visit? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_labitems (row_id numbe... | SELECT MAX(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20033) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid ... |
Can you tell me the Team that has the Laps of 379? | CREATE TABLE table_name_23 (team VARCHAR,laps VARCHAR) | SELECT team FROM table_name_23 WHERE laps = 379 |
What are grid 4's average points? | CREATE TABLE table_name_25 (points INTEGER,grid VARCHAR) | SELECT AVG(points) FROM table_name_25 WHERE grid = 4 |
On what date did Dick Johnson with at Calder? | CREATE TABLE table_50893 ("Race Title" text,"Circuit" text,"City / State" text,"Date" text,"Winner" text,"Team" text) | SELECT "Date" FROM table_50893 WHERE "Winner" = 'dick johnson' AND "Race Title" = 'calder' |
What was his position when the team was FMS International? | CREATE TABLE table_25539502_1 (position VARCHAR,team VARCHAR) | SELECT position FROM table_25539502_1 WHERE team = "FMS International" |
What was the margin of victory when the winning score was 9 (72-68-64-67=271)? | CREATE TABLE table_name_84 (margin_of_victory VARCHAR,winning_score VARCHAR) | SELECT margin_of_victory FROM table_name_84 WHERE winning_score = −9(72 - 68 - 64 - 67 = 271) |
What is the School, when the Team is Golden Knights? | CREATE TABLE table_70863 ("School" text,"Team" text,"Division Record" text,"Overall Record" text,"Season Outcome" text) | SELECT "School" FROM table_70863 WHERE "Team" = 'golden knights' |
Who was the winner with a mountain stage type on 22 May? | CREATE TABLE table_name_81 (winner VARCHAR,type VARCHAR,date VARCHAR) | SELECT winner FROM table_name_81 WHERE type = "mountain stage" AND date = "22 may" |
What was the passenger fare for Lansing, when the passenger fare for Kalamazoo was $599.39? | CREATE TABLE table_9690 ("Year" real,"Lansing (LAN)" text,"Detroit (DTW)" text,"Grand Rapids (GRR)" text,"Flint (FNT)" text,"Kalamazoo (AZO)" text,"Saginaw (MBS)" text) | SELECT "Lansing (LAN)" FROM table_9690 WHERE "Kalamazoo (AZO)" = '$599.39' |
What is the date of the Rome to Florence course? | CREATE TABLE table_70810 ("Date" text,"Course" text,"Distance" text,"Winner" text,"Race Leader" text) | SELECT "Date" FROM table_70810 WHERE "Course" = 'rome to florence' |
Which sliding tackle has no dump tackle and a restricted shoulder charge? | CREATE TABLE table_33077 ("sliding tackle" text,"spear tackle" text,"dump tackle" text,"body tackle" text,"ankle tap" text,"diving tackle" text,"bumping/blocking" text,"shoulder charge" text,"steal/intercept ball" text,"Chicken wing" text) | SELECT "sliding tackle" FROM table_33077 WHERE "dump tackle" = 'no' AND "shoulder charge" = 'restricted' |
how many times has the team played in divison 1 since 2000 ? | CREATE TABLE table_203_533 (id number,"season" number,"level" text,"division" text,"section" text,"position" text,"movements" text) | SELECT COUNT(*) FROM table_203_533 WHERE "division" = 'division 1' AND "season" >= 2000 |
What was the sum of league goals where the toal was 8 and league cup goals were larger than 0? | CREATE TABLE table_name_80 (league_goals INTEGER,total_goals VARCHAR,league_cup_goals VARCHAR) | SELECT SUM(league_goals) FROM table_name_80 WHERE total_goals = 8 AND league_cup_goals > 0 |
What is the largest number of events with the Masters Tournament and less than 4 in the top-25? | CREATE TABLE table_name_77 (events INTEGER,tournament VARCHAR,top_25 VARCHAR) | SELECT MAX(events) FROM table_name_77 WHERE tournament = "masters tournament" AND top_25 < 4 |
What is the Background of the contestant with a Hometown listed as Los Angeles, California? | CREATE TABLE table_43419 ("Background" text,"Original Team" text,"Hometown" text,"Result" text,"Raised" text) | SELECT "Background" FROM table_43419 WHERE "Hometown" = 'los angeles, california' |
Name the winning driver with circuit of monza | CREATE TABLE table_56879 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text) | SELECT "Winning driver" FROM table_56879 WHERE "Circuit" = 'monza' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.