instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Which Current Conference has a Nickname of lynx?
CREATE TABLE table_15613 ("Location" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" real,"Joined" real,"Left" real,"Current Conference" text)
SELECT "Current Conference" FROM table_15613 WHERE "Nickname" = 'lynx'
How many attempts did the player ranking with a number higher than 1, who started after 1997 and had yds/att of 5 have?
CREATE TABLE table_name_66 (attempts INTEGER,rank VARCHAR,start VARCHAR,yds_att VARCHAR)
SELECT SUM(attempts) FROM table_name_66 WHERE start > 1997 AND yds_att = 5 AND rank > 1
What was the Event in the city of copenhagen?
CREATE TABLE table_name_32 (event VARCHAR,city VARCHAR)
SELECT event FROM table_name_32 WHERE city = "copenhagen"
What player is picked 302 in round 11?
CREATE TABLE table_name_27 (player VARCHAR,round VARCHAR,pick VARCHAR)
SELECT player FROM table_name_27 WHERE round = 11 AND pick = 302
1 Downvote, >1 Upvote Questions per Tag.
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 PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteT...
SELECT * FROM Posts AS p WHERE p.CreationDate <= '2018-03-01' ORDER BY p.CreationDate DESC LIMIT 10
#Temporary tables, indexes and procedures work!. #Temporary views and functions return errors stating they're not allowed. Use Text-only results, and include the execution plan to see the index has been used.
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 CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,Use...
SELECT * FROM Tags
What college received Pick 5?
CREATE TABLE table_42744 ("Pick" real,"Player" text,"Country of origin*" text,"PBA team" text,"College" text)
SELECT "College" FROM table_42744 WHERE "Pick" = '5'
What is the name of the home captain when the result was Aus by 229 runs?
CREATE TABLE table_name_83 (home_captain VARCHAR,result VARCHAR)
SELECT home_captain FROM table_name_83 WHERE result = "aus by 229 runs"
calculate the average duration of hospital stay for patients who were admitted in or after 2178.
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 AVG(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2178"
what is the total sc 20 fe ng consumption amount that patient 3712 has received?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,...
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 = 3712)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.labe...
What is the score for the game that is less than 4 and a high points of williams (28)?
CREATE TABLE table_name_40 (score VARCHAR,game VARCHAR,high_points VARCHAR)
SELECT score FROM table_name_40 WHERE game < 4 AND high_points = "williams (28)"
What's the year that Hagerstown joined?
CREATE TABLE table_64105 ("School" text,"Location" text,"Mascot" text,"Size" real,"IHSAA Class" text,"# / County" text,"Year Joined" real,"Previous Conference" text)
SELECT "Year Joined" FROM table_64105 WHERE "School" = 'hagerstown'
Tell me the score of praterstadion, vienna, and competition of euro 1980 qualifier
CREATE TABLE table_name_54 (result VARCHAR,venue VARCHAR,competition VARCHAR)
SELECT result FROM table_name_54 WHERE venue = "praterstadion, vienna" AND competition = "euro 1980 qualifier"
what are the five most commonly prescribed drugs for patients who were also prescribed with famotidine (pf) at the same time in a year before?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyna...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'famotidine (pf)' AND DATETIME(medication.drugstartt...
For those records from the products and each product's manufacturer, show me about the distribution of founder and the average of code , and group by attribute founder in a bar chart, could you show in desc by the the average of code please?
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.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC
What is the rank for the city of sewri?
CREATE TABLE table_name_46 (rank VARCHAR,city VARCHAR)
SELECT COUNT(rank) FROM table_name_46 WHERE city = "sewri"
What is the Original title for an Episode Actor role which was Directed by G za Berem nyi?
CREATE TABLE table_name_59 (original_title VARCHAR,role VARCHAR,directed_by VARCHAR)
SELECT original_title FROM table_name_59 WHERE role = "episode actor" AND directed_by = "géza bereményi"
what was the name of procedure, that patient 025-50079 was first received until 4 years ago?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE medication (medicationid number,patientunitstayid number,drugn...
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50079')) AND DATETIME(treatment.treatmenttime) <= DATETIME(CU...
How many lanes have a rank greater than 8?
CREATE TABLE table_name_25 (lane INTEGER,rank INTEGER)
SELECT SUM(lane) FROM table_name_25 WHERE rank > 8
What is the total number of Years when the LLWS is 4th place, and when the City is Westport?
CREATE TABLE table_name_19 (year VARCHAR,llws VARCHAR,city VARCHAR)
SELECT COUNT(year) FROM table_name_19 WHERE llws = "4th place" AND city = "westport"
What role did Pick # 10 have?
CREATE TABLE table_name_22 (role VARCHAR,pick__number VARCHAR)
SELECT role FROM table_name_22 WHERE pick__number = 10
Championship larger than 3, and a FA Cup smaller than 3, and a Total smaller than 6 involves what highest league cup?
CREATE TABLE table_36286 ("Name" text,"Championship" real,"FA Cup" real,"League Cup" real,"Total" real)
SELECT MAX("League Cup") FROM table_36286 WHERE "Championship" > '3' AND "FA Cup" < '3' AND "Total" < '6'
how many years did not qualify ?
CREATE TABLE table_203_462 (id number,"year" number,"division" number,"league" text,"regular season" text,"playoffs" text,"open cup" text)
SELECT COUNT("year") FROM table_203_462 WHERE "playoffs" = 'did not qualify'
In what seasons did Kate Woods direct Without A Trace?
CREATE TABLE table_20919 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (millions)" text)
SELECT "Season #" FROM table_20919 WHERE "Directed by" = 'Kate Woods'
Which week's game was attended by 65,272 people?
CREATE TABLE table_name_18 (week VARCHAR,attendance VARCHAR)
SELECT week FROM table_name_18 WHERE attendance = "65,272"
Who was the opponent with the loss in Westbury, NY?
CREATE TABLE table_62730 ("Result" text,"Opponent" text,"Type" text,"Rd.,Time" text,"Date" text,"Location" text)
SELECT "Opponent" FROM table_62730 WHERE "Result" = 'loss' AND "Location" = 'westbury, ny'
How many clubs have a try bonus value of 5?
CREATE TABLE table_917 ("Club" text,"Played" text,"Won" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text)
SELECT COUNT("Club") FROM table_917 WHERE "Try bonus" = '5'
How many years have a Title of kriegspiel?
CREATE TABLE table_name_16 (year VARCHAR,title VARCHAR)
SELECT COUNT(year) FROM table_name_16 WHERE title = "kriegspiel"
What is the average age of female (sex is F) students?
CREATE TABLE STUDENT (Age INTEGER,Sex VARCHAR)
SELECT AVG(Age) FROM STUDENT WHERE Sex = "F"
what camp is at the top ?
CREATE TABLE table_204_217 (id number,"camp" text,"div sec\ndivision" text,"admin\ndistrict" text,"9 feb" number,"11 feb" number,"16 feb" number,"25 feb" number,"27 feb" number,"2 mar" number,"4 mar" number,"6 mar" number,"11 mar" number,"13 mar" number,"24 mar" number,"30 mar" number,"31 mar" number)
SELECT "camp" FROM table_204_217 WHERE id = 1
City vs Tag by Rep.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskType...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE LOWER(Location) LIKE LOWER('%##cityname##%') AND t.TagName ...
what are the five most frequent drugs prescribed within the same month to the hypertension female patients of age 30s after having been diagnosed with hypertension until 2102?
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 t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypertension' AND STRFTIME('%y', diagnosis.diagnos...
For all employees who have the letters D or S in their first name, give me the comparison about the average of employee_id over the job_id , and group by attribute job_id by a bar chart, and show in desc by the y axis.
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 departments (DEPARTMENT_ID decimal(4,0),DEPART...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC
How many bronze medals did the nation have that had less than 3 silver, 5 gold and ranked better than 31?
CREATE TABLE table_name_97 (bronze INTEGER,gold VARCHAR,silver VARCHAR,rank VARCHAR)
SELECT SUM(bronze) FROM table_name_97 WHERE silver < 3 AND rank < 31 AND gold = 5
show me the UA flights from DENVER to BALTIMORE leaving on 6 14
CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE code_description (code varchar,descr...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 14 AND date_day.month_number = 6 AN...
What was Arnold Palmer's score in the tournamnet?
CREATE TABLE table_name_5 (score VARCHAR,player VARCHAR)
SELECT score FROM table_name_5 WHERE player = "arnold palmer"
A bar chart for returning the number of the countries of the mountains that have a height larger than 5000, and I want to list y-axis in asc order.
CREATE TABLE mountain (Mountain_ID int,Name text,Height real,Prominence real,Range text,Country text)CREATE TABLE climber (Climber_ID int,Name text,Country text,Time text,Points real,Mountain_ID int)
SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY COUNT(Country)
Who is the player from round 8?
CREATE TABLE table_name_20 (player VARCHAR,round VARCHAR)
SELECT player FROM table_name_20 WHERE round = 8
What home team scored 14.14 (98)?
CREATE TABLE table_32475 ("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_32475 WHERE "Home team score" = '14.14 (98)'
Which of My Answers Have Been Accepted?. Returns all the accepted answers for a given User ID on Stack Overflow.
CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PostHistor...
SELECT a.Id AS "post_link" FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = '##UserId##' ORDER BY a.CreationDate DESC
What is the average number of wins for teams with 14 losses and against over 2200?
CREATE TABLE table_14283 ("Wimmera FL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT AVG("Wins") FROM table_14283 WHERE "Losses" = '14' AND "Against" > '2200'
how many patients whose diagnoses long title is interstitial emphysema and related conditions and lab test abnormal status is abnormal?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Interstitial emphysema and related conditions" AND lab.flag = "abnormal"
Percentage of changed/retracted/deleted votes per month. It detected all the deleted votes. Changed votes can be seen only if they were changed on a different day.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time...
WITH Raw AS (SELECT Id, CreationDate, LAG(Id) OVER (ORDER BY Id) AS PrevId, LAG(CreationDate) OVER (ORDER BY Id) AS PrevCreationDate FROM Votes), Raw2 AS (SELECT *, CASE WHEN CreationDate > PrevCreationDate THEN PrevCreationDate ELSE CreationDate END AS EstCreationDate FROM Raw) SELECT DATEFROMPARTS(TIME_TO_STR(EstCrea...
list all flights arriving at MKE
CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE compartment_class (compartment v...
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'MKE' AND city.city_code = airport_service.city_code AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code
what is the average for January with points of 51
CREATE TABLE table_74858 ("Game" real,"January" real,"Opponent" text,"Score" text,"Record" text,"Points" real)
SELECT "January" FROM table_74858 WHERE "Points" = '51'
What is the number of patients younger than 31 with a diagnoses icd9 code 70721?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.icd9_code = "70721"
What is the name of constituency 5?
CREATE TABLE table_name_50 (name VARCHAR,constituency_number VARCHAR)
SELECT name FROM table_name_50 WHERE constituency_number = "5"
Who was the home team when the vistor team was the Montreal Canadiens on February 12?
CREATE TABLE table_name_60 (home VARCHAR,visitor VARCHAR,date VARCHAR)
SELECT home FROM table_name_60 WHERE visitor = "montreal canadiens" AND date = "february 12"
What is the names of movies whose created year is after all movies directed by Steven Spielberg?
CREATE TABLE Movie (title VARCHAR,YEAR INTEGER,director VARCHAR)
SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = "Steven Spielberg")
What is the Traditional when the Pinyin is h d ng q ?
CREATE TABLE table_name_27 (traditional VARCHAR,pinyin VARCHAR)
SELECT traditional FROM table_name_27 WHERE pinyin = "hédōng qū"
What is the score of the game on January 10?
CREATE TABLE table_name_82 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_82 WHERE date = "january 10"
what was the make of both jeff gordon 's and jimmie johnson 's race car ?
CREATE TABLE table_203_529 (id number,"fin" number,"st" number,"driver" text,"car #" number,"make" text,"points" number,"bonus" number,"laps" number,"winnings" text)
SELECT "make" FROM table_203_529 WHERE "driver" = 'jeff gordon'
How many international passengers have less than 88,592 aircraft movements with 319,093 transit passengers with less than 4 rank?
CREATE TABLE table_6267 ("Rank" real,"Airport" text,"Total Passengers" real,"% Change 2005/2006" text,"International Passengers" real,"Domestic Passengers" real,"Transit Passengers" real,"Aircraft Movements" real,"Freight (Metric Tonnes)" real)
SELECT COUNT("International Passengers") FROM table_6267 WHERE "Aircraft Movements" < '88,592' AND "Transit Passengers" = '319,093' AND "Rank" < '4'
What is Zimbabwe's rank?
CREATE TABLE table_name_33 (rank VARCHAR,nationality VARCHAR)
SELECT rank FROM table_name_33 WHERE nationality = "zimbabwe"
What 's the easiest ULCS class ?
CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE requirement (requirement_id int,requirement var...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co...
What was the class when there were 325 laps?
CREATE TABLE table_71640 ("Year" real,"Team" text,"Co-Drivers" text,"Class" text,"Laps" real,"Pos." text,"Class Pos." text)
SELECT "Class" FROM table_71640 WHERE "Laps" = '325'
What is the lowest league cup goals for the entry with fa cup goals greater than 0 and FA cup apps larger than 2?
CREATE TABLE table_63770 ("Name" text,"Position" text,"League Apps" text,"League Goals" real,"FA Cup Apps" real,"FA Cup Goals" real,"League Cup Apps" real,"League Cup Goals" real,"Total Apps" text,"Total Goals" real)
SELECT MIN("League Cup Goals") FROM table_63770 WHERE "FA Cup Goals" > '0' AND "FA Cup Apps" > '2'
How much power was used when the callsign was DZYT?
CREATE TABLE table_12547903_3 (power__kw_ VARCHAR,callsign VARCHAR)
SELECT power__kw_ FROM table_12547903_3 WHERE callsign = "DZYT"
What driver was the winner when constructor was Maserati at the Monaco grand prix?
CREATE TABLE table_name_36 (winning_driver VARCHAR,constructor VARCHAR,race VARCHAR)
SELECT winning_driver FROM table_name_36 WHERE constructor = "maserati" AND race = "monaco grand prix"
What is the least number of seasons in top division?
CREATE TABLE table_11250_4 (number_of_seasons_in_top_division INTEGER)
SELECT MIN(number_of_seasons_in_top_division) FROM table_11250_4
What is the HDTV when the content is general television?
CREATE TABLE table_7129 ("Television service" text,"Country" text,"Language" text,"Content" text,"HDTV" text,"Package/Option" text)
SELECT "HDTV" FROM table_7129 WHERE "Content" = 'general television'
What kind of chassis did a winning car with a Foyt engine have in 1979?
CREATE TABLE table_1405704_1 (chassis VARCHAR,season VARCHAR,engine VARCHAR)
SELECT chassis FROM table_1405704_1 WHERE season = 1979 AND engine = "Foyt"
Which Authority has a Gender of coed, a Decile smaller than 6, and an Area of merivale?
CREATE TABLE table_name_21 (authority VARCHAR,area VARCHAR,gender VARCHAR,decile VARCHAR)
SELECT authority FROM table_name_21 WHERE gender = "coed" AND decile < 6 AND area = "merivale"
bmi >= 30 kg / m2 or bmi >= 27 kg / m2 with one or more obesity _ associated co _ morbid conditions ( e.g. hypertension, and dyslipidemia )
CREATE TABLE table_dev_26 ("id" int,"gender" string,"hemoglobin_a1c_hba1c" float,"dyslipidemia" bool,"body_weight" float,"hba1c" float,"body_mass_index_bmi" float,"hypertension" bool,"NOUSE" float)
SELECT * FROM table_dev_26 WHERE body_mass_index_bmi >= 30 OR (body_mass_index_bmi >= 27 AND (hypertension = 1 OR dyslipidemia = 1))
On what Date was Palhinha Brazil Scorers?
CREATE TABLE table_5370 ("Date" text,"Result" text,"Score" text,"Brazil scorers" text,"Competition" text)
SELECT "Date" FROM table_5370 WHERE "Brazil scorers" = 'palhinha'
what is the cost of a round trip ticket FIRST class between OAK and ATL
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE flight (aircraft_code_sequence t...
SELECT DISTINCT fare.fare_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, fare, fare_basis, flight, flight_fare WHERE (AIRPORT_0.airport_code = 'OAK' AND AIRPORT_1.airport_code = 'ATL' AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AN...
What is the name of the person with a total of 22?
CREATE TABLE table_65935 ("Rank" real,"Name" text,"1st run" text,"2nd run" text,"3rd run" text,"Total" real)
SELECT "Name" FROM table_65935 WHERE "Total" = '22'
What is the place when the player is Bob Gilder and the money was $20,903?
CREATE TABLE table_46401 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" text)
SELECT "Place" FROM table_46401 WHERE "Money ( $ )" = '20,903' AND "Player" = 'bob gilder'
Users with more than one Suffrage badge.
CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescript...
SELECT UserId AS "user_link", 'suffrage' FROM (SELECT UserId, 'suffrage' FROM (SELECT Id, UserId, Name FROM Badges WHERE TagBased = 0) AS data PIVOT(COUNT(data.Id) FOR Name IN ('suffrage')) AS pvt WHERE 'suffrage' > 1) AS main INNER JOIN Users AS u ON u.Id = main.UserId ORDER BY DisplayName
What are the id and name of the mountains that have at least 2 photos Show bar chart, sort Y in descending order.
CREATE TABLE mountain (id int,name text,Height real,Prominence real,Range text,Country text)CREATE TABLE photos (id int,camera_lens_id int,mountain_id int,color text,name text)CREATE TABLE camera_lens (id int,brand text,name text,focal_length_mm real,max_aperture real)
SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id ORDER BY T1.id DESC
what is minimum age of patients whose marital status is married and age is greater than or equal to 36?
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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "36"
For all games with calgary as home, what is the average number of attendees?
CREATE TABLE table_name_1 (attendance INTEGER,home VARCHAR)
SELECT AVG(attendance) FROM table_name_1 WHERE home = "calgary"
Find Posts edited after a Leave Closed result of a Reopen Votes review queue.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description 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 T...
SELECT P.Id AS P_Id, P.LastEditDate AS P_LastEditDate, RT.Id AS RT_Id, RTT.Name AS RTT_Name, RT.CreationDate AS RT_CreationDate, RTS.Name AS RTS_Name, RTR.Id AS RTR_Id, RTRT.Name AS RTTR_Name, RTR.CreationDate AS RTR_CreationDate FROM ReviewTasks AS RT INNER JOIN ReviewTaskTypes AS RTT ON RT.ReviewTaskTypeId = RTT.Id I...
What is Content, when Package/Option is sky cinema, and when Language is italian originale?
CREATE TABLE table_name_6 (content VARCHAR,package_option VARCHAR,language VARCHAR)
SELECT content FROM table_name_6 WHERE package_option = "sky cinema" AND language = "italian originale"
For those employees who did not have any job in the past, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id, display x axis in desc order.
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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC
TOP F# users in California.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate t...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", u.age, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON...
What is the total number of silver medals of the team ranked 7 with more than 1 total medal?
CREATE TABLE table_name_59 (silver VARCHAR,rank VARCHAR,total VARCHAR)
SELECT COUNT(silver) FROM table_name_59 WHERE rank = "7" AND total > 1
For those records from the products and each product's manufacturer, a scatter chart shows the correlation between price and manufacturer , and group by attribute founder.
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 Price, Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
Who was the visiting team on April 6?
CREATE TABLE table_48404 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Visitor" FROM table_48404 WHERE "Date" = 'april 6'
What position did Joe Maddock play?
CREATE TABLE table_14342367_11 (position VARCHAR,player VARCHAR)
SELECT position FROM table_14342367_11 WHERE player = "Joe Maddock"
what is the five year survival rate of patients with congestive heart failure - combined systolic and diastolic diagnosed?
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 SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
What was the score on March 3, 2008?
CREATE TABLE table_name_57 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_57 WHERE date = "march 3, 2008"
List the name and the number of enrolled student for each course in a bar chart.
CREATE TABLE Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCHAR(255))CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name ...
SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name
what were the five most frequent drugs prescribed within the same month to the patients aged 60 or above after they had been diagnosed with hepatic dysfunction - chronic,?
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 t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hepatic dysfunction - chronic') AS t1 JOIN (SELECT...
what is the maximum total cost of a hospital involving a laboratory test for hyaline casts until 2101?
CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid nu...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hyaline casts')) AND STRFTIME('%y', cost.chargetime) <= '2101' GROUP BY cost.hadm_id) AS t1
What are the names of regions with two or more storms?
CREATE TABLE affected_region (region_id number,storm_id number,number_city_affected number)CREATE TABLE region (region_id number,region_code text,region_name text)CREATE TABLE storm (storm_id number,name text,dates_active text,max_speed number,damage_millions_usd number,number_deaths number)
SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2
What is the tournament that had a result of A in 1954 and NH in 1942?
CREATE TABLE table_name_30 (tournament VARCHAR)
SELECT tournament FROM table_name_30 WHERE 1954 = "a" AND 1942 = "nh"
What positions do the hartford whalers nhl team have?
CREATE TABLE table_15965 ("Pick" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text)
SELECT "Position" FROM table_15965 WHERE "NHL team" = 'Hartford Whalers'
What Date has a Circuit of cremona?
CREATE TABLE table_name_36 (date VARCHAR,circuit VARCHAR)
SELECT date FROM table_name_36 WHERE circuit = "cremona"
what were the five drugs that were ordered the most frequently in this year?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,s...
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 5
how many patients died in or before year 2174 with the drug code ibup600?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2174.0" AND prescriptions.formulary_drug_cd = "IBUP600"
From which location was the patient Thomas Nazario admitted to the hospital?
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.admission_location FROM demographic WHERE demographic.name = "Thomas Nazario"
the difference between the 1 rank defenses and days
CREATE TABLE table_203_678 (id number,"rank" number,"wrestler" text,"no. of reigns" number,"combined\ndefenses" number,"combined\ndays" number)
SELECT ABS("combined\ndefenses" - "combined\ndays") FROM table_203_678 WHERE "rank" = 1
Name the departure for spalding
CREATE TABLE table_17200372_2 (departure VARCHAR,going_to VARCHAR)
SELECT departure FROM table_17200372_2 WHERE going_to = "Spalding"
What's the score of Jeff Maggert in T2 place?
CREATE TABLE table_44996 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Score" FROM table_44996 WHERE "Place" = 't2' AND "Player" = 'jeff maggert'
count the number of patients whose diagnoses short title is anorexia and drug route is neb?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anorexia" AND prescriptions.route = "NEB"
Top 500 answerers on the site for CUDA. A list of the top 500 users with the highest average answer score excluding community wiki / closed posts or users with less than 10 answers
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 Users.Id AS "user_link", COUNT(a.Id) AS Answers, CAST(AVG(CAST(a.Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_answer_score" FROM (SELECT b.* FROM Posts AS b INNER JOIN PostTags AS pt ON pt.PostId = b.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE TagName IN ('cuda') AND b.PostTypeId = 0 AND CommunityOwnedDate ...
who won previous to graham hill ?
CREATE TABLE table_203_367 (id number,"year" text,"driver" text,"constructor" text,"location" text,"report" text)
SELECT "driver" FROM table_203_367 WHERE id = (SELECT id FROM table_203_367 WHERE "driver" = 'graham hill') - 1
What are the wins for the 7th position?
CREATE TABLE table_29701 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Position" text)
SELECT "Wins" FROM table_29701 WHERE "Position" = '7th'
Top users by City (Juiz de Fora).
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body te...
SELECT Id, Reputation, DisplayName, Location FROM Users WHERE UPPER(Location) LIKE '%BARDUFOSS, NORGE%' ORDER BY Reputation DESC