instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the number of patients whose diagnoses long title is osteoarthrosis, unspecified whether generalized or localized, site unspecified and lab test abnormal status is abnormal?
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.long_title = "Osteoarthrosis, unspecified whether generalized or localized, site unspecified" AND lab.flag = "abnormal"
Tell me the highest laps for toyota and grid of 13
CREATE TABLE table_58522 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MAX("Laps") FROM table_58522 WHERE "Constructor" = 'toyota' AND "Grid" = '13'
give me the number of patients whose lab test name is free calcium?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Free Calcium"
What campus started in year 1956, has more than 200 full time students, and more than 400 students enrolled?
CREATE TABLE degrees (year number,campus number,degrees number)CREATE TABLE faculty (campus number,year number,faculty number)CREATE TABLE campuses (id number,campus text,location text,county text,year number)CREATE TABLE csu_fees (campus number,year number,campusfee number)CREATE TABLE discipline_enrollments (campus n...
SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND fte_ay > 200
Who has the most copies of one badge?. Determines the ranking of who has the most of one badge, for example Nice Question.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostFeedback (Id number,PostId num...
SELECT UserId AS "user_link", COUNT(*) AS Count FROM Badges WHERE Name = @Badge GROUP BY UserId ORDER BY Count DESC
What year was the earliest first elected?
CREATE TABLE table_18310 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT MIN("First elected") FROM table_18310
How many of the patients born before the year 2137 were treated with midazbase?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2137" AND prescriptions.formulary_drug_cd = "MIDAZBASE"
What are the total points that had 68 match points, 9 bonus points and 30 games?
CREATE TABLE table_name_29 (total_points VARCHAR,match_points VARCHAR,games VARCHAR,bonus_points VARCHAR)
SELECT total_points FROM table_name_29 WHERE games = "30" AND bonus_points = "9" AND match_points = "68"
When was the first HC climb before 2013 with more than 3 times visited, more than 4 HC climbs, and a height of 1669?
CREATE TABLE table_53085 ("Height (m.)" text,"No. of times visited" real,"No. of HC climbs" real,"First time as HC climb" real,"Most recent" real)
SELECT "First time as HC climb" FROM table_53085 WHERE "No. of times visited" > '3' AND "No. of HC climbs" = '4' AND "Most recent" < '2013' AND "Height (m.)" = '1669'
What is the oldest year listed with the 1500 Louisiana Street name?
CREATE TABLE table_57998 ("Rank" text,"Name" text,"Height ft / m" text,"Floors" real,"Year" real)
SELECT MIN("Year") FROM table_57998 WHERE "Name" = '1500 louisiana street'
What is the status of the desktop version of the OS with kernel version 2.6.31?
CREATE TABLE table_22918 ("Version" text,"Code name" text,"Release date" text,"Desktops" text,"Servers" text,"Kernel Version" text)
SELECT "Desktops" FROM table_22918 WHERE "Kernel Version" = '2.6.31'
Who is the incumbent that is listed with the candidates listed as marilyn lloyd (d) 57.4% harold w. coker (r) 42.6%?
CREATE TABLE table_1341577_43 (incumbent VARCHAR,candidates VARCHAR)
SELECT incumbent FROM table_1341577_43 WHERE candidates = "Marilyn Lloyd (D) 57.4% Harold W. Coker (R) 42.6%"
WHAT GAME HAD A SCORE OF 99-112?
CREATE TABLE table_76825 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text)
SELECT "Game" FROM table_76825 WHERE "Result" = '99-112'
when was the first time patient 006-2586 had the maximum heartrate the previous day.
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid nu...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586')) AND NOT vitalperiodic.heartrate IS NULL...
What was the score of the game on June 10?
CREATE TABLE table_name_10 (score_time VARCHAR,date VARCHAR)
SELECT score_time FROM table_name_10 WHERE date = "june 10"
patients with one or more of the following indications for chronic warfarin anticoagulation ( the patient may either be a new candidate for anticoagulation or may already be receiving warfarin ) : atrial fibrillation ( paroxysmal, persistent or permanent, not due to a reversible cause, documented by ecg ) or atrial flu...
CREATE TABLE table_test_30 ("id" int,"ejection_fraction_ef" int,"multiple_long_bone_fractures" bool,"extracellular_volume_expansion" bool,"pregnancy_or_lactation" bool,"bleeding" int,"serum_potassium" float,"prosthetic_heart_valve" bool,"hbg" int,"anticoagulation" bool,"incomplete_spinal_cord_injury" bool,"complex_pelv...
SELECT * FROM table_test_30 WHERE (chronic_warfarin_therapy = 1 OR (anticoagulation = 1 OR chronic_warfarin_therapy = 1)) OR atrial_fibrillation = 1 OR atrial_flutter = 1 OR (prosthetic_heart_valve = 1 AND (aortic = 1 OR mitral = 1) AND chronic_anticoagulation = 1) OR (venous_thromboembolic_disease = 1 OR (dvt = 1 OR p...
Users who Downvote but don't post.
CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId ...
SELECT Users.DisplayName, COUNT(Posts.Id) AS Posts, Users.DownVotes, Users.DownVotes / CAST(s.Total AS FLOAT) AS "% of All Downvotes", Users.DownVotes / CAST(COUNT(Posts.Id) AS FLOAT) AS "Downvotes/Posts", Users.DownVotes / CAST(Users.UpVotes AS FLOAT) AS "Downvotes/upvotes" FROM Users JOIN Posts ON Users.Id = Posts.Ow...
When there are more than 126 errors, more than 551 kills, and more than 40 assists for the 2007 season, what is the total of Solo Blocks?
CREATE TABLE table_name_24 (solo_blocks INTEGER,assists VARCHAR,season VARCHAR,errors VARCHAR,kills VARCHAR)
SELECT SUM(solo_blocks) FROM table_name_24 WHERE errors > 126 AND kills > 551 AND season = "2007" AND assists > 40
Which college had Tony Leiker in round 7?
CREATE TABLE table_75181 ("Pick #" real,"Round" text,"Player" text,"Position" text,"College" text)
SELECT "College" FROM table_75181 WHERE "Round" = 'round 7' AND "Player" = 'tony leiker'
Which students study under the teacher named OTHA MOYER? Give me the first and last names of the students.
CREATE TABLE list (lastname text,firstname text,grade number,classroom number)CREATE TABLE teachers (lastname text,firstname text,classroom number)
SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER"
Show the first name and last name for all the instructors.
CREATE TABLE Faculty (fname VARCHAR,lname VARCHAR,Rank VARCHAR)
SELECT fname, lname FROM Faculty WHERE Rank = "Instructor"
how many more more bronze medals did russia earn than china ?
CREATE TABLE table_203_739 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT (SELECT "bronze" FROM table_203_739 WHERE "nation" = 'russia') - (SELECT "bronze" FROM table_203_739 WHERE "nation" = 'china')
on their last hospital visit, when was the last time patient 80120 had the maximum po2?
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 cost (row_id number,subject_id number,hadm_id number,event_type text,event_id numbe...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 80120 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = ...
Name the ply (uk, nz, au) for fingering
CREATE TABLE table_20297668_1 (ply__uk VARCHAR,_nz VARCHAR,_au_ VARCHAR,yarn_type__us_ VARCHAR)
SELECT ply__uk, _nz, _au_ FROM table_20297668_1 WHERE yarn_type__us_ = "Fingering"
Name the sum of total with gold more than 1 and bronze more than 0
CREATE TABLE table_name_10 (total INTEGER,gold VARCHAR,bronze VARCHAR)
SELECT SUM(total) FROM table_name_10 WHERE gold > 1 AND bronze > 0
Who is the away side at windy hill?
CREATE TABLE table_33616 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_33616 WHERE "Venue" = 'windy hill'
What song was chosen for the episode with the top 8?
CREATE TABLE table_name_72 (song_choice VARCHAR,episode VARCHAR)
SELECT song_choice FROM table_name_72 WHERE episode = "top 8"
Who was the partner when the championship was us open on a hard surface?
CREATE TABLE table_39355 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text)
SELECT "Partner" FROM table_39355 WHERE "Surface" = 'hard' AND "Championship" = 'us open'
How many players' hometown was Akron, Ohio?
CREATE TABLE table_310 ("Player" text,"Position" text,"School" text,"Hometown" text,"College" text)
SELECT COUNT("School") FROM table_310 WHERE "Hometown" = 'Akron, Ohio'
What is the bronze when silver is 4 and gold is 1 and the total is more than 2
CREATE TABLE table_name_50 (bronze VARCHAR,silver VARCHAR,total VARCHAR,gold VARCHAR)
SELECT bronze FROM table_name_50 WHERE total > 2 AND gold = "1" AND silver = "4"
Show different types of ships and the average tonnage of ships of each type in a bar chart.
CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text)
SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type
what week number was at memorial stadium?
CREATE TABLE table_name_53 (week INTEGER,game_site VARCHAR)
SELECT AVG(week) FROM table_name_53 WHERE game_site = "memorial stadium"
What is the name and country for the artist with most number of exhibitions?
CREATE TABLE artist (name VARCHAR,country VARCHAR,artist_id VARCHAR)CREATE TABLE exhibition (artist_id VARCHAR)
SELECT T2.name, T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY COUNT(*) DESC LIMIT 1
What is Per Capita Income, when Population is greater than 9,563, and when Median Family Income is '$49,310'?
CREATE TABLE table_60725 ("County" text,"Per capita income" text,"Median household income" text,"Median family income" text,"Population" real,"Number of households" real)
SELECT "Per capita income" FROM table_60725 WHERE "Population" > '9,563' AND "Median family income" = '$49,310'
In what series did Bobby Labonte drive?
CREATE TABLE table_73744 ("Position" real,"Driver" text,"Points" real,"Winnings" text,"Series" text)
SELECT "Series" FROM table_73744 WHERE "Driver" = 'Bobby Labonte'
When did Masthead Studios release their game?
CREATE TABLE table_name_98 (release_date VARCHAR,developer_s_ VARCHAR)
SELECT release_date FROM table_name_98 WHERE developer_s_ = "masthead studios"
List the tournament that kent state won?
CREATE TABLE table_24348134_3 (conference VARCHAR,tournament_winner VARCHAR)
SELECT conference AS Tournament FROM table_24348134_3 WHERE tournament_winner = "Kent State"
Show the average share count of transactions each each investor, ordered by average share count.
CREATE TABLE transactions (transaction_id number,investor_id number,transaction_type_code text,date_of_transaction time,amount_of_transaction number,share_count text,other_details text)CREATE TABLE purchases (purchase_transaction_id number,purchase_details text)CREATE TABLE lots (lot_id number,investor_id number,lot_de...
SELECT investor_id, AVG(share_count) FROM transactions GROUP BY investor_id ORDER BY AVG(share_count)
What is the Armenian name of the district that is 8.37 km large?
CREATE TABLE table_27366772_3 (armenian VARCHAR,area__km²_ VARCHAR)
SELECT armenian FROM table_27366772_3 WHERE area__km²_ = "8.37"
Who directed the episode with a production code greater than 4301103.585233785 that was written by Curtis Kheel?
CREATE TABLE table_24263 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. viewers (millions)" text)
SELECT "Directed by" FROM table_24263 WHERE "Production code" > '4301103.585233785' AND "Written by" = 'Curtis Kheel'
how many programs are there?
CREATE TABLE program (Id VARCHAR)
SELECT COUNT(*) FROM program
give me the number of private insurance patients who have procedure icd9 code 8960.
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.insurance = "Private" AND procedures.icd9_code = "8960"
What is the location of #1?
CREATE TABLE table_19943 ("#" real,"Season" real,"Bowl game" text,"Result" text,"Opponent" text,"Stadium" text,"Location" text,"Attendance" text)
SELECT "Location" FROM table_19943 WHERE "#" = '1'
Average upvotes vs downvotes per post per month over time.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTas...
SELECT DATE(CONCAT(y, '-', m, '-', '01')), (upvotes - downvotes) / numposts FROM (SELECT YEAR(CreationDate) AS py, MONTH(CreationDate) AS pm, COUNT(*) AS numposts FROM Posts GROUP BY YEAR(CreationDate), MONTH(CreationDate)) AS p JOIN (SELECT y, m, SUM(upvote) AS upvotes, SUM(downvote) AS downvotes FROM (SELECT YEAR(Cre...
Are any 100 -level classes being offered in the Spring or Summer term ?
CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id in...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = cou...
Which highest 'goals against' number had wins of 19 and a 'goals for' number that was bigger than 53?
CREATE TABLE table_name_79 (goals_against INTEGER,wins VARCHAR,goals_for VARCHAR)
SELECT MAX(goals_against) FROM table_name_79 WHERE wins = 19 AND goals_for > 53
Which interview score belongs to the state of Nevada contestant?
CREATE TABLE table_17636 ("State" text,"Preliminaries" text,"Interview" text,"Swimsuit" text,"Evening Gown" text,"Average" text)
SELECT "Interview" FROM table_17636 WHERE "State" = 'Nevada'
what is the last code listed ?
CREATE TABLE table_204_579 (id number,"code" text,"district" text,"headquarters" text,"population (as of 2011)" number,"area (km2)" number,"density (/km2)" number)
SELECT "code" FROM table_204_579 ORDER BY id DESC LIMIT 1
What shirt No has a Birth Date of April 12, 1986 (age27)?
CREATE TABLE table_65515 ("Shirt No" real,"Nationality" text,"Player" text,"Birth Date" text,"Height" real,"Position" text)
SELECT MIN("Shirt No") FROM table_65515 WHERE "Birth Date" = 'april 12, 1986 (age27)'
What race did Simon Pagenaud have the most laps in?
CREATE TABLE table_27913160_3 (race VARCHAR,most_laps_led VARCHAR)
SELECT race FROM table_27913160_3 WHERE most_laps_led = "Simon Pagenaud"
What Aspect has a Programming of Saigon Network Television?
CREATE TABLE table_51053 ("Channel" real,"Video" text,"Aspect" text,"PSIP Short Name" text,"Programming" text)
SELECT "Aspect" FROM table_51053 WHERE "Programming" = 'saigon network television'
What platform sold 11.18 million units?
CREATE TABLE table_22437 ("Rank" real,"Title" text,"Release Date" text,"Franchise" text,"Developer(s)" text,"Platform" text,"Units sold (in Millions)" text)
SELECT "Platform" FROM table_22437 WHERE "Units sold (in Millions)" = '11.18'
What is the highest rank Mount Elbert has?
CREATE TABLE table_name_12 (rank INTEGER,mountain_peak VARCHAR)
SELECT MAX(rank) FROM table_name_12 WHERE mountain_peak = "mount elbert"
What is the College of Rice's highest overall for the guard position?
CREATE TABLE table_name_62 (overall INTEGER,position VARCHAR,college VARCHAR)
SELECT MAX(overall) FROM table_name_62 WHERE position = "guard" AND college = "rice"
How many students are in each department Plot them as bar chart, and order by the x axis from low to high.
CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))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 advisor (s_ID varchar(5...
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY dept_name
Most popular StackOverflow tags July2016.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Posts...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN...
When was the sargent bridge built?
CREATE TABLE table_49330 ("Name" text,"Built" text,"Listed" text,"Location" text,"County" text)
SELECT "Built" FROM table_49330 WHERE "Name" = 'sargent bridge'
Who was the opponent on September 17?
CREATE TABLE table_name_41 (opponent VARCHAR,date VARCHAR)
SELECT opponent FROM table_name_41 WHERE date = "september 17"
display the country ID and number of cities for each country.
CREATE TABLE locations (location_id number,street_address text,postal_code text,city text,state_province text,country_id text)CREATE TABLE countries (country_id text,country_name text,region_id number)CREATE TABLE departments (department_id number,department_name text,manager_id number,location_id number)CREATE TABLE r...
SELECT country_id, COUNT(*) FROM locations GROUP BY country_id
What country is Lee Trevino from?
CREATE TABLE table_12734 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Country" FROM table_12734 WHERE "Player" = 'lee trevino'
For those records from the products and each product's manufacturer, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart, and order y axis in asc order 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 T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T2.Revenue
How many weeks had a Result of w 20 6?
CREATE TABLE table_51168 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT SUM("Week") FROM table_51168 WHERE "Result" = 'w 20–6'
What number pick was the player with the hometown school of concordia college?
CREATE TABLE table_46000 ("Pick" real,"Player" text,"Team" text,"Position" text,"Hometown/School" text)
SELECT "Pick" FROM table_46000 WHERE "Hometown/School" = 'concordia college'
top users with default user name.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId numbe...
SELECT DisplayName, Reputation FROM Users WHERE SUBSTRING(DisplayName, 1, 4) = 'user' ORDER BY Reputation DESC
What is the name of the player from Malaysia, Kuala Lumpur in Index f8?
CREATE TABLE table_70967 ("Index" text,"Name" text,"Chinese Name" text,"Country" text,"Status" text)
SELECT "Name" FROM table_70967 WHERE "Country" = 'malaysia, kuala lumpur' AND "Index" = 'f8'
Visualize the general trend of maximal price over the year, list X in desc order.
CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)
SELECT Year, MAX(Price) FROM wine GROUP BY Year ORDER BY Year DESC
How many total Gold medals did the nation ranked #3 receive?
CREATE TABLE table_name_22 (gold INTEGER,rank VARCHAR)
SELECT SUM(gold) FROM table_name_22 WHERE rank = "3"
percentage of homework tagged questions that are closed.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostNoticeTypes ...
SELECT Posts.Id AS "post_link", Posts.PostTypeId, Posts.ClosedDate, Posts.Tags FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE PostHistoryTypeId IN (3, 6) AND PostHistory.Text LIKE '%homework-and-exercises%' AND ClosedDate != ''
Show me about the distribution of ACC_Regular_Season and All_Games_Percent in a bar chart.
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 ACC_Regular_Season, All_Games_Percent FROM basketball_match
In what venue did FK Crvena Stijena play at home?
CREATE TABLE table_5526 ("Venue" text,"Home" text,"Guest" text,"Score" text,"Attendance" real)
SELECT "Venue" FROM table_5526 WHERE "Home" = 'fk crvena stijena'
List the name of ships whose nationality is not 'United States'.
CREATE TABLE ship (Name VARCHAR,Nationality VARCHAR)
SELECT Name FROM ship WHERE Nationality <> "United States"
Who won the stage when Mark Cavendish led the points classification, Rinaldo Nocentini led the general classification, and the stage was less than 11.0?
CREATE TABLE table_1059 ("Stage" real,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Young rider classification" text,"Team classification" text,"Combativity award" text)
SELECT "Winner" FROM table_1059 WHERE "Points classification" = 'Mark Cavendish' AND "General classification" = 'Rinaldo Nocentini' AND "Stage" < '11.0'
What is Drawn, when Lost is 14, and when Bonus Points is 12?
CREATE TABLE table_name_63 (drawn VARCHAR,lost VARCHAR,bonus_points VARCHAR)
SELECT drawn FROM table_name_63 WHERE lost = "14" AND bonus_points = "12"
What are the main indstries and total market value for each industry Visualize by bar chart, I want to order sum market value in asc order.
CREATE TABLE station_company (Station_ID int,Company_ID int,Rank_of_the_Year int)CREATE TABLE company (Company_ID int,Rank int,Company text,Headquarters text,Main_Industry text,Sales_billion real,Profits_billion real,Assets_billion real,Market_Value real)CREATE TABLE gas_station (Station_ID int,Open_Year int,Location t...
SELECT Main_Industry, SUM(Market_Value) FROM company GROUP BY Main_Industry ORDER BY SUM(Market_Value)
Name the number of Earnings per share ( ) which has a Net profit (US $m) larger than 66, and a Year to April smaller than 2010?
CREATE TABLE table_60285 ("Year to April" real,"Revenue (US $million)" real,"EBIT (US $m)" real,"Net profit (US $m)" real,"Earnings per share (\u00a2)" real)
SELECT COUNT("Earnings per share (\u00a2)") FROM table_60285 WHERE "Net profit (US $m)" > '66' AND "Year to April" < '2010'
Name the det/pre-amp with # of tubes of 8
CREATE TABLE table_66730 ("# Tubes" text,"Converter" text,"Det/Pre-amp" text,"Audio Amp" text,"Rectifier" text)
SELECT "Det/Pre-amp" FROM table_66730 WHERE "# Tubes" = '8'
Who is the guard for Wisconsin?
CREATE TABLE table_name_44 (player VARCHAR,position VARCHAR,school VARCHAR)
SELECT player FROM table_name_44 WHERE position = "guard" AND school = "wisconsin"
what medical procedure did patient 011-31229 last receive in 2105?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE medication (medicationid number,patientunitstayid num...
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 = '011-31229')) AND STRFTIME('%y', treatment.treatmenttime) = '2105'...
What is the black caribbean population when the other black population is 2243?
CREATE TABLE table_19149550_7 (black_caribbean_population INTEGER,other_black_population VARCHAR)
SELECT MAX(black_caribbean_population) FROM table_19149550_7 WHERE other_black_population = 2243
What was the Air Force - Navy score in the 1983 season?
CREATE TABLE table_1850339_2 (air_force___navy_score VARCHAR,season VARCHAR)
SELECT air_force___navy_score FROM table_1850339_2 WHERE season = 1983
What label has 22 January 2008 date?
CREATE TABLE table_name_8 (label VARCHAR,date VARCHAR)
SELECT label FROM table_name_8 WHERE date = "22 january 2008"
How many Against have Played smaller than 18?
CREATE TABLE table_name_54 (against VARCHAR,played INTEGER)
SELECT COUNT(against) FROM table_name_54 WHERE played < 18
calculate the number of patients who stayed in ward 40 the previous year.
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid numb...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 40 AND DATETIME(transfers.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
what is the minimum mcv value until 28 months ago for patient 027-139111?
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 MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-139111')) AND lab.labname = 'mcv' AND DATETIME(lab.labresulttime) <= DATETIME(...
Season of 2002 03, and a Lost larger than 14, what is the lowest goals?
CREATE TABLE table_name_38 (goalsfor INTEGER,season VARCHAR,lost VARCHAR)
SELECT MIN(goalsfor) FROM table_name_38 WHERE season = "2002–03" AND lost > 14
What regular season did the team reach the conference semifinals in the playoffs?
CREATE TABLE table_40633 ("Year" real,"Division" real,"League" text,"Regular Season" text,"Playoffs" text,"Open Cup" text)
SELECT "Regular Season" FROM table_40633 WHERE "Playoffs" = 'conference semifinals'
How many original air dates did the episode directed by Bethany rooney have?
CREATE TABLE table_28859177_3 (original_air_date VARCHAR,directed_by VARCHAR)
SELECT COUNT(original_air_date) FROM table_28859177_3 WHERE directed_by = "Bethany Rooney"
who took the least time to complete egot ?
CREATE TABLE table_204_673 (id number,"name" text,"egot completed" text,"emmy" number,"grammy" number,"oscar" number,"tony" number)
SELECT "name" FROM table_204_673 ORDER BY "egot completed" LIMIT 1
Tell me the average total for guatemala and bronze less than 2
CREATE TABLE table_name_32 (total INTEGER,nation VARCHAR,bronze VARCHAR)
SELECT AVG(total) FROM table_name_32 WHERE nation = "guatemala" AND bronze < 2
Which institution was located in bakersfield, california?
CREATE TABLE table_30010 ("Institution" text,"Location" text,"Founded" real,"Type" text,"Enrollment" real,"Nickname" text,"Current Conference" text,"Pac-12 Sports" text)
SELECT "Institution" FROM table_30010 WHERE "Location" = 'Bakersfield, California'
what's the computing mechanbeingm with first operational being february 1944
CREATE TABLE table_72467 ("Name" text,"First operational" text,"Numeral system" text,"Computing mechanism" text,"Programming" text,"Turing complete" text)
SELECT "Computing mechanism" FROM table_72467 WHERE "First operational" = 'February 1944'
what is the difference in number between the uninominal deputies from potos and beni ?
CREATE TABLE table_204_246 (id number,"department" text,"total deputies" number,"uninominal deputies" number,"plurinominal deputies" number,"special indigenous\nor campesino deputies" number,"senators" number)
SELECT ABS((SELECT "uninominal deputies" FROM table_204_246 WHERE "department" = 'potosi') - (SELECT "uninominal deputies" FROM table_204_246 WHERE "department" = 'beni'))
What is the 2012-list rank of a country with the lowest 2012-list rank out of all the countries with a 2010-list rank better than 13, a 2009-list rank of 0, a 2008-list rank lower than 4?
CREATE TABLE table_71788 ("Country" text,"2008-list" real,"2009-list" real,"2010-list" real,"2011-list" real,"2012-list" real)
SELECT MAX("2012-list") FROM table_71788 WHERE "2010-list" < '13' AND "2009-list" = '0' AND "2008-list" > '4'
Who won the season when Pete Thomas was the At-Home winner?
CREATE TABLE table_name_21 (the_biggest_loser VARCHAR,at_home_winner VARCHAR)
SELECT the_biggest_loser FROM table_name_21 WHERE at_home_winner = "pete thomas"
Is there a list of classes that do n't have lab sessions ?
CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respected int,participation int,heavy_reading int,tough_grade...
SELECT DISTINCT name, number FROM course WHERE department = 'EECS' AND has_lab = 'N'
Of the 17 -credit upper classes , is there one in Summer 2018 ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE gsi (course_offering_id in...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 17 AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Summer' AND s...
what was the monthly minimum intake of d5/.45ns that patient 27362 had received since 41 months ago?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE labevents (row_id number,subject_id number,h...
SELECT MIN(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 = 27362)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
What is the tries against when the points are 475?
CREATE TABLE table_76616 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text)
SELECT "Tries against" FROM table_76616 WHERE "Points for" = '475'
Which Date has a Record of 7 7 1?
CREATE TABLE table_49318 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Attendance" real,"Record" text,"Points" real)
SELECT "Date" FROM table_49318 WHERE "Record" = '7–7–1'
List the name of all projects that are operated longer than the average working hours of all projects.
CREATE TABLE assignedto (scientist number,project text)CREATE TABLE scientists (ssn number,name text)CREATE TABLE projects (code text,name text,hours number)
SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)