instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
what is the total amount of input that patient 4401 during a day before has received? | 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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_i... | SELECT SUM(inputevents_cv.amount) 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 = 4401)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), '... |
Between 10:00 and 2:00 is there any section of JAZZ 471 offered ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree... | SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.end_time <= '2:00' AND course_offering.start_time >= '10:00' AND course.course_id = course_offering.course_id AND course.department = 'JAZZ' AND course.number... |
Which Winning Team has the Fastest Lap of brendon hartley, and a Pole Position of oliver turvey, and a Circuit of spa-francorchamps, and the Winning Driver of brendon hartley? | CREATE TABLE table_name_75 (winning_team VARCHAR,winning_driver VARCHAR,circuit VARCHAR,fastest_lap VARCHAR,pole_position VARCHAR) | SELECT winning_team FROM table_name_75 WHERE fastest_lap = "brendon hartley" AND pole_position = "oliver turvey" AND circuit = "spa-francorchamps" AND winning_driver = "brendon hartley" |
How many military or civilians were wounded in the conflict that had an unknown number of civilian and total deaths? | CREATE TABLE table_61260 ("Military deaths" text,"Civilian deaths" text,"Total deaths (not including foreigners)" text,"Military and/or Civilian wounded" text,"Total casualties" text) | SELECT "Military and/or Civilian wounded" FROM table_61260 WHERE "Civilian deaths" = 'unknown' AND "Total deaths (not including foreigners)" = 'unknown' |
What are the titles of the episodes which had 1.10 million U.S. viewers? | CREATE TABLE table_73543 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (in millions)" text) | SELECT "Title" FROM table_73543 WHERE "U.S. viewers (in millions)" = '1.10' |
How many resulted in a loss with 479 points against? | CREATE TABLE table_name_52 (lost VARCHAR,points_against VARCHAR) | SELECT lost FROM table_name_52 WHERE points_against = "479" |
What numbered episode had 11.96 million US viewers? | CREATE TABLE table_26199130_1 (no INTEGER,us_viewers__million_ VARCHAR) | SELECT MAX(no) FROM table_26199130_1 WHERE us_viewers__million_ = "11.96" |
i would like a flight on CO leaving from BOSTON making a stop in DENVER and arriving in SAN FRANCISCO | CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE state (state_cod... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CI... |
What is the dirty electric grid rocky mountains (denver) for the vehicle with the clean electric grid california (san francisco) of 160 g/mi (99 g/km)? | CREATE TABLE table_2957 ("Vehicle" text,"Operating mode" text,"EPA rated All-electric range" text,"EPA rated combined fuel economy" text,"Clean electric grid California (San Francisco)" text,"U.S. national average electric mix" text,"Dirty electric grid Rocky Mountains (Denver)" text) | SELECT "Dirty electric grid Rocky Mountains (Denver)" FROM table_2957 WHERE "Clean electric grid California (San Francisco)" = '160 g/mi (99 g/km)' |
What is the total number of heat for Chinyere Pigot? | CREATE TABLE table_64944 ("Heat" real,"Lane" real,"Name" text,"Nationality" text,"Time" text) | SELECT COUNT("Heat") FROM table_64944 WHERE "Name" = 'chinyere pigot' |
Count the number of cities in Australia. | CREATE TABLE country (country_id number,country text,last_update time)CREATE TABLE film_text (film_id number,title text,description text)CREATE TABLE actor (actor_id number,first_name text,last_name text,last_update time)CREATE TABLE film (film_id number,title text,description text,release_year time,language_id number,... | SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia' |
Name the regular season record for standing 11th | CREATE TABLE table_20774360_2 (regular_season_record__w_l_ VARCHAR,standing VARCHAR) | SELECT regular_season_record__w_l_ FROM table_20774360_2 WHERE standing = "11th" |
When Jean Alesi had laps less than 24, what was his highest grid? | CREATE TABLE table_77635 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT MAX("Grid") FROM table_77635 WHERE "Driver" = 'jean alesi' AND "Laps" < '24' |
How many settlements are in esk krumlov (ck) with a population density higher than 38? | CREATE TABLE table_name_76 (noof_settlements INTEGER,district VARCHAR,pop_dens VARCHAR) | SELECT SUM(noof_settlements) FROM table_name_76 WHERE district = "český krumlov (ck)" AND pop_dens > 38 |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of department_id bin hire_date by weekday in a bar chart, I want to rank from low to high by the Y please. | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE 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... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(DEPARTMENT_ID) |
What are the number of the completion dates of all the tests that have result 'Fail'?, and rank from high to low by the y-axis. | CREATE TABLE Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCHAR(255))CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTE... | 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 least popular votes for year less than 1994 and percentage of 0.96% | CREATE TABLE table_68083 ("Year" real,"Office" text,"Candidate" text,"Popular Votes" real,"Percentage" text) | SELECT MIN("Popular Votes") FROM table_68083 WHERE "Year" < '1994' AND "Percentage" = '0.96%' |
Will OMS 995 classes take place on Friday ? | CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch... | SELECT DISTINCT course_offering.friday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'OMS' AND course.number = 995 AND semester.semester = 'WN' AND semester.year = 2016 |
Name the number of points for right halfback and starter being yes | CREATE TABLE table_14342480_5 (points VARCHAR,position VARCHAR,starter VARCHAR) | SELECT COUNT(points) FROM table_14342480_5 WHERE position = "Right halfback" AND starter = "yes" |
What college has Jojo Manalo? | CREATE TABLE table_55894 ("Pick" real,"Player" text,"Country of origin*" text,"PBA team" text,"College" text) | SELECT "College" FROM table_55894 WHERE "Player" = 'jojo manalo' |
What are the ids and details of events that have more than one participants, and order by the total number in desc. | CREATE TABLE Participants (Participant_ID INTEGER,Participant_Type_Code CHAR(15),Participant_Details VARCHAR(255))CREATE TABLE Events (Event_ID INTEGER,Service_ID INTEGER,Event_Details VARCHAR(255))CREATE TABLE Participants_in_Events (Event_ID INTEGER,Participant_ID INTEGER)CREATE TABLE Services (Service_ID INTEGER,Ser... | SELECT T1.Event_Details, T1.Event_ID FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_Details ORDER BY T1.Event_ID DESC |
What is the Nationality for alexandre jacques? | CREATE TABLE table_name_2 (nationality VARCHAR,player VARCHAR) | SELECT nationality FROM table_name_2 WHERE player = "alexandre jacques" |
what is the number of patients whose religion is romanian east. orth and year of birth is less than 2078? | 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,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.religion = "ROMANIAN EAST. ORTH" AND demographic.dob_year < "2078" |
Bar chart x axis duration y axis how many duration, display by the y axis in asc. | CREATE TABLE musical (Musical_ID int,Name text,Year int,Award text,Category text,Nominee text,Result text)CREATE TABLE actor (Actor_ID int,Name text,Musical_ID int,Character text,Duration text,age int) | SELECT Duration, COUNT(Duration) FROM actor GROUP BY Duration ORDER BY COUNT(Duration) |
Who was the home when the visitor was New York Knicks? | CREATE TABLE table_47003 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Home" FROM table_47003 WHERE "Visitor" = 'new york knicks' |
Show me the total number by country in a histogram, could you order in desc by the names? | CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year ... | SELECT Country, COUNT(*) FROM stadium GROUP BY Country ORDER BY Country DESC |
What is Player, when To Par is '7', and when Score is '73-72-67-75=287'? | CREATE TABLE table_name_10 (player VARCHAR,to_par VARCHAR,score VARCHAR) | SELECT player FROM table_name_10 WHERE to_par = 7 AND score = 73 - 72 - 67 - 75 = 287 |
how long did it take for erik lesser to finish ? | CREATE TABLE table_204_664 (id number,"rank" number,"bib" number,"name" text,"nationality" text,"start" text,"penalties (p+p+s+s)" text,"time" text,"deficit" text) | SELECT "time" FROM table_204_664 WHERE "name" = 'erik lesser' |
What race is in the 5th position? | CREATE TABLE table_70698 ("Race" text,"Position" text,"Time (HH:MM:SS)" text,"Speed (Mph)" text,"Replica" text) | SELECT "Race" FROM table_70698 WHERE "Position" = '5th' |
GROUP BY - Most popular user locations. | CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Review... | SELECT Location, COUNT(*) AS Population FROM dbo.Users GROUP BY Location ORDER BY Population DESC |
Who had the high point total on october 20? | CREATE TABLE table_3830 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High points" FROM table_3830 WHERE "Date" = 'October 20' |
What is the lowest 4 hoops, 2 clubs of the nation with a total of 38.25? | CREATE TABLE table_name_66 (_2_clubs VARCHAR,total VARCHAR) | SELECT MIN(4 AS _hoops), _2_clubs FROM table_name_66 WHERE total = 38.25 |
What is the date of enrollment of the course named 'Spanish', and count them by a bar chart, and list by the total number in desc. | 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 Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCH... | SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "Spanish" ORDER BY COUNT(date_of_enrolment) DESC |
Who is the host in the city of Philadelphia? | CREATE TABLE table_33237 ("Region" text,"Host" text,"Venue" text,"City" text,"State" text) | SELECT "Host" FROM table_33237 WHERE "City" = 'philadelphia' |
give me the number of patients whose admission year is less than 2154 and procedure icd9 code is 331? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2154" AND procedures.icd9_code = "331" |
Name the Provider that has a pay in 2006 , and a Transmission of iptv and digital terrestrial? | CREATE TABLE table_60009 ("Provider" text,"Years" text,"Free or pay" text,"Transmission" text,"On demand" text) | SELECT "Provider" FROM table_60009 WHERE "Free or pay" = 'pay' AND "Years" = '2006–' AND "Transmission" = 'iptv and digital terrestrial' |
Comments containing \text but not \\text. | CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Ta... | SELECT Comments.Id AS "comment_link", Comments.CreationDate FROM Comments LEFT JOIN Posts ON Comments.PostId = Posts.Id WHERE UserId = 7733418 AND Text LIKE '%.dump%' AND Tags LIKE '%sqlite%' ORDER BY CreationDate DESC |
how many episodes had both an original air date and an english air date ? | CREATE TABLE table_203_758 (id number,"no." number,"dub no." number,"english dubbed title / english subbed title\noriginal japanese title" text,"original air date" text,"english air date" text) | SELECT COUNT("english dubbed title / english subbed title\noriginal japanese title") FROM table_203_758 WHERE NOT "original air date" IS NULL AND NOT "english air date" IS NULL |
Name the total number of laps for 23rd position | CREATE TABLE table_68665 ("Year" real,"Team" text,"Co-Drivers" text,"Class" text,"Laps" real,"Pos." text,"Class Pos." text) | SELECT COUNT("Laps") FROM table_68665 WHERE "Pos." = '23rd' |
Whats the processor for p9xxx? | CREATE TABLE table_26577 ("Processor" text,"Brand name" text,"Model (list)" text,"Cores" real,"L2 Cache" text,"Socket" text,"TDP" text) | SELECT "Processor" FROM table_26577 WHERE "Model (list)" = 'P9xxx' |
When Jean Alesi had laps less than 24, what was his highest grid? | CREATE TABLE table_name_75 (grid INTEGER,driver VARCHAR,laps VARCHAR) | SELECT MAX(grid) FROM table_name_75 WHERE driver = "jean alesi" AND laps < 24 |
how many times were patient 23969's visited the hospital in this year? | 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 d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE inputevents_cv (row_id number,subject_id n... | SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 23969 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
Which date has serial of 11c? | CREATE TABLE table_49019 ("Date" text,"Time (GMT)" text,"Serial" text,"Apogee" text,"Outcome" text) | SELECT "Date" FROM table_49019 WHERE "Serial" = '11c' |
What is the frequency for the country station owned by Jim Pattison Group? | CREATE TABLE table_name_65 (frequency VARCHAR,format VARCHAR,owner VARCHAR) | SELECT frequency FROM table_name_65 WHERE format = "country" AND owner = "jim pattison group" |
Which years in Orlando are featured with the center position? | CREATE TABLE table_42084 ("Player" text,"Nationality" text,"Position" text,"Years in Orlando" text,"School/Club Team" text) | SELECT "Years in Orlando" FROM table_42084 WHERE "Position" = 'center' |
Show max(stu gpa) vs minimal stu gpa as scatter plot use a different color for each DEPT_CODE | CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE CLASS (CLASS_COD... | SELECT MAX(STU_GPA), MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE |
What is the lowest population density for the district of Santa Cruz and a Barangay larger than 82? | CREATE TABLE table_name_12 (pop_density__per_km2_ INTEGER,district VARCHAR,s_barangay VARCHAR) | SELECT MIN(pop_density__per_km2_) FROM table_name_12 WHERE district = "santa cruz" AND s_barangay > 82 |
List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name. | CREATE TABLE Scientists (Name VARCHAR,SSN VARCHAR)CREATE TABLE Projects (Name VARCHAR,Hours VARCHAR,Code VARCHAR)CREATE TABLE AssignedTo (Scientist VARCHAR,Project VARCHAR) | SELECT T1.Name, T3.Name, T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name, T1.Name |
Get me the number of patients who have drug code bume2 and hematology as lab test category. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "BUME2" AND lab."CATEGORY" = "Hematology" |
Which opponent completed a challenge competition with a result of 8-2 w? | CREATE TABLE table_62051 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Competition" text) | SELECT "Opponent" FROM table_62051 WHERE "Competition" = 'challenge' AND "Result" = '8-2 w' |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of manufacturer , and group by attribute name, display in desc by the y-axis. | CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER) | SELECT T2.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Manufacturer DESC |
What is Episodes (TV+extra) 2, when Broadcasts (TV) 1 is less than 13, and when Directors is 'Shigehito Takayanagi'? | CREATE TABLE table_43840 ("Series" text,"Title" text,"Broadcasts (TV) 1" real,"Episodes (TV+extra) 2" text,"Directors" text,"Aired in Japan 3" text,"US Release Date" text) | SELECT "Episodes (TV+extra) 2" FROM table_43840 WHERE "Broadcasts (TV) 1" < '13' AND "Directors" = 'shigehito takayanagi' |
what is the average temp of the nesccap electric double layer capacitor ? | CREATE TABLE table_204_583 (id number,"capacitor type" text,"capacity" text,"volts" text,"temp." text,"energy-to-weight ratio" text,"power-to-weight ratio" text) | SELECT AVG("temp.") FROM table_204_583 WHERE "capacitor type" = 'nesccap electric double-layer capacitor' |
What is the highest game number that had a time of 2:44? | CREATE TABLE table_79791 ("Game" real,"Date" text,"Location" text,"Time" text,"Attendance" real) | SELECT MAX("Game") FROM table_79791 WHERE "Time" = '2:44' |
how many current patients was there. | 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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE transfers (row_id nu... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.dischtime IS NULL |
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the average of employee_id , and group by attribute job_id, and I want to order y axis from low to high order. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID dec... | SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) |
what is the cheapest COACH flight between DALLAS and BALTIMORE leaving 8 10 | CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distan... | SELECT DISTINCT FLIGHT_0.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, date_day AS DATE... |
What game has 28 points, and tampa bay lightning as the opponent? | CREATE TABLE table_35018 ("Game" real,"December" real,"Opponent" text,"Score" text,"Record" text,"Points" real) | SELECT "Game" FROM table_35018 WHERE "Points" = '28' AND "Opponent" = 'tampa bay lightning' |
What date did the prime minister who entered office on 7 December 1916 leave office? | CREATE TABLE table_55890 ("Name" text,"Entered office" text,"Left office" text,"Political party" text,"Monarchs served" text,"Birth Place" text) | SELECT "Left office" FROM table_55890 WHERE "Entered office" = '7 december 1916' |
What was the time of the driver on grid 3? | CREATE TABLE table_78268 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Time/Retired" FROM table_78268 WHERE "Grid" = '3' |
Name the year with finish of 12th and record of 23-36 | CREATE TABLE table_68631 ("Year" text,"Record" text,"Finish" text,"Manager" text,"Playoffs" text) | SELECT "Year" FROM table_68631 WHERE "Finish" = '12th' AND "Record" = '23-36' |
How many companies that are not headquartered in the United States for each main industry? Show me a bar chart, and rank by the names from low to high. | CREATE TABLE station_company (Station_ID int,Company_ID int,Rank_of_the_Year int)CREATE TABLE company (Company_ID int,Rank int,Company text,Headquarters text,Main_Industry text,Sales_billion real,Profits_billion real,Assets_billion real,Market_Value real)CREATE TABLE gas_station (Station_ID int,Open_Year int,Location t... | SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry ORDER BY Main_Industry |
What years won have a total of 286? | CREATE TABLE table_name_11 (year_s__won VARCHAR,total VARCHAR) | SELECT year_s__won FROM table_name_11 WHERE total = 286 |
which is the flight number for the US flight from PHILADELPHIA to BOSTON is it 279 or is it 137338 | CREATE TABLE code_description (code varchar,description text)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE fare (far... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (((flight.flight_number = 137338 OR flight.flight_number = 279) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_... |
What is the latest season where he had 1 podium? | CREATE TABLE table_25539502_1 (season INTEGER,podiums VARCHAR) | SELECT MAX(season) FROM table_25539502_1 WHERE podiums = 1 |
What are the total Goals against with 72 points and more than 37 losses? | CREATE TABLE table_name_10 (goals_against INTEGER,points VARCHAR,lost VARCHAR) | SELECT SUM(goals_against) FROM table_name_10 WHERE points = 72 AND lost > 37 |
What are the titles of all movies that have between 3 and 5 stars? | CREATE TABLE movie (mid number,title text,year number,director text)CREATE TABLE rating (rid number,mid number,stars number,ratingdate time)CREATE TABLE reviewer (rid number,name text) | SELECT T2.title FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid WHERE T1.stars BETWEEN 3 AND 5 |
What is the score for the match where albert monta s was the partner? | CREATE TABLE table_33656 ("Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score" text) | SELECT "Score" FROM table_33656 WHERE "Partner" = 'albert montañés' |
what was the name of the medicine that patient 007-7646 was prescribed with in the same day after having been diagnosed with upper respiratory obstruction - due to tumor since 05/2105? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number... | SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-7646') AND diagnosis.diagnosi... |
What was the class when there were 325 laps? | CREATE TABLE table_name_32 (class VARCHAR,laps VARCHAR) | SELECT class FROM table_name_32 WHERE laps = 325 |
What is the unit of measuerment of the product category code 'Herbs'? | CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selling_price text,product_description text,other_product_details text)CREATE TABLE ref_colors (color_code text,color_description text)CREATE TABLE product_characteristics (product_id ... | SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs" |
How many were Wounded while in a Unit with a Complement of 83 off 9 Men? | CREATE TABLE table_56585 ("Unit" text,"Complement" text,"Killed" text,"Wounded" text,"Missing" text) | SELECT "Wounded" FROM table_56585 WHERE "Complement" = '83 off 9 men' |
what are the names of projects that require more than 300 hours, and how many scientists are assigned to each?, list by the Name in desc. | CREATE TABLE AssignedTo (Scientist int,Project char(4))CREATE TABLE Scientists (SSN int,Name Char(30))CREATE TABLE Projects (Code Char(4),Name Char(50),Hours int) | SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project WHERE T1.Hours > 300 GROUP BY T1.Name ORDER BY Name DESC |
What is the tyre with a 56 chassis? | CREATE TABLE table_57853 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Tyre" text,"Driver" text,"Rounds" text) | SELECT "Tyre" FROM table_57853 WHERE "Chassis" = '56' |
What team is Keith Mccambridge on? | CREATE TABLE table_1013129_8 (college_junior_club_team VARCHAR,player VARCHAR) | SELECT college_junior_club_team FROM table_1013129_8 WHERE player = "Keith McCambridge" |
which are the flights from DENVER to BALTIMORE or WASHINGTON | CREATE TABLE month (month_number int,month_name text)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE compartment_class (compartment varchar,class_type varchar)C... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND... |
What is the time/retired for mika h kkinen | CREATE TABLE table_56317 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Time/Retired" FROM table_56317 WHERE "Driver" = 'mika häkkinen' |
What is the IHSAA Football Class for county 67 putnam at Greencastle? | CREATE TABLE table_64092 ("School" text,"Location" text,"Mascot" text,"Enrollment" real,"IHSAA Class" text,"IHSAA Football Class" text,"County" text) | SELECT "IHSAA Football Class" FROM table_64092 WHERE "County" = '67 putnam' AND "School" = 'greencastle' |
tell me the average systemicdiastolic in patient 033-22108 in a day before? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientun... | SELECT AVG(vitalperiodic.systemicdiastolic) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-22108')) AND NOT vitalperiodic.systemicd... |
give me the number of patients whose admission type is emergency and diagnoses icd9 code is 40391? | 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 WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "40391" |
which countries won at least six bronze medals ? | CREATE TABLE table_204_727 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT "nation" FROM table_204_727 WHERE "bronze" >= 6 |
Name the least place for draw more than 3 and points of 8 | CREATE TABLE table_name_47 (place INTEGER,draw VARCHAR,points VARCHAR) | SELECT MIN(place) FROM table_name_47 WHERE draw > 3 AND points = 8 |
What is every conformity to original design if registration is HB-DAI? | CREATE TABLE table_22180353_1 (conformity_to_original_design VARCHAR,registration VARCHAR) | SELECT conformity_to_original_design FROM table_22180353_1 WHERE registration = "HB-DAI" |
list all flights at MKE | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name va... | SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, flight WHERE (flight.to_airport = AIRPORT_0.airport_code AND AIRPORT_0.airport_code = 'MKE') OR (flight.from_airport = AIRPORT_1.airport_code AND AIRPORT_1.airport_code = 'MKE') |
What are the enrollment dates of all the tests that have result 'Pass', and count them by a bar chart, and list in desc by the total number. | 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 Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCH... | SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" ORDER BY COUNT(date_of_enrolment) DESC |
What is the sum of 1891(s), when 1872 is less than 685, and when 1881 is less than 348? | CREATE TABLE table_42564 ("1861" real,"1866" real,"1872" real,"1876" real,"1881" real,"1886" real,"1891" real) | SELECT SUM("1891") FROM table_42564 WHERE "1872" < '685' AND "1881" < '348' |
How many rounds did the match at GCF: Strength and Honor last? | CREATE TABLE table_name_49 (round INTEGER,event VARCHAR) | SELECT AVG(round) FROM table_name_49 WHERE event = "gcf: strength and honor" |
Which employees have the role with code 'HR'? Find their names. | CREATE TABLE ref_locations (location_code text,location_name text,location_description text)CREATE TABLE documents_to_be_destroyed (document_id number,destruction_authorised_by_employee_id number,destroyed_by_employee_id number,planned_destruction_date time,actual_destruction_date time,other_details text)CREATE TABLE r... | SELECT employee_name FROM employees WHERE role_code = "HR" |
Draw a bar chart for how many storms occured in each region? | CREATE TABLE affected_region (Region_id int,Storm_ID int,Number_city_affected real)CREATE TABLE storm (Storm_ID int,Name text,Dates_active text,Max_speed int,Damage_millions_USD real,Number_Deaths int)CREATE TABLE region (Region_id int,Region_code text,Region_name text) | SELECT Region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.Region_id = T2.Region_id GROUP BY T1.Region_id |
other than asian junior championships , what other time did they place 1st ? | CREATE TABLE table_203_539 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" number) | SELECT "competition" FROM table_203_539 WHERE "competition" <> 'asian junior championships' AND "position" = 1 |
How many part 6 parts are there in the episode number 5? | CREATE TABLE table_13241993_3 (part_6 VARCHAR,episode__number VARCHAR) | SELECT COUNT(part_6) FROM table_13241993_3 WHERE episode__number = 5 |
When the Away team scored 11.8 (74) how many people showed up? | CREATE TABLE table_58013 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Crowd" FROM table_58013 WHERE "Away team score" = '11.8 (74)' |
Which Position has a Round larger than 14, and a School/Club Team of north texas? | CREATE TABLE table_39241 ("Round" real,"Pick" real,"Player" text,"Position" text,"School/Club Team" text) | SELECT "Position" FROM table_39241 WHERE "Round" > '14' AND "School/Club Team" = 'north texas' |
Who was the artist for the album, Christmas under the reunion label with the guitar? | CREATE TABLE table_7147 ("Year" real,"Artist" text,"Album" text,"Label" text,"Credit" text) | SELECT "Artist" FROM table_7147 WHERE "Label" = 'reunion' AND "Credit" = 'guitar' AND "Album" = 'christmas' |
count the number of patients younger than 20 years who suffer from neoplasm of uncertain behavior of other lymphatic and hematopoietic tissues/bone marrow transplant primary disease. | 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.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.age < "20" |
display the department name and number of employees in each of the department. | CREATE TABLE employees (department_id VARCHAR)CREATE TABLE departments (department_name VARCHAR,department_id VARCHAR) | SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name |
how many films were made in 2008 | CREATE TABLE table_204_647 (id number,"year" number,"film" text,"role" text,"language" text) | SELECT COUNT("film") FROM table_204_647 WHERE "year" = 2008 |
What is the to par of the player from England with a t1 place? | CREATE TABLE table_66755 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "To par" FROM table_66755 WHERE "Country" = 'england' AND "Place" = 't1' |
top ruby users from kerala. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE Tags (Id number,Tag... | SELECT u.Id, CONCAT('http://stackoverflow.com/users/', u.Id), (SELECT DisplayName FROM Users AS udn WITH (nolock) WHERE udn.Id = u.Id), COUNT(*) AS UpVotes FROM Tags AS t WITH (nolock) INNER JOIN PostTags AS pt WITH (nolock) ON pt.TagId = t.Id INNER JOIN Posts AS p WITH (nolock) ON p.ParentId = pt.PostId INNER JOIN Vot... |
how many patients have stayed at the ward 45 since 3 years ago? | 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 d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE procedures_icd (row_id ... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 45 AND DATETIME(transfers.intime) >= DATETIME(CURRENT_TIME(), '-3 year')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.