instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Top questions with zero answers since Jan 2016. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserI... | SELECT p.Id AS "post_link", Title, p.Tags AS Tags, p.ViewCount AS "Views", p.Score AS "Score", p.AnswerCount AS "Answers", DATEDIFF(day, p.CreationDate, GETDATE()) AS "Age (days)", p.AcceptedAnswerId AS "Answer Accepted?" FROM Posts AS p WHERE p.AcceptedAnswerId IS NULL AND p.CreationDate >= '20160101' AND p.AnswerCoun... |
What is Aberdeen team's date of vacancy? | CREATE TABLE table_name_37 (date_of_vacancy VARCHAR,team VARCHAR) | SELECT date_of_vacancy FROM table_name_37 WHERE team = "aberdeen" |
What is the level when points are larger than 25, and goals are 64 31? | CREATE TABLE table_12883 ("Season" text,"Level" text,"Goals" text,"Points" real,"Domestic Cup" text) | SELECT "Level" FROM table_12883 WHERE "Points" > '25' AND "Goals" = '64–31' |
patients with suspected or proven infection and 2 of the following 6 criteria: body temperature < 36 or > 38.3 celsius ; heart rate > 90 beats / min ; tachypnea > 20 / min or a arterial paco2 below 4.25 kpa ; white blood cell count higher than 12000 or below 4000 or more than 10 % immature forms ; systolic blood pressu... | CREATE TABLE table_train_70 ("id" int,"pregnancy_or_lactation" bool,"white_blood_cell_count_wbc" int,"systolic_blood_pressure_sbp" int,"mean_arterial_pressure_map" int,"temperature" float,"oliguria" bool,"surgery" bool,"heart_rate" int,"systemic_inflammatory_response" bool,"paco2" float,"burn_injury" int,"immature_form... | SELECT * FROM table_train_70 WHERE (CASE WHEN temperature < 36 OR temperature > 38.3 THEN 1 ELSE 0 END + CASE WHEN heart_rate > 90 THEN 1 ELSE 0 END + CASE WHEN respiratory_rate > 20 OR paco2 < 4.25 THEN 1 ELSE 0 END + CASE WHEN white_blood_cell_count_wbc > 12000 OR white_blood_cell_count_wbc < 4000 OR immature_form > ... |
how many current patients are of age 40s? | 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 patient (uniquepid text,patienthealthsystemstayid number,patientunit... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age BETWEEN 40 AND 49 |
How many draws correspond to more than 11 losses in a match less than 14? | CREATE TABLE table_42393 ("Team" text,"Match" real,"Points" real,"Draw" real,"Lost" real) | SELECT COUNT("Draw") FROM table_42393 WHERE "Lost" > '11' AND "Match" < '14' |
How many stackexchange non-meta sites are there?. | CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags tex... | SELECT * FROM sys.databases WHERE (NOT name LIKE '%.Meta' OR name = 'StackExchange.Meta') AND database_id > 5 |
If grid is 2, what is the minimum fin. pos number? | CREATE TABLE table_17330069_1 (fin_pos INTEGER,grid VARCHAR) | SELECT MIN(fin_pos) FROM table_17330069_1 WHERE grid = 2 |
What is the total length when the title is ' one man's junk | CREATE TABLE table_21856 ("Episode" real,"Original title" text,"Directed by" text,"Written by" text,"Original airdate" text,"Duration" text,"Viewership" text) | SELECT COUNT("Duration") FROM table_21856 WHERE "Original title" = ' One Man''s Junk ' |
how many hours has it been since patient 92788's first late effect cv dis nec diagnosis in the current hospital encounter. | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)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_i... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'late effect cv dis nec') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admi... |
Name the country for 37.23 1985 | CREATE TABLE table_24749 ("Country" text,"Area (000s)" text,"1950 (mil)" text,"1970 (mil)" text,"1980 (mil)" text,"1985 (mil)" text,"Annual Growth (1950\u20131985)" text,"Density (1980)" text) | SELECT "Country" FROM table_24749 WHERE "1985 (mil)" = '37.23' |
What is the general classification with riccardo ricc as the young rider classification? | CREATE TABLE table_35468 ("Stage" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Young rider classification" text) | SELECT "General classification" FROM table_35468 WHERE "Young rider classification" = 'riccardo riccò' |
What is the average lane racheal nachula has when the heat is less than 2? | CREATE TABLE table_name_80 (lane INTEGER,heat VARCHAR,name VARCHAR) | SELECT AVG(lane) FROM table_name_80 WHERE heat < 2 AND name = "racheal nachula" |
Find the emails of customers who has filed a complaints of the product with the most complaints. | CREATE TABLE staff (staff_id number,gender text,first_name text,last_name text,email_address text,phone_number text)CREATE TABLE products (product_id number,parent_product_id number,product_category_code text,date_product_first_available time,date_product_discontinued time,product_name text,product_description text,pro... | SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) LIMIT 1 |
What numbered episode had 11.96 million US viewers? | CREATE TABLE table_28416 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"U.S. viewers (million)" text,"Rank (week)" text,"Original air date" text,"Production code" text) | SELECT MAX("No.") FROM table_28416 WHERE "U.S. viewers (million)" = '11.96' |
what's the total number of patients in ward 39 since 2101? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE icustays (row_id number,subject_id n... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 39 AND STRFTIME('%y', transfers.intime) >= '2101') |
What's the home team for the junction oval venue? | CREATE TABLE table_name_28 (home_team VARCHAR,venue VARCHAR) | SELECT home_team AS score FROM table_name_28 WHERE venue = "junction oval" |
what is the team that is pick 31? | CREATE TABLE table_name_19 (team VARCHAR,pick VARCHAR) | SELECT team FROM table_name_19 WHERE pick = 31 |
What is the location of the tiruchirappalli district? | CREATE TABLE table_57114 ("College Name" text,"Location" text,"District" text,"Affiliation" text,"Estd" text) | SELECT "Location" FROM table_57114 WHERE "District" = 'tiruchirappalli district' |
how many patients whose admission year is less than 2105 and diagnoses long title is stevens-johnson syndrome-toxic epidermal necrolysis overlap syndrome? | 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,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2105" AND diagnoses.long_title = "Stevens-Johnson syndrome-toxic epidermal necrolysis overlap syndrome" |
All tags of a given site. | CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE FlagTypes ... | SELECT t.TagName, t.Count, p1.Body, p2.Body FROM "superuser".dbo.Tags AS t LEFT JOIN "superuser".dbo.Posts AS p1 ON p1.Id = t.ExcerptPostId LEFT JOIN "superuser".dbo.Posts AS p2 ON p2.Id = t.WikiPostId ORDER BY t.Count DESC |
What team has Steinar Kaldal, a guard / forward? | CREATE TABLE table_34354 ("Season" text,"Player" text,"Position" text,"Nationality" text,"Team" text) | SELECT "Team" FROM table_34354 WHERE "Position" = 'guard / forward' AND "Player" = 'steinar kaldal' |
how many hours has been passed since the first time patient 8888 stayed in careunit tsicu in their current hospital encounter? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime 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 prescriptio... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8888 AND admissions.dischtime IS NULL) AND transfers.careunit = 'tsicu' ORDER BY transfers.intime LIMIT 1 |
What is the Opponent when Todd Woodbridge was the runner-up, and a Date of 26 august 1996? | CREATE TABLE table_43358 ("Outcome" text,"Date" text,"Championship" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Opponent" FROM table_43358 WHERE "Outcome" = 'runner-up' AND "Date" = '26 august 1996' |
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the average of price , and group by attribute name, and rank Name from low to high order. | 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.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name |
Tell me the manner of departure for 3 january date of appointment | CREATE TABLE table_77880 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text) | SELECT "Manner of departure" FROM table_77880 WHERE "Date of appointment" = '3 january' |
provide the number of patients whose age is less than 48 and procedure icd9 code is 5011? | 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.age < "48" AND procedures.icd9_code = "5011" |
Get all community wiki posts. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName ... | SELECT * FROM Posts WHERE OwnerUserId = -1 AND PostTypeId = 3 ORDER BY CreationDate DESC LIMIT 100 |
Ioannis Christou with a rank smaller than 6 has what notes? | CREATE TABLE table_name_71 (notes VARCHAR,rank VARCHAR,athlete VARCHAR) | SELECT notes FROM table_name_71 WHERE rank < 6 AND athlete = "ioannis christou" |
Line chart, the X is the hire date of employees and the Y-axis is the corresponding salary, and order x axis in asc order please. | 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, SALARY FROM employees ORDER BY HIRE_DATE |
Name the the Best of rodolfo lav n | CREATE TABLE table_name_12 (best VARCHAR,name VARCHAR) | SELECT best FROM table_name_12 WHERE name = "rodolfo lavín" |
how many locations has spain as the winner? | CREATE TABLE table_820 ("Year" real,"Winner" text,"Language" text,"Artist" text,"Song" text,"Points" real,"Margin" real,"Second place" text,"Date" text,"Venue" text,"Location" text,"Participants" real) | SELECT COUNT("Location") FROM table_820 WHERE "Winner" = 'Spain' |
What is the name of the home team that played against Collingwood? | CREATE TABLE table_53422 ("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_53422 WHERE "Away team" = 'collingwood' |
Who instructs BCS 532 ? | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course (course_id int,name varchar,department varchar,numbe... | SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'BCS' AND course.number = 532 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.of... |
What is the score of the away team that played home team Geelong? | CREATE TABLE table_78029 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team score" FROM table_78029 WHERE "Home team" = 'geelong' |
What is the losing bonus of the team with 22 pays and 428 points against? | CREATE TABLE table_name_9 (losing_bonus VARCHAR,played VARCHAR,points_against VARCHAR) | SELECT losing_bonus FROM table_name_9 WHERE played = "22" AND points_against = "428" |
give the number of patients who have stayed in the hospital for more than one day and the diagnosis long title is end stage renal disease. | 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 diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.long_title = "End stage renal disease" |
In 2008, what was the world ranking that ranked 5th in L.A.? | CREATE TABLE table_name_54 (world_ranking__1_ VARCHAR,ranking_la__2_ VARCHAR,year_of_publication VARCHAR) | SELECT world_ranking__1_ FROM table_name_54 WHERE ranking_la__2_ = "5th" AND year_of_publication = "2008" |
What is the average played value in Belgrade with attendance greater than 26,222? | CREATE TABLE table_name_83 (played INTEGER,city VARCHAR,average_attendance VARCHAR) | SELECT AVG(played) FROM table_name_83 WHERE city = "belgrade" AND average_attendance > 26 OFFSET 222 |
Name the three for william prewett for four and five being richard ellis with seven being nicholas king on 5 november 1693 | CREATE TABLE table_51633 ("Date" text,"Three" text,"Four" text,"Five" text,"Seven" text) | SELECT "Three" FROM table_51633 WHERE "Four" = 'william prewett' AND "Five" = 'richard ellis' AND "Seven" = 'nicholas king' AND "Date" = '5 november 1693' |
find the number of patients with diagnoses icd9 code 34291 for whom ascitic fluid lab test order was placed. | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "34291" AND lab.fluid = "Ascites" |
What was the 2012 finish in the US Open? | CREATE TABLE table_68292 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"2013" text) | SELECT "2012" FROM table_68292 WHERE "Tournament" = 'us open' |
what specimen was patient 27465 tested for the last time in 06/this year? | 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 text,ethnicity text,age number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,... | SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27465) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', micro... |
What party is incumbent virgil chapman from? | CREATE TABLE table_1342233_17 (party VARCHAR,incumbent VARCHAR) | SELECT party FROM table_1342233_17 WHERE incumbent = "Virgil Chapman" |
Who was the opponent in week 4? | CREATE TABLE table_14875671_1 (opponent VARCHAR,week VARCHAR) | SELECT opponent FROM table_14875671_1 WHERE week = 4 |
On what circuit is there a class gts-2 race that takes place on May 27? | CREATE TABLE table_52588 ("Race" text,"Length" text,"Class" text,"Circuit" text,"Date" text) | SELECT "Circuit" FROM table_52588 WHERE "Date" = 'may 27' AND "Class" = 'gts-2' |
What season was herschelle gibbs andrew symonds venugopal rao batsmen? | CREATE TABLE table_22962745_35 (season VARCHAR,batsmen VARCHAR) | SELECT season FROM table_22962745_35 WHERE batsmen = "Herschelle Gibbs Andrew Symonds Venugopal Rao" |
How many different actors from the Second national tour year 2 played the character played by Oliver Tompsett from the original West End cast? | CREATE TABLE table_19529639_3 (second_national_tour_year_2 VARCHAR,original_west_end_cast VARCHAR) | SELECT COUNT(second_national_tour_year_2) FROM table_19529639_3 WHERE original_west_end_cast = "Oliver Tompsett" |
When batavo is the main sponsor and olympikus is the kit manufacturer who are the minor sponsors? | CREATE TABLE table_187239_1 (minor_sponsors VARCHAR,kit_manufacturer VARCHAR,main_sponsor VARCHAR) | SELECT minor_sponsors FROM table_187239_1 WHERE kit_manufacturer = "Olympikus" AND main_sponsor = "Batavo" |
Name the tournament of beijing | CREATE TABLE table_70100 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text) | SELECT "2011" FROM table_70100 WHERE "Tournament" = 'beijing' |
provide the number of patients whose procedure icd9 code is 4576 and drug route is iv bolus | 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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "4576" AND prescriptions.route = "IV BOLUS" |
What streak start has a total less than 79, 22t as the rank, and tampa bay as the teams? | CREATE TABLE table_5879 ("Rank" text,"Quarterback" text,"Streak start" text,"Streak end" text,"Teams" text,"Regular season" real,"Playoffs" real,"Total" real) | SELECT "Streak start" FROM table_5879 WHERE "Total" < '79' AND "Rank" = '22t' AND "Teams" = 'tampa bay' |
What is the Visitor with a Leading scorer with rudy gay (24)? | CREATE TABLE table_10738 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text) | SELECT "Visitor" FROM table_10738 WHERE "Leading scorer" = 'rudy gay (24)' |
What is every website with specialization of engineering and division of dhaka division? | CREATE TABLE table_2112260_1 (website VARCHAR,specialization VARCHAR,division VARCHAR) | SELECT website FROM table_2112260_1 WHERE specialization = "Engineering" AND division = "Dhaka division" |
what was the name of the medicine that was prescribed to patient 14467 for the first time during this month? | 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 d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventty... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467) AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY prescriptions.startdate LIMIT 1 |
For the chinese name how many in total is the govt salary? | CREATE TABLE table_22035 ("Romanised name" text,"Chinese name" text,"age at appointment" real,"Foreign nationality" text,"Portfolio attachment" text,"Prior occupation" text,"Govt salary" text) | SELECT COUNT("Govt salary") FROM table_22035 WHERE "Chinese name" = '盧奕基' |
count the number of patients whose marital status is divorced and procedure icd9 code is 8968? | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.icd9_code = "8968" |
What is on Dr. Andrew Cadotte 's roster for the next term ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Andrew Cadotte%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.of... |
What is download bandwith where the provider is deutsche telekom ag? | CREATE TABLE table_72929 ("DSL Type" text,"Provider" text,"Resale" text,"Down (up to kbit/s)" real,"Up (up to kbit/s)" real) | SELECT MAX("Down (up to kbit/s)") FROM table_72929 WHERE "Provider" = 'Deutsche Telekom AG' |
Top 100 users by average score. | CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score num... | SELECT Users.Id AS "user_link", Users.Reputation, COUNT(Posts.Id) AS Questions, CAST(AVG(CAST(Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_score" FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 1 GROUP BY Users.Id, DisplayName, Users.Reputation HAVING COUNT(Posts.Id) > 1 ORDER BY 'average_score... |
All answers by a user, with questions. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Comments ... | SELECT a.CreationDate, a.Id, b.Id AS "post_link", b.Title, b.Body AS Question, a.Body AS Answer FROM Posts AS a INNER JOIN Posts AS b ON a.ParentId = b.Id WHERE a.OwnerUserId = '##UserId##' ORDER BY a.CreationDate |
what is subject name of subject id 2560? | CREATE TABLE procedures (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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT demographic.name FROM demographic WHERE demographic.subject_id = "2560" |
How many faculty members participate in each activity? Return the activity names and the number of faculty members Show bar chart, list in ascending by the x-axis. | 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,activity_name varchar(25))CREATE TABLE Participates_in (stuid ... | SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY activity_name |
what is the company with the highest revenue in the automotive industry ? | CREATE TABLE table_203_83 (id number,"ranking" number,"company" text,"industry" text,"revenue (usd billions)" text,"fy" text,"capitalization (usd billions)" text,"employees" number,"listing" text,"headquarters" text,"ceo" text) | SELECT "company" FROM table_203_83 WHERE "industry" = 'automotive' ORDER BY "revenue (usd billions)" DESC LIMIT 1 |
Which Attendance has a Game score less than 3, and a Score of 2 5? | CREATE TABLE table_name_58 (attendance INTEGER,game VARCHAR,score VARCHAR) | SELECT AVG(attendance) FROM table_name_58 WHERE game < 3 AND score = "2 – 5" |
was duke at 2:00 pm or 1:00 pm ? | CREATE TABLE table_204_513 (id number,"date" text,"time" text,"opponent#" text,"site" text,"tv" text,"result" text,"attendance" number) | SELECT "time" FROM table_204_513 WHERE "opponent#" = 'duke' |
have any prescriptions been given since 5 years ago to patient 25951? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_items (row_id number,itemid number... | SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25951) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-5 year') |
Who are the contenders In the New York 19 polling area race? | CREATE TABLE table_18602 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "Candidates" FROM table_18602 WHERE "District" = 'New York 19' |
On what date was the score 6 4? | CREATE TABLE table_name_1 (date VARCHAR,score VARCHAR) | SELECT date FROM table_name_1 WHERE score = "6–4" |
Show me a bar chart for what are the different transaction types, and how many transactions of each have taken place? | CREATE TABLE Financial_Transactions (transaction_id INTEGER,previous_transaction_id INTEGER,account_id INTEGER,card_id INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DOUBLE,transaction_comment VARCHAR(255),other_transaction_details VARCHAR(255))CREATE TABLE Accounts (account_id INTEGE... | SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type |
What is the result of round 4? | CREATE TABLE table_13752 ("Round" real,"Opposition Team" text,"Venue" text,"Result" text,"Report" text) | SELECT "Result" FROM table_13752 WHERE "Round" = '4' |
what is the cost for diagnosis of caesarian section? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'caesarian section') |
Can you list the classes that Dr. Ashley David has taught ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE program (program_id int,name varchar,college varc... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = cour... |
Who is the husband of the image of renata of lorraine? | CREATE TABLE table_6081 ("Image" text,"Father" text,"Birth" text,"Ceased to be Duchess" text,"Death" text,"Husband" text) | SELECT "Husband" FROM table_6081 WHERE "Image" = 'renata of lorraine' |
When Bob Dole had 26%, and George H.W. Bush had 47%, what did Pat Robertson have? | CREATE TABLE table_name_12 (pat_robertson VARCHAR,bob_dole VARCHAR,george_hw_bush VARCHAR) | SELECT pat_robertson FROM table_name_12 WHERE bob_dole = "26%" AND george_hw_bush = "47%" |
give the discharge location of subject id 6983. | 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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT demographic.discharge_location FROM demographic WHERE demographic.subject_id = "6983" |
What is the 2012 value with 1r in 2011, 2007 of A, 2010 of 1r, and 2009 of A? | CREATE TABLE table_name_16 (Id VARCHAR) | SELECT 2012 FROM table_name_16 WHERE 2011 = "1r" AND 2007 = "a" AND 2010 = "1r" AND 2009 = "a" |
which airline is the cheapest to fly from DALLAS to BALTIMORE on 12 24 | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE dual_carrier (main_airl... | SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, fare, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 24 ... |
What is the description of the type of the company who concluded its contracts most recently? | CREATE TABLE skills_required_to_fix (part_fault_id number,skill_id number)CREATE TABLE maintenance_contracts (maintenance_contract_id number,maintenance_contract_company_id number,contract_start_date time,contract_end_date time,other_contract_details text)CREATE TABLE parts (part_id number,part_name text,chargeable_yn ... | SELECT T1.company_name FROM third_party_companies AS T1 JOIN maintenance_contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1 |
Which bronze has a Nation of poland? | CREATE TABLE table_name_85 (bronze VARCHAR,nation VARCHAR) | SELECT bronze FROM table_name_85 WHERE nation = "poland" |
how many times was the population estimate 2005 have an area (km2) more than 8,023.74? | CREATE TABLE table_11225 ("Name" text,"Area (km 2)" real,"Population Estimate 2005" real,"Population Census 2010" real,"Capital" text) | SELECT COUNT("Population Estimate 2005") FROM table_11225 WHERE "Area (km 2 )" > '8,023.74' |
What L2 cache had a release date of august 26, 2007? | CREATE TABLE table_77683 ("Model number" text,"sSpec number" text,"Frequency" text,"L2 cache" text,"Mult." text,"Voltage" text,"Socket" text,"Release date" text,"Part number(s)" text,"Release price (USD)" text) | SELECT "L2 cache" FROM table_77683 WHERE "Release date" = 'august 26, 2007' |
is german above or below russia in the number of people who speak that language ? | CREATE TABLE table_203_88 (id number,"language" text,"number" number,"percentage (%)" number,"males" number,"females" number) | SELECT (SELECT "number" FROM table_203_88 WHERE "language" = 'german') > (SELECT "number" FROM table_203_88 WHERE "language" = 'russian') |
what are the three intakes that are the most frequent until 2101? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE diagnoses_icd (row_id number... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE STRFTIME('%y', inputevents_cv.charttime) <= '2101' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 3) |
What are the names of staff who have been assigned multiple jobs? | CREATE TABLE customer_orders (order_id number,customer_id number,order_status_code text,order_date time)CREATE TABLE product_suppliers (product_id number,supplier_id number,date_supplied_from time,date_supplied_to time,total_amount_purchased text,total_value_purchased number)CREATE TABLE departments (department_id numb... | SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT(*) > 1 |
Highest rated users who have never voted. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUser... | SELECT u.Id AS "user_link", u.DisplayName, u.Reputation FROM Users AS u WHERE u.UpVotes = 0 ORDER BY u.Reputation DESC LIMIT 100 |
Which game site Kickoff [a] of 1:00, and an Attendance of 63,251? | CREATE TABLE table_11107 ("Date" text,"Opponent" text,"Result" text,"Kickoff [a ]" text,"Game site" text,"Attendance" text) | SELECT "Game site" FROM table_11107 WHERE "Kickoff [a ]" = '1:00' AND "Attendance" = '63,251' |
Find date_address_from and the average of monthly_rental bin date_address_from by weekday, and visualize them by a bar chart. | CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR(10),detention_type_description VARCHAR(80))CREATE TABLE Assessment_Notes (notes_id INTEGER,student_id INTEGER,teacher_id INTEGER,date_of_notes DATETIME,text_of_notes VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Students_in_Detention (student_id INTEGE... | SELECT date_address_from, AVG(monthly_rental) FROM Student_Addresses ORDER BY monthly_rental DESC |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of job_id and commission_pct in a bar chart. | 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 countries (COUNTRY_ID varchar(2),COUN... | SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
How many foundeds have sousse as the city, with a capacity greater than 25,000? | CREATE TABLE table_12914 ("Club" text,"City" text,"Founded" real,"Stadium" text,"Capacity" real) | SELECT COUNT("Founded") FROM table_12914 WHERE "City" = 'sousse' AND "Capacity" > '25,000' |
Show different teams in eliminations and the number of eliminations from each team by a bar chart, and list from high to low by the Y-axis. | CREATE TABLE wrestler (Wrestler_ID int,Name text,Reign text,Days_held text,Location text,Event text)CREATE TABLE Elimination (Elimination_ID text,Wrestler_ID text,Team text,Eliminated_By text,Elimination_Move text,Time text) | SELECT Team, COUNT(*) FROM Elimination GROUP BY Team ORDER BY COUNT(*) DESC |
which diver is listed before ninel krutova ? | CREATE TABLE table_203_780 (id number,"rank" number,"diver" text,"preliminary\npoints" number,"preliminary\nrank" number,"final\npoints" number,"final\nrank" number,"final\ntotal" number) | SELECT "diver" FROM table_203_780 WHERE id = (SELECT id FROM table_203_780 WHERE "diver" = 'ninel krutova') - 1 |
what is subject name and admission type of subject id 2560? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT demographic.name, demographic.admission_type FROM demographic WHERE demographic.subject_id = "2560" |
When was commercial operation where construction started June 10, 1971? | CREATE TABLE table_name_27 (commercial_operation VARCHAR,construction_start VARCHAR) | SELECT commercial_operation FROM table_name_27 WHERE construction_start = "june 10, 1971" |
Find the name and population of districts with population between 200000 and 200000 Show a bar chart, I want to rank in asc by the y axis please. | CREATE TABLE store (Store_ID int,Store_Name text,Type text,Area_size real,Number_of_product_category real,Ranking int)CREATE TABLE store_product (Store_ID int,Product_ID int)CREATE TABLE store_district (Store_ID int,District_ID int)CREATE TABLE product (product_id int,product text,dimensions text,dpi real,pages_per_min... | SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000 ORDER BY City_Population |
who is the the candidates with incumbent being james o'connor | CREATE TABLE table_780 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "Candidates" FROM table_780 WHERE "Incumbent" = 'James O''Connor' |
Who is the kitmaker for Fc Augsburg? | CREATE TABLE table_48624 ("Team" text,"Head coach" text,"Team captain" text,"Kitmaker" text,"Shirt sponsor" text) | SELECT "Kitmaker" FROM table_48624 WHERE "Team" = 'fc augsburg' |
What is the sum on week against the Tampa Bay Buccaneers with less than 60,320 in attendance? | CREATE TABLE table_name_41 (week INTEGER,opponent VARCHAR,attendance VARCHAR) | SELECT SUM(week) FROM table_name_41 WHERE opponent = "tampa bay buccaneers" AND attendance < 60 OFFSET 320 |
What is the average goals against for teams with more than 56 goals for and exactly 50 points? | CREATE TABLE table_9513 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" text) | SELECT AVG("Goals Against") FROM table_9513 WHERE "Points 1" = '50' AND "Goals For" > '56' |
View statistics for your questions. Number of views per day for your questions, and their total views, sorted highest view rate to lowest | CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat... | SELECT ViewCount, ROUND(CAST(ViewCount AS FLOAT) / DATEDIFF(dd, CreationDate, GETDATE()), 1) AS ViewsPerDay, Id AS "post_link" FROM Posts WHERE PostTypeId = 1 AND OwnerUserId = '##UserId##' ORDER BY ViewCount DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.