instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Show all different home cities. | CREATE TABLE school_bus (school_id number,driver_id number,years_working number,if_full_time others)CREATE TABLE driver (driver_id number,name text,party text,home_city text,age number)CREATE TABLE school (school_id number,grade text,school text,location text,type text) | SELECT DISTINCT home_city FROM driver |
What is the number of Last Runners-up that has the club name of dempo sc? | CREATE TABLE table_name_63 (Last INTEGER,club VARCHAR) | SELECT SUM(Last) AS runners_up FROM table_name_63 WHERE club = "dempo sc" |
Questions with titles like 'exists %' or 'exist %'. posts that could probably use editing, as this is broken English | CREATE TABLE PostHistoryTypes (Id number,Name text)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 PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,Paren... | SELECT p.Id AS "post_link", DisplayName, p.CreationDate FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.Title LIKE 'exist %' OR p.Title LIKE 'exists %' OR p.Title LIKE 'Exist %' OR p.Title LIKE 'Exists %' |
could you give me the schedule of flights for AA and DL to DFW on 8 15 | CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE month (month_number int,month_name text)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE equipment_sequence (aircraft_code_sequence v... | SELECT DISTINCT FLIGHT_0.arrival_time, FLIGHT_0.departure_time FROM airport, date_day, days, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_leg WHERE (((FLIGHT_1.airline_code = 'AA') OR (FLIGHT_1.airline_code = 'DL')) AND date_day.day_number = 15 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name ... |
What date was an episode with a run time of 24:30 broadcasted? | CREATE TABLE table_1579922_1 (broadcast_date VARCHAR,run_time VARCHAR) | SELECT broadcast_date FROM table_1579922_1 WHERE run_time = "24:30" |
in which venue was the next performance after the one at verdun auditorium ? | CREATE TABLE table_203_346 (id number,"date" text,"location" text,"venue" text,"opening act" text,"supporting" text) | SELECT "venue" FROM table_203_346 WHERE "date" > (SELECT "date" FROM table_203_346 WHERE "venue" = 'verdun auditorium') ORDER BY "date" LIMIT 1 |
What is Place, when To Par is less than 15, and when Score is 76-72-75-71=294? | CREATE TABLE table_name_59 (place VARCHAR,to_par VARCHAR,score VARCHAR) | SELECT place FROM table_name_59 WHERE to_par < 15 AND score = 76 - 72 - 75 - 71 = 294 |
Show the distinct leader names of colleges associated with members from country 'Canada'. | CREATE TABLE college (Leader_Name VARCHAR,College_ID VARCHAR)CREATE TABLE member (College_ID VARCHAR,Country VARCHAR) | SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = "Canada" |
What is the team when the incoming manager is martin allen? | CREATE TABLE table_26914854_3 (team VARCHAR,incoming_manager VARCHAR) | SELECT team FROM table_26914854_3 WHERE incoming_manager = "Martin Allen" |
Users above given number of upvotes (just names). | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoR... | SELECT Id AS "user_link", DisplayName FROM Users WHERE UpVotes > '##votes?100##' ORDER BY Id |
How many losses when there are less than 0 wins? | CREATE TABLE table_name_90 (losses VARCHAR,wins INTEGER) | SELECT COUNT(losses) FROM table_name_90 WHERE wins < 0 |
What race after round 6 did Graham Rahal win with a pole position of graham rahal? | CREATE TABLE table_45446 ("Round" real,"Race Name" text,"Pole position" text,"Winning driver" text,"Winning Team" text) | SELECT "Race Name" FROM table_45446 WHERE "Winning driver" = 'graham rahal' AND "Round" > '6' AND "Pole position" = 'graham rahal' |
What are the names of entrepreneurs? | CREATE TABLE entrepreneur (People_ID VARCHAR)CREATE TABLE people (Name VARCHAR,People_ID VARCHAR) | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID |
What was the maximum l&cr number for archimedes? | CREATE TABLE table_356 ("L&CR No." real,"Type" text,"Manufacturer" text,"Delivered" text,"Name" text,"Jt. Cttee No." real,"1845 disposal" text) | SELECT MAX("L&CR No.") FROM table_356 WHERE "Name" = 'Archimedes' |
who scored more points , hrabak or singson ? | CREATE TABLE table_204_627 (id number,"date" text,"opponent" text,"score" text,"top scorer (total points)" text,"venue (location)" text) | SELECT "top scorer (total points)" FROM table_204_627 WHERE "top scorer (total points)" IN ('mike hrabak', 'dale singson') ORDER BY "top scorer (total points)" DESC LIMIT 1 |
what was the insurance name of patient 3125 during their current hospital encounter? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 text,language text,marital_status t... | SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 3125 AND admissions.dischtime IS NULL |
What's the score on December 12, 1998? | CREATE TABLE table_65799 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Score" FROM table_65799 WHERE "Date" = 'december 12, 1998' |
Find names of all students who took some course and the course description. | CREATE TABLE employee (emp_num number,emp_lname text,emp_fname text,emp_initial text,emp_jobcode text,emp_hiredate time,emp_dob time)CREATE TABLE student (stu_num number,stu_lname text,stu_fname text,stu_init text,stu_dob time,stu_hrs number,stu_class text,stu_gpa number,stu_transfer number,dept_code text,stu_phone tex... | SELECT T1.stu_fname, T1.stu_lname, T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN class AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code |
Give me the comparison about Team_ID over the All_Road by a bar chart, and list by the Y-axis from high to low. | 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_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT All_Road, Team_ID FROM basketball_match ORDER BY Team_ID DESC |
What are the names of students who have taken Statistics courses? | CREATE TABLE course (course_id text,title text,dept_name text,credits number)CREATE TABLE takes (id text,course_id text,sec_id text,semester text,year number,grade text)CREATE TABLE student (id text,name text,dept_name text,tot_cred number)CREATE TABLE classroom (building text,room_number text,capacity number)CREATE TA... | SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics' |
What percent of the parliamentary election did the pensioners party receive | CREATE TABLE table_203802_2 (english_party_name VARCHAR) | SELECT 2013 AS _parliamentary_election FROM table_203802_2 WHERE english_party_name = "Pensioners Party" |
What is the market for KLRJ? | CREATE TABLE table_29301 ("Frequency" text,"Call sign" text,"Name" text,"Format" text,"Owner" text,"Target city/ market" text,"City of license" text) | SELECT "Target city/ market" FROM table_29301 WHERE "Call sign" = 'KLRJ' |
which party held the most seats but had a lesser turnout ? | CREATE TABLE table_203_494 (id number,"party" text,"votes" number,"%" number,"swing" number,"seats" number,"change" number) | SELECT "party" FROM table_203_494 ORDER BY "seats" DESC LIMIT 1 |
What label is after 2004? | CREATE TABLE table_name_24 (label VARCHAR,year INTEGER) | SELECT label FROM table_name_24 WHERE year > 2004 |
What was the score for the date of 15/6/03 | CREATE TABLE table_name_84 (score VARCHAR,date VARCHAR) | SELECT score FROM table_name_84 WHERE date = "15/6/03" |
what is the first city/town/village listed in the table ? | CREATE TABLE table_204_841 (id number,"no." number,"temple" text,"honzon (main image)" text,"city/town/village" text,"prefecture" text) | SELECT "city/town/village" FROM table_204_841 WHERE id = 1 |
Which institution was founded in 1923? | CREATE TABLE table_13759592_2 (institution VARCHAR,founded VARCHAR) | SELECT institution FROM table_13759592_2 WHERE founded = 1923 |
What was the name of the leader whose term ended in 2013? | CREATE TABLE table_name_49 (name VARCHAR,term_end VARCHAR) | SELECT name FROM table_name_49 WHERE term_end = "2013" |
IGNOREAnswers With Higher Score Than Accepted. | 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 PostNotices (Id number,PostId number,PostNoticeTypeId number,Cr... | SELECT Title, Id, Score, ViewCount FROM Posts WHERE PostTypeId = 1 |
what flights go from SAN FRANCISCO to WASHINGTON via INDIANAPOLIS | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE code_description (code varchar,description text)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE dual_carr... | 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 = 'WASHINGTON' AND CITY_2... |
Name the school/club team for 9 | CREATE TABLE table_15463188_16 (school_club_team VARCHAR,number VARCHAR) | SELECT school_club_team FROM table_15463188_16 WHERE number = "9" |
the number of times alisher kholigov was the top scorer in the league ? | CREATE TABLE table_204_357 (id number,"year" number,"div." text,"pos." text,"cup" text,"top scorer (league)" text,"score" number) | SELECT COUNT(*) FROM table_204_357 WHERE "top scorer (league)" = 'alisher kholiqov' |
had neurontin, midazolam (versed) 2 mg/2ml inj 2 mg or sodium chloride 0.9% 250 ml lvp been prescribed to patient 009-16880? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-16880')) AND medication.drugname IN ('neurontin', 'midazolam (versed) ... |
How many years have less than 28,505 attendance? | CREATE TABLE table_name_80 (year INTEGER,attendance INTEGER) | SELECT AVG(year) FROM table_name_80 WHERE attendance < 28 OFFSET 505 |
How many premierships for the queensland raceway? | CREATE TABLE table_name_40 (premierships VARCHAR,venue VARCHAR) | SELECT premierships FROM table_name_40 WHERE venue = "queensland raceway" |
What episode in the season was episode us18 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 = "US18" |
How many people wrote episode 68 in the series? | CREATE TABLE table_228973_5 (written_by VARCHAR,no_in_series VARCHAR) | SELECT COUNT(written_by) FROM table_228973_5 WHERE no_in_series = 68 |
What was the largest attendance at the Rheinstadion? | CREATE TABLE table_27131 ("Week" real,"Date" text,"Kickoff" text,"Opponent" text,"Final score" text,"Team record" text,"Game site" text,"Attendance" real) | SELECT MAX("Attendance") FROM table_27131 WHERE "Game site" = 'Rheinstadion' |
What is the pick number for round 2? | CREATE TABLE table_72512 ("Round" real,"Pick #" text,"Player" text,"Position" text,"Nationality" text,"College/junior/club team (league)" text) | SELECT "Pick #" FROM table_72512 WHERE "Round" = '2' |
Time ( ET ) of 1:00pm, and a Result of w 34 14 has what record? | CREATE TABLE table_36177 ("Week" real,"Date" text,"Opponent" text,"Location" text,"Time (ET)" text,"Result" text,"Record" text) | SELECT "Record" FROM table_36177 WHERE "Time ( ET )" = '1:00pm' AND "Result" = 'w 34–14' |
For those records from the products and each product's manufacturer, return a scatter chart about the correlation between code and code . | 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 T1.Code, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code |
count the number of patients whose year of birth is less than 2120 and lab test fluid is urine? | 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 procedures (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.dob_year < "2120" AND lab.fluid = "Urine" |
What is the pressure in ultra high vacuum? | CREATE TABLE table_170097_1 (pressure_in_hpa__mbar_ VARCHAR,vacuum_range VARCHAR) | SELECT pressure_in_hpa__mbar_ FROM table_170097_1 WHERE vacuum_range = "Ultra high vacuum" |
Has the class PEDDENT 593 been taught by anyone else , specifically Lutgarde Raskin ? | CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text 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 varcha... | SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'PEDDENT' AND course.number = 593 AND instructor.name LIKE '%Lutgarde Raskin%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instru... |
Cool guys - upvoters who never downvote others. Users with the most upvote count with zero downvote count | 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 VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskResults (... | SELECT Id AS "user_link", DownVotes, UpVotes, (DownVotes + UpVotes) AS totalVotes FROM Users WHERE Reputation > 125 AND UpVotes > 1000 AND DownVotes = 0 ORDER BY UpVotes DESC |
What week did Cleveland Browns played? | CREATE TABLE table_59298 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT AVG("Week") FROM table_59298 WHERE "Opponent" = 'cleveland browns' |
What is the result for week 12 against the Green Bay Packers? | CREATE TABLE table_9688 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text) | SELECT "Result" FROM table_9688 WHERE "Week" > '12' AND "Opponent" = 'green bay packers' |
who is the the womens doubles with mens doubles being leopold bauer alfred kohlhauser | CREATE TABLE table_15002265_1 (womens_doubles VARCHAR,mens_doubles VARCHAR) | SELECT womens_doubles FROM table_15002265_1 WHERE mens_doubles = "Leopold Bauer Alfred Kohlhauser" |
what was the name of the drug that since 2 months ago patient 005-73237 was last prescribed? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient... | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237')) AND DATETIME(medication.drugstarttime) >= DATETIME(CUR... |
What swimsuit score did the state of Virginia contestant achieve? | CREATE TABLE table_17635 ("State" text,"Preliminaries" text,"Interview" text,"Swimsuit" text,"Evening Gown" text,"Average" text) | SELECT COUNT("Swimsuit") FROM table_17635 WHERE "State" = 'Virginia' |
Comment - to - post ratio. | CREATE TABLE PostTypes (Id number,Name text)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 PostTags (PostId nu... | SELECT COUNT(DISTINCT p.Id) AS "Posts", COUNT(DISTINCT c.Id) AS "Comments", (COUNT(DISTINCT c.Id) * 1.00) / COUNT(DISTINCT p.Id) AS "Comments/Post" FROM Posts AS p LEFT JOIN Comments AS c ON c.PostId = p.Id |
provide the number of patients whose admission type is urgent and diagnoses icd9 code is 5939? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title 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,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "5939" |
What was the placing of the race in which Chic won by 8gf? | CREATE TABLE table_35558 ("Date" text,"Placing" text,"Beat by" text,"Location" text,"Distance" text) | SELECT "Placing" FROM table_35558 WHERE "Beat by" = 'won' AND "Distance" = '8gf' |
What are the dates of squadron 33? | CREATE TABLE table_45003 ("Aircraft" text,"Origin" text,"Squadron" text,"Display Aircraft" real,"Dates" text) | SELECT "Dates" FROM table_45003 WHERE "Squadron" = 'squadron 33' |
Tell me the type for category of mouse and attribute of ondblclick | CREATE TABLE table_39427 ("Category" text,"Type" text,"Attribute" text,"Bubbles" text,"Cancelable" text) | SELECT "Type" FROM table_39427 WHERE "Category" = 'mouse' AND "Attribute" = 'ondblclick' |
What is the highest decile value with a roll greater than 301 in Hauraki? | CREATE TABLE table_52597 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real) | SELECT MAX("Decile") FROM table_52597 WHERE "Roll" > '301' AND "Area" = 'hauraki' |
What is the average lane for Kenya with react larger than 0.212? | CREATE TABLE table_name_79 (lane INTEGER,nationality VARCHAR,react VARCHAR) | SELECT AVG(lane) FROM table_name_79 WHERE nationality = "kenya" AND react > 0.212 |
What was the Timberwolves' record on April 3? | CREATE TABLE table_21242 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Record" FROM table_21242 WHERE "Date" = 'April 3' |
For those employees who was hired before 2002-06-21, find hire_date and the average of employee_id bin hire_date by weekday, and visualize them by a bar chart. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varcha... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' |
When the lane is under 2 and the name is virgen benavides with a mark of 7.29, what's the total number of Heat found? | CREATE TABLE table_name_14 (heat VARCHAR,lane VARCHAR,mark VARCHAR,name VARCHAR) | SELECT COUNT(heat) FROM table_name_14 WHERE mark = "7.29" AND name = "virgen benavides" AND lane < 2 |
what is the only season he has fewer than three sacks ? | CREATE TABLE table_204_756 (id number,"year" number,"team" text,"games" number,"combined tackles" number,"tackles" number,"assisted tackles" number,"sacks" number,"forced fumbles" number,"fumble recoveries" number,"fumble return yards" number,"interceptions" number,"interception return yards" number,"yards per intercep... | SELECT "year" FROM table_204_756 WHERE "sacks" < 3 |
What was the attendance when South Melbourne played as the home team? | CREATE TABLE table_name_21 (crowd INTEGER,home_team VARCHAR) | SELECT MIN(crowd) FROM table_name_21 WHERE home_team = "south melbourne" |
What is Score, when Year is before 2007, and when Tournament is 'Sydney'? | CREATE TABLE table_7785 ("Year" real,"Tournament" text,"Surface" text,"Round" text,"Winner" text,"Score" text) | SELECT "Score" FROM table_7785 WHERE "Year" < '2007' AND "Tournament" = 'sydney' |
Find the name and budget of departments whose budgets are more than the average budget Visualize by bar chart, and could you display by the budget from low to high? | CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numeric(8,2))CREATE TABLE department (dept_name varchar(20),building varchar(15),budget numeric(12,2))CREATE TABLE course (course_id varchar(8),title varchar(50),dept_name varchar(20),credits numeric(2,0))CREATE TABLE advisor (s_ID var... | SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget |
Get User Info (Total answers and Accepted Answers). Returns the URL with the user's original inputted URL, the users reputation, number of answers posted, number of answers accepted.. Returns the URL with the user's original inputted URL, the users reputation, number of answers posted, number of answers accepted.
For ... | CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId... | SELECT answer.OwnerUserId AS "user_link", 'http://codegolf.stackexchange.com/users/' + CAST(answer.OwnerUserId AS TEXT(10)) AS "permalink", Users.Reputation, COUNT(answer.Id) AS "total_answers", COUNT(question.Id) AS "accepted_answers" FROM Posts AS answer LEFT OUTER JOIN Posts AS question ON question.AcceptedAnswerId ... |
provide the number of patients who has stayed in the hospital for more than 9 days with a main drug type | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "9" AND prescriptions.drug_type = "MAIN" |
Show aircraft names and number of flights for each aircraft, and show by the name in desc. | CREATE TABLE certificate (eid number(9,0),aid number(9,0))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 aircraft (aid number(9,0),name varchar2(30),distance number(6,0))CREATE T... | SELECT name, COUNT(*) FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid ORDER BY name DESC |
what was the name of the allergy that until 58 months ago patient 011-35642 had. | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,pat... | SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-35642')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME()... |
What are the names of the categories when the player is olsen racela? | CREATE TABLE table_28628309_9 (category VARCHAR,player VARCHAR) | SELECT category FROM table_28628309_9 WHERE player = "Olsen Racela" |
Which title has a year prior to 2008 and xbox 360 as the platform? | CREATE TABLE table_name_31 (title VARCHAR,year VARCHAR,platform VARCHAR) | SELECT title FROM table_name_31 WHERE year < 2008 AND platform = "xbox 360" |
Show name and distance for all aircrafts Visualize by bar chart, and display in desc by the names. | 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 employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TA... | SELECT name, distance FROM aircraft ORDER BY name DESC |
Name the site for game of game 2 | CREATE TABLE table_38818 ("Game" text,"Date" text,"Result" text,"Site" text,"Series" text) | SELECT "Site" FROM table_38818 WHERE "Game" = 'game 2' |
what is maximum age of patients whose primary disease is overdose and days of hospital stay is 69? | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "OVERDOSE" AND demographic.days_stay = "69" |
What are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor, rank from high to low by the x axis. | CREATE TABLE people (People_ID int,Name text,Height real,Weight real,Date_of_Birth text)CREATE TABLE entrepreneur (Entrepreneur_ID int,People_ID int,Company text,Money_Requested real,Investor text) | SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor ORDER BY Investor DESC |
What is the number of booking start dates of the apartments with type code 'Duplex' in each year? Return a bar chart, list by the how many booking start date in desc. | CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Bookings (apt_booking_id INTEGER,apt_id INTEGER,guest_id INTEGER,booking_status_code CHAR(15),booking_start_date DATETIME,booking_end_date DATETIME)CREATE TABLE View_Unit_Status (apt_id INTEGER,apt_booking_id INTEGER,status_... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex" ORDER BY COUNT(booking_start_date) DESC |
Who is the home team that scored 12.14 (86) when their opponent scored 22.15 (147)? | CREATE TABLE table_55215 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team" FROM table_55215 WHERE "Home team score" = '12.14 (86)' AND "Away team score" = '22.15 (147)' |
what is drug route of drug name buspirone? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "BusPIRone" |
What is Gary David Saunders' Tenure? | CREATE TABLE table_name_23 (tenure VARCHAR,name VARCHAR) | SELECT tenure FROM table_name_23 WHERE name = "gary david saunders" |
Which Athlete is from the United Kingdom? | CREATE TABLE table_11625 ("Year" real,"Athlete" text,"Country/State" text,"Time" text,"Location" text) | SELECT "Athlete" FROM table_11625 WHERE "Country/State" = 'united kingdom' |
other than scorpio , jr. and super crazy , name a championship that took place at iwl oktoberfest . | CREATE TABLE table_204_245 (id number,"#" number,"wrestlers" text,"reign" number,"date" text,"days\nheld" number,"location" text,"event" text,"notes" text) | SELECT "wrestlers" FROM table_204_245 WHERE "wrestlers" <> 'scorpio, jr. and super crazy' AND "event" = 'iwl oktoberfest' |
Find the name and nationality of the swimmer who has won (i.e., has a result of 'win') more than 1 time. | CREATE TABLE event (id number,name text,stadium_id number,year text)CREATE TABLE record (id number,result text,swimmer_id number,event_id number)CREATE TABLE stadium (id number,name text,capacity number,city text,country text,opening_year number)CREATE TABLE swimmer (id number,name text,nationality text,meter_100 numbe... | SELECT t1.name, t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE result = 'Win' GROUP BY t2.swimmer_id HAVING COUNT(*) > 1 |
What was the winning party when the incumbent was richard s. whaley? | CREATE TABLE table_1346137_4 (party VARCHAR,incumbent VARCHAR) | SELECT party FROM table_1346137_4 WHERE incumbent = "Richard S. Whaley" |
What are the works numbers where the year is 1929 and the driver diameter is 60'/1520mm? | CREATE TABLE table_31321 ("SAR No." real,"Builder" text,"Year" real,"Works No." real,"Firebox" text,"Driver Diameter" text) | SELECT "Works No." FROM table_31321 WHERE "Year" = '1929' AND "Driver Diameter" = '60"/1520mm' |
what is the average value of heartrate of patient 002-44624? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllab... | SELECT AVG(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 = '002-44624')) AND NOT vitalperiodic.heartrate IS NULL |
show me the flights from BOSTON to PITTSBURGH | CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE flight_fare (flight_id int,fare_id int)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_... | 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 CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU... |
how many patients whose year of death is less than or equal to 2183 and drug code is rosi8? | 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 lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2183.0" AND prescriptions.formulary_drug_cd = "ROSI8" |
Find the average gpa of all students in each department with a pie chart. | CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)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 STUDENT (STU_NUM int,STU_... | SELECT DEPT_CODE, AVG(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE |
tell me the admission type and primary disease of subject id 2560. | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT demographic.admission_type, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "2560" |
Name the year for willie goggin | CREATE TABLE table_25147 ("Year" real,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text) | SELECT "Year" FROM table_25147 WHERE "Runner(s)-up" = 'Willie Goggin' |
When Vincennes is the county seat what is the area sq mi (km 2 ) (rank) ? | CREATE TABLE table_14253123_1 (area_sq_mi__km_2____rank_ VARCHAR,county_seat VARCHAR) | SELECT area_sq_mi__km_2____rank_ FROM table_14253123_1 WHERE county_seat = "Vincennes" |
Do you know who the instructor is for Interdisciplinary English this semester ? | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE co... | SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester... |
what was the monthly maximum value of weight for patient 23930 in 2103? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,l... | 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 = 23930)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admi... |
What is the club when the chairman is roger lambrecht? | CREATE TABLE table_27374004_2 (club VARCHAR,chairman VARCHAR) | SELECT club FROM table_27374004_2 WHERE chairman = "Roger Lambrecht" |
What is John Shadegg's First Elected date? | CREATE TABLE table_name_18 (first_elected INTEGER,incumbent VARCHAR) | SELECT AVG(first_elected) FROM table_name_18 WHERE incumbent = "john shadegg" |
For all employees who have the letters D or S in their first name, for department_id, hire_date, visualize the trend, and could you rank x axis from low to high order? | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME va... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE |
Closed questions in the [row] tag. | 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 DISTINCT Id, Score, Title FROM Posts AS p JOIN (SELECT PostId FROM PostHistory AS ph JOIN PostHistoryTypes AS pht ON ph.PostHistoryTypeId = pht.Id WHERE pht.Name = 'Post Closed') AS closed ON p.Id = closed.PostId WHERE Tags LIKE '%<row>%' AND NOT ClosedDate IS NULL AND Score > -3 AND AcceptedAnswerId IS NULL ORD... |
For those records from the products and each product's manufacturer, give me the comparison about the sum of revenue over the headquarter , and group by attribute headquarter by a bar chart, rank in ascending 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 Headquarter, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY SUM(Revenue) |
when was the loan ended when the country is ghana? | CREATE TABLE table_46422 ("Name" text,"Country" text,"Loan Club" text,"Started" text,"Ended" text,"Start Source" text,"End Source" text) | SELECT "Ended" FROM table_46422 WHERE "Country" = 'ghana' |
All my answers in stackoverflow. All my answers in stackoverflow | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu... | SELECT * FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = @UserId AND a.PostTypeId = 2 ORDER BY q.CreationDate |
How many points did the opponents score at the game in Knoxville? | CREATE TABLE table_25551 ("Date" text,"Location" text,"Opponent" text,"Sooners Points" real,"Opp. Points" real,"Record" text) | SELECT MIN("Opp. Points") FROM table_25551 WHERE "Location" = 'Knoxville' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.