instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Give me the comparison about author_id over the middle_name by a bar chart. | CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_name VARCHAR(80),family_name VARCHAR(80),gender_mf VARCHAR(1),address_line_1 VARCHAR(80))CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))... | SELECT middle_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name |
WOMENSTD 323 has how many lecture sections next semester ? | CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE ta (campus_job_id int,studen... | SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'WOMENSTD' AND course.number = 323 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
what is fare code Y mean | CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_... | SELECT DISTINCT booking_class FROM class_of_service WHERE booking_class = 'Y' |
Get post with popular tags. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)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,SuggestedEdit... | SELECT Count, TagName FROM Tags WHERE Count > 50000 ORDER BY Count |
Name the word with pronunciation b of *s ks | CREATE TABLE table_35735 ("Word" text,"Pronunciation a" text,"Meaning a" text,"Pronunciation b" text,"Meaning b" text) | SELECT "Word" FROM table_35735 WHERE "Pronunciation b" = '*sɨks' |
what is france and germany 's deficit combined ? | CREATE TABLE table_204_466 (id number,"rank" number,"bib" number,"country" text,"time" text,"penalties (p+s)" text,"deficit" text) | SELECT SUM("deficit") FROM table_204_466 WHERE "country" IN ('france', 'germany') |
Car number 15 earned what time? | CREATE TABLE table_17244483_1 (time_retired VARCHAR,car_no VARCHAR) | SELECT time_retired FROM table_17244483_1 WHERE car_no = 15 |
when did patient 90165 enter the hospital first time until 4 years ago via the emergency room admit? | 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 number,event_type text,event_id number,chargetime time,cost number)CREA... | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 90165 AND admissions.admission_location = 'emergency room admit' AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY admissions.admittime LIMIT 1 |
For each payment method, return how many customers use it. | CREATE TABLE customers (payment_method_code VARCHAR) | SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code |
Name the french title for english title of 'inventor bunnies | CREATE TABLE table_1452 ("Official #" real,"TF1 #" real,"French title" text,"English title" text,"Air date (France)" text,"Original Beechwood Bunny Tale / Source material" text) | SELECT "French title" FROM table_1452 WHERE "English title" = 'Inventor Bunnies' |
What is Result, when Venue is G tzis , Austria? | CREATE TABLE table_48395 ("Year" real,"Tournament" text,"Venue" text,"Result" text,"Extra" text) | SELECT "Result" FROM table_48395 WHERE "Venue" = 'götzis , austria' |
What is the total number of Bronze, when Gold is greater than 0, when Rank is 4, and when Total is greater than 4? | CREATE TABLE table_50300 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT COUNT("Bronze") FROM table_50300 WHERE "Gold" > '0' AND "Rank" = '4' AND "Total" > '4' |
Give me a bar chart that bins the payment date into the Year interval and then shows the amount of each payment categorized by the payment method code, and then sort the bars in ascending order of date. | CREATE TABLE Customer_Policies (Policy_ID INTEGER,Customer_ID INTEGER,Policy_Type_Code CHAR(15),Start_Date DATE,End_Date DATE)CREATE TABLE Payments (Payment_ID INTEGER,Settlement_ID INTEGER,Payment_Method_Code VARCHAR(255),Date_Payment_Made DATE,Amount_Payment INTEGER)CREATE TABLE Settlements (Settlement_ID INTEGER,Cla... | SELECT Date_Payment_Made, COUNT(Date_Payment_Made) FROM Payments GROUP BY Payment_Method_Code ORDER BY Date_Payment_Made |
Who is the representative with a presentation of credentials date on February 23, 1854? | CREATE TABLE table_71880 ("Representative" text,"Title" text,"Presentation of Credentials" text,"Termination of Mission" text,"Appointed by" text) | SELECT "Representative" FROM table_71880 WHERE "Presentation of Credentials" = 'february 23, 1854' |
did patient 18866 have a respiratory rate that was greater than 12.0 in 12/2105? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number... | SELECT COUNT(*) > 0 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 = 18866)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate'... |
indicate the monthly minimum heart rate of patient 6196 since 164 months ago. | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE outputevents (row_id number,sub... | SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6196)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart... |
what was the total majority that the dobell seat had ? | CREATE TABLE table_204_659 (id number,"seat" text,"state" text,"majority" number,"member" text,"party" text) | SELECT "majority" FROM table_204_659 WHERE "seat" = 'dobell' |
What country is Yerevan located in? | CREATE TABLE table_name_21 (country VARCHAR,city VARCHAR) | SELECT country FROM table_name_21 WHERE city = "yerevan" |
Which class's call sign is wokg? | CREATE TABLE table_69481 ("Call sign" text,"Frequency MHz" real,"City of license" text,"ERP W" real,"Class" text,"FCC info" text) | SELECT "Class" FROM table_69481 WHERE "Call sign" = 'wokg' |
Bar chart x axis time y axis id, and order by the x axis in asc. | CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te... | SELECT Time, ID FROM swimmer ORDER BY Time |
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of phone_number and manager_id , list by the Y from high to low. | 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),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE va... | SELECT PHONE_NUMBER, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC |
What average gold has China (chn) as the nation with a bronze greater than 1? | CREATE TABLE table_61298 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Gold") FROM table_61298 WHERE "Nation" = 'china (chn)' AND "Bronze" > '1' |
calculate the total or urine production for patient 6705 on the last icu visit. | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE cost (row_i... | SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6705) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND outputevents.it... |
what is the highest clean & jerk when total (kg) is 200.0 and snatch is more than 87.5? | CREATE TABLE table_name_92 (_jerk VARCHAR,clean_ INTEGER,total__kg_ VARCHAR,snatch VARCHAR) | SELECT MAX(clean_) & _jerk FROM table_name_92 WHERE total__kg_ = "200.0" AND snatch > 87.5 |
count the number of patients whose diagnoses long title is cyst and pseudocyst of pancreas and drug type is main? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Cyst and pseudocyst of pancreas" AND prescriptions.drug_type = "MAIN" |
provide the number of patients whose procedure long title is other closed [endoscopic] biopsy of biliary duct or sphincter of oddi and lab test category is chemistry? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi" AND lab."CATEGORY" = "Chemistry" |
what drugs are being added to patient 021-80293 today as compared to those yesterday? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature n... | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '021-80293') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medica... |
What is the highest games Played where the Place is 10 and Points are less than 17? | CREATE TABLE table_7305 ("Place" real,"Team" text,"Played" real,"Draw" real,"Lost" real,"Goals Scored" real,"Goals Conceded" real,"Points" real) | SELECT MAX("Played") FROM table_7305 WHERE "Place" = '10' AND "Points" < '17' |
Who played against Hapoel tel aviv when they were team #1? | CREATE TABLE table_name_89 (team__number2 VARCHAR,team__number1 VARCHAR) | SELECT team__number2 FROM table_name_89 WHERE team__number1 = "hapoel tel aviv" |
How many cars does Gregg Mixon own? | CREATE TABLE table_2182170_1 (car_s_ VARCHAR,listed_owner_s_ VARCHAR) | SELECT COUNT(car_s_) FROM table_2182170_1 WHERE listed_owner_s_ = "Gregg Mixon" |
What is the car number driven by Darren Manning? | CREATE TABLE table_21436 ("Fin. Pos" real,"Car No." real,"Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" real,"Laps Led" real,"Points" text) | SELECT "Car No." FROM table_21436 WHERE "Driver" = 'Darren Manning' |
what is the difference in attendance for week 5 and 9 | CREATE TABLE table_204_670 (id number,"week" number,"date" text,"opponent" text,"result" text,"record" text,"attendance" number) | SELECT ABS((SELECT "attendance" FROM table_204_670 WHERE "week" = 5) - (SELECT "attendance" FROM table_204_670 WHERE "week" = 9)) |
What was the attendance on September 19, 1971, after week 1? | CREATE TABLE table_61688 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT AVG("Attendance") FROM table_61688 WHERE "Date" = 'september 19, 1971' AND "Week" > '1' |
What is the lowest win% in the 1999-2013 season? | CREATE TABLE table_57570 ("Coach" text,"Season" text,"Record" text,"Home" text,"Away" text,"Win %" real,"Average (Total) Home Attendance" text) | SELECT MIN("Win %") FROM table_57570 WHERE "Season" = '1999-2013' |
calculate the maximum days for which patients who died before 2164 stayed in hospital. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dod_year < "2164.0" |
Whatis the total number of half marathon (mens) that represented kazakhstan? | CREATE TABLE table_11391954_3 (Half VARCHAR,country VARCHAR) | SELECT COUNT(Half) AS marathon__mens_ FROM table_11391954_3 WHERE country = "Kazakhstan" |
Show all locations and the number of gas stations in each location ordered by the count. | CREATE TABLE gas_station (LOCATION VARCHAR) | SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) |
what is the maximum game where high points is micka l gelabale (21) | CREATE TABLE table_11964154_9 (game INTEGER,high_points VARCHAR) | SELECT MAX(game) FROM table_11964154_9 WHERE high_points = "Mickaël Gelabale (21)" |
what is average age of patients whose insurance is private and discharge location is rehab/distinct part hosp? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "REHAB/DISTINCT PART HOSP" |
How many positions does building Costanera Center Torre 1 have? | CREATE TABLE table_29283 ("Position" real,"Building" text,"City" text,"Height" text,"Number of floors" real,"Completion" real) | SELECT COUNT("Position") FROM table_29283 WHERE "Building" = 'Costanera Center Torre 1' |
Name the record for cotton bowl classic | CREATE TABLE table_2517159_1 (record VARCHAR,name_of_bowl VARCHAR) | SELECT record FROM table_2517159_1 WHERE name_of_bowl = "Cotton Bowl Classic" |
the total number of helipads at hama military airport ? | CREATE TABLE table_204_102 (id number,"name" text,"location served" text,"governorate" text,"utilization" text,"helipads" number,"runways" number,"shelters" number,"squadrons" text,"coordinates" text) | SELECT "helipads" FROM table_204_102 WHERE "name" = 'hama military airport' |
What is the name of the race in the Modena circuit? | CREATE TABLE table_16767 ("Race Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Constructor" text,"Report" text) | SELECT "Race Name" FROM table_16767 WHERE "Circuit" = 'Modena' |
What race has a distance of 1200 m? | CREATE TABLE table_2062148_3 (race VARCHAR,distance VARCHAR) | SELECT race FROM table_2062148_3 WHERE distance = "1200 m" |
How many Losses have Draws larger than 0? | CREATE TABLE table_66431 ("Millewa" text,"Wins" real,"Forfeits" real,"Losses" real,"Draws" real,"Against" real) | SELECT MAX("Losses") FROM table_66431 WHERE "Draws" > '0' |
How many directors were there for season 3 episode 1? | CREATE TABLE table_28453 ("Episode #" text,"Season Episode #" text,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Prod. code" text) | SELECT COUNT("Directed by") FROM table_28453 WHERE "Season Episode #" = '1' |
when did patient 010-32698 have his or her last surgical procedure? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,c... | SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-32698')) ORDER BY treatment.treatmenttime DESC LIMIT 1 |
Give me the comparison about All_Games_Percent over the ACC_Regular_Season , and I want to display by the Y in desc. | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT ACC_Regular_Season, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent DESC |
Fastest users to get to X rep. Fastest user to reach a certain rep score. | 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,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl... | SELECT * FROM VoteTypes |
Which city has the ICAO of LIRF? | CREATE TABLE table_51595 ("City" text,"Country" text,"IATA" text,"ICAO" text,"Airport" text) | SELECT "City" FROM table_51595 WHERE "ICAO" = 'lirf' |
What is Owner, when Finished is less than 15, when Trainer is 'Steve Asmussen', and when Horse is 'Z Fortune'? | CREATE TABLE table_46426 ("Finished" real,"Time/ Behind" text,"Post" real,"Horse" text,"Jockey" text,"Trainer" text,"Owner" text) | SELECT "Owner" FROM table_46426 WHERE "Finished" < '15' AND "Trainer" = 'steve asmussen' AND "Horse" = 'z fortune' |
find out the number of greek orthodox religious background patients with lab test item id 51288. | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "GREEK ORTHODOX" AND lab.itemid = "51288" |
i would like to book an early morning flight from TAMPA to CHARLOTTE on 4 6 | CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE code_description (code varchar,descripti... | 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 = 'CHARLOTTE' AND date_day.day_number = 6 AND date_day.month_number = 4 AND... |
Which Puchat Ligi has a UEFA Cup smaller than 2, and a Player of takesure chinyama? | CREATE TABLE table_60820 ("Player" text,"Position" text,"Ekstraklasa" real,"Polish Cup" real,"Puchat Ligi" real,"UEFA Cup" real,"Total" real) | SELECT MIN("Puchat Ligi") FROM table_60820 WHERE "UEFA Cup" < '2' AND "Player" = 'takesure chinyama' |
What is the total number of losses of the team with games less than 14, wins less than 3, in the Maac Conference at Fairfield School? | CREATE TABLE table_44082 ("School" text,"Conference" text,"Games" real,"Wins" real,"Losses" real,"Winning Pct." real) | SELECT COUNT("Losses") FROM table_44082 WHERE "Games" < '14' AND "Wins" < '3' AND "Conference" = 'maac' AND "School" = 'fairfield' |
Give me a histogram for what are the different parties of representative? Show the party name and the number of representatives in each party. | CREATE TABLE election (Election_ID int,Representative_ID int,Date text,Votes real,Vote_Percent real,Seats real,Place real)CREATE TABLE representative (Representative_ID int,Name text,State text,Party text,Lifespan text) | SELECT Party, COUNT(*) FROM representative GROUP BY Party |
is the heart rate in patient 22973 last measured on the first icu visit less than first measured on the first icu visit? | CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid nu... | SELECT (SELECT 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 = 22973) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.item... |
What was the standing when goal against were 279? | CREATE TABLE table_2259285_1 (standing VARCHAR,goals_against VARCHAR) | SELECT standing FROM table_2259285_1 WHERE goals_against = 279 |
What game was played at Philadelphia? | CREATE TABLE table_name_36 (game INTEGER,team VARCHAR) | SELECT AVG(game) FROM table_name_36 WHERE team = "philadelphia" |
A bar chart for what are the number of the completion dates of all the tests that have result 'Fail'?, and list from high to low by the Y-axis. | CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATETIME,login_name VARCHAR(40),password VARCHAR(10),personal_name VARCHAR(40),middle_name VARCHAR(40),family_name VARCHAR(40))CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VAR... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY COUNT(date_of_completion) DESC |
Name the host for prime | CREATE TABLE table_21143 ("Country" text,"Name" text,"Network" text,"Premiere" text,"Host(s)" text,"Judges" text,"Seasons and Winners" text) | SELECT "Host(s)" FROM table_21143 WHERE "Network" = 'Prime' |
What is the most number of families in regions where average family size is 2.7? | CREATE TABLE table_20508 ("Region of USSR" text,"Number of families" real,"Number of people" real,"Average family size" text,"% of total deportees" text) | SELECT MAX("Number of families") FROM table_20508 WHERE "Average family size" = '2.7' |
Follow-up edits to my contributions. Shows all posts that I've contributed to, that have also been edited by someone else since my last contribution. Includes only certain types of edits (title/body/tag edits/rollbacks), and excludes edits by the Community user (which are mostly inserting/removing duplicate links and s... | CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTas... | SELECT ph.PostId AS "post_link", ph.CreationDate AS LastEditDate, u.DisplayName AS LastEditor, pht.Name AS LastEditType, ph.Comment FROM PostHistory AS ph JOIN PostHistoryTypes AS pht ON pht.Id = ph.PostHistoryTypeId JOIN Posts AS p ON p.Id = ph.PostId AND p.LastEditDate = ph.CreationDate JOIN Users AS u ON u.Id = ph.U... |
When John Mcenroe won at Montreal, what was the score? | CREATE TABLE table_12794 ("Location" text,"Year" real,"Champion" text,"Runner-up" text,"Score" text) | SELECT "Score" FROM table_12794 WHERE "Location" = 'montreal' AND "Champion" = 'john mcenroe' |
Let institution types as the X-axis and the number of institutions for each type as Y-axis, the visualization type is bar chart, could you order in desc by the Y-axis? | CREATE TABLE building (building_id text,Name text,Street_address text,Years_as_tallest text,Height_feet int,Floors int)CREATE TABLE Institution (Institution_id text,Institution text,Location text,Founded real,Type text,Enrollment int,Team text,Primary_Conference text,building_id text)CREATE TABLE protein (common_name t... | SELECT Type, COUNT(*) FROM Institution GROUP BY Type ORDER BY COUNT(*) DESC |
What week was the finalist Martina Hingis? | CREATE TABLE table_76540 ("Tournament" text,"Surface" text,"Week" text,"Winner" text,"Finalist" text,"Semifinalists" text) | SELECT "Week" FROM table_76540 WHERE "Finalist" = 'martina hingis' |
what was the total number of wins ? | CREATE TABLE table_203_689 (id number,"date" text,"opponent" text,"score" text,"result" text,"record" text) | SELECT COUNT(*) FROM table_203_689 WHERE "result" = 'win' |
What dates had matches at the venue Sabina Park? | CREATE TABLE table_79760 ("Date" text,"Home captain" text,"Away captain" text,"Venue" text,"Result" text) | SELECT "Date" FROM table_79760 WHERE "Venue" = 'sabina park' |
What is the broadcast date with 7.0 million viewers? | CREATE TABLE table_59775 ("Episode" text,"Broadcast date" text,"Run time" text,"Viewers (in millions)" text,"Archive" text) | SELECT "Broadcast date" FROM table_59775 WHERE "Viewers (in millions)" = '7.0' |
How many tries for did the club with a 3 losing bonus and 45 points have? | CREATE TABLE table_36645 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Tries for" FROM table_36645 WHERE "Losing bonus" = '3' AND "Points" = '45' |
how many patients admitted to emergency were aged below 71? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.age < "71" |
List the name for storms and the number of affected regions for each storm, order bars from high to low order. | CREATE TABLE storm (Storm_ID int,Name text,Dates_active text,Max_speed int,Damage_millions_USD real,Number_Deaths int)CREATE TABLE affected_region (Region_id int,Storm_ID int,Number_city_affected real)CREATE TABLE region (Region_id int,Region_code text,Region_name text) | SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID ORDER BY Name DESC |
Show me a bar chart for how many students are advised by each rank of faculty? List the rank and the number of students. | CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,acti... | SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank |
What is the % of points possible of the winner from Penn State? | CREATE TABLE table_42499 ("Year" real,"Winner" text,"School" text,"Position" text,"Points" text,"% of Points Possible" text) | SELECT "% of Points Possible" FROM table_42499 WHERE "School" = 'penn state' |
What is the Hadeda Ibis when the Ostrich is Dark Chanting Goshawk? | CREATE TABLE table_23493 ("Ostrich" text,"Hamerkop" text,"Hadeda Ibis" text,"African Spoonbill" text,"Whitefaced Duck" text,"Knobbilled Duck" text) | SELECT "Hadeda Ibis" FROM table_23493 WHERE "Ostrich" = 'Dark Chanting Goshawk' |
What is the best time of the team that had a qualifying 1 time of 1:01.043? | CREATE TABLE table_5198 ("Name" text,"Team" text,"Qual 1" text,"Qual 2" text,"Best" text) | SELECT "Best" FROM table_5198 WHERE "Qual 1" = '1:01.043' |
What is the number of patients who underwent (Aorto)coronary bypass of one coronary artery and died in or before 2138? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2138.0" AND procedures.short_title = "Aortocor bypas-1 cor art" |
count the number of patients who since 4 years ago have been prescribed 1 ml vial : heparin sodium (porcine) 5000 unit/ml ij soln. | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight nu... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = '1 ml vial : heparin sodium (porcine) 5000 unit/ml ij soln' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year')) |
calculate the average age of patients who were admitted in emergency room for s/p hanging. | 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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "S/P HANGING" |
Name the traditional for area 544 | CREATE TABLE table_23563 ("English Name" text,"Simplified" text,"Traditional" text,"Pinyin" text,"Foochow" text,"Area" real,"Population" real,"Density" real) | SELECT "Traditional" FROM table_23563 WHERE "Area" = '544' |
Which Week 14 Nov 30 has a Week 6 Oct 5 of michigan state (5-1)? | CREATE TABLE table_5694 ("Week 6 Oct 5" text,"Week 7 Oct 12" text,"Week 9 Oct 26" text,"Week 10 Nov 2" text,"Week 11 Nov 9" text,"Week 13 Nov 23" text,"Week 14 Nov 30" text,"Week 15 (Final) Dec 7" text) | SELECT "Week 14 Nov 30" FROM table_5694 WHERE "Week 6 Oct 5" = 'michigan state (5-1)' |
what were the three most frequently ordered microbiology tests for patients that had previous fiber-optic bronchoscopy during the same month in 2104? | 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 cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_icd_diagnoses (row_id ... | SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR... |
How many submissions are there? | CREATE TABLE acceptance (submission_id number,workshop_id number,result text)CREATE TABLE workshop (workshop_id number,date text,venue text,name text)CREATE TABLE submission (submission_id number,scores number,author text,college text) | SELECT COUNT(*) FROM submission |
What are all the episodes with an episode run time of 24:01? | CREATE TABLE table_1429629_1 (episode VARCHAR,run_time VARCHAR) | SELECT episode FROM table_1429629_1 WHERE run_time = "24:01" |
show me the flights that leave on THURSDAY mornings from ATLANTA to WASHINGTON and include whether meals are offered and what the prices are | CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_day... | SELECT DISTINCT fare.fare_id, flight.flight_id, flight.meal_code FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_n... |
Return a line on what are all the calendar dates and day Numbers?, and rank in descending by the X-axis. | CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Documents_to_be_Destroyed (Document_ID INTEGER,Destruction_Authorised_by_Employee_ID INTEGER,Destroyed_by_Employee_ID INTEGER,Planned_Destruction_Date DATETIME,Actual_Destruct... | SELECT Calendar_Date, Day_Number FROM Ref_Calendar ORDER BY Calendar_Date DESC |
What is the lowest rank that has goals per match less than 1.237, real madrid as the club, goals less than 53, with apps greater than 40? | CREATE TABLE table_62326 ("Rank" real,"Name" text,"Season" text,"Club" text,"Goals" real,"Apps" real,"Goals per Match" real) | SELECT MIN("Rank") FROM table_62326 WHERE "Goals per Match" < '1.237' AND "Club" = 'real madrid' AND "Goals" < '53' AND "Apps" > '40' |
X reoccurs with Tag, post count. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId numb... | SELECT reoccurs.TagName AS reoccurs, 'WITH' AS presence, '##occurs:string##' AS occurs, COUNT(DISTINCT Posts.Id) AS nposts FROM Tags AS reoccurs, Posts, PostTags AS ptri WHERE Posts.Id = ptri.PostId AND ptri.TagId = reoccurs.Id AND '##occurs:string##' IN (SELECT TagName FROM Tags AS occurs, PostTags AS pti WHERE occurs... |
what is the number of patients whose primary disease is complete heart block and year of birth is less than 2200? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COMPLETE HEART BLOCK" AND demographic.dob_year < "2200" |
Bar graph to show the number of last name from different last name, and I want to order in ascending by the bar. | CREATE TABLE Courses (course_id VARCHAR(100),course_name VARCHAR(120),course_description VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Candidates (candidate_id INTEGER,candidate_details VARCHAR(255))CREATE TABLE People_Addresses (person_address_id INTEGER,person_id INTEGER,address_id INTEGER,date_from DATETIME,d... | SELECT last_name, COUNT(last_name) FROM People GROUP BY last_name ORDER BY last_name |
Which opponent has a Club of essendon, and a Score of 13.4.82? | CREATE TABLE table_67050 ("Quarter" text,"Score" text,"Club" text,"Opponent" text,"Year" text,"Round" text,"Venue" text) | SELECT "Opponent" FROM table_67050 WHERE "Club" = 'essendon' AND "Score" = '13.4.82' |
Display a pie chart for how many hosts does each nationality have? List the nationality and the count. | CREATE TABLE party_host (Party_ID int,Host_ID int,Is_Main_in_Charge bool)CREATE TABLE host (Host_ID int,Name text,Nationality text,Age text)CREATE TABLE party (Party_ID int,Party_Theme text,Location text,First_year text,Last_year text,Number_of_hosts int) | SELECT Nationality, COUNT(*) FROM host GROUP BY Nationality |
If the location is Yangon, Myanmar, what is the opponent total number? | CREATE TABLE table_25428629_1 (opponent VARCHAR,location VARCHAR) | SELECT COUNT(opponent) FROM table_25428629_1 WHERE location = "Yangon, Myanmar" |
What is the total teams during the 2012-13 season? | CREATE TABLE table_13696 ("Season" text,"Teams" real,"Minor Ladder Position" text,"Finals Qualification" text,"Final Ladder Position" text,"ACL Qualification" text,"ACL Placing" text) | SELECT SUM("Teams") FROM table_13696 WHERE "Season" = '2012-13' |
Draw a bar chart for what are the destinations and number of flights to each one?, I want to list from high to low by the Y-axis. | CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),departure_date date,arrival_date date,price number(7,2),aid number(9,0))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TABLE employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TA... | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY COUNT(*) DESC |
What score has south africa as the country? | CREATE TABLE table_name_92 (score VARCHAR,country VARCHAR) | SELECT score FROM table_name_92 WHERE country = "south africa" |
how many commissioners served under calvin coolidge ? | CREATE TABLE table_203_559 (id number,"no." number,"name" text,"took office" text,"left office" text,"president served under" text,"notable for" text) | SELECT COUNT("name") FROM table_203_559 WHERE "president served under" = 'calvin coolidge' |
For how long did Bolivia have a lane greater than 6? | CREATE TABLE table_31968 ("Heat Rank" real,"Lane" real,"Swimmer" text,"Country" text,"Time" real,"Overall Rank" text) | SELECT COUNT("Time") FROM table_31968 WHERE "Country" = 'bolivia' AND "Lane" > '6' |
What is the try bonus for ynysybwl rfc? | CREATE TABLE table_name_12 (try_bonus VARCHAR,club VARCHAR) | SELECT try_bonus FROM table_name_12 WHERE club = "ynysybwl rfc" |
Which Game has a Score of 4 1? | CREATE TABLE table_75443 ("Game" real,"December" real,"Opponent" text,"Score" text,"Record" text,"Points" real) | SELECT SUM("Game") FROM table_75443 WHERE "Score" = '4–1' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.