instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the earliest election with 2 seats and the outcome of the election of minority in parliament?
CREATE TABLE table_44642 ("Election" real,"Number of PNC votes" text,"Share of votes" text,"Seats" text,"Outcome of election" text)
SELECT MIN("Election") FROM table_44642 WHERE "Outcome of election" = 'minority in parliament' AND "Seats" = '2'
Maximum score per day per post type.
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABL...
SELECT CASE WHEN PostTypeId = 1 THEN 'Questions' ELSE 'Answers' END, MAX(CAST(Score AS FLOAT) / DATEDIFF(DAY, CreationDate, GETDATE())) AS Score FROM Posts WHERE DATEDIFF(DAY, CreationDate, GETDATE()) > 0 AND PostTypeId IN (1, 2) GROUP BY PostTypeId
What is the average tonnage of the ship named proletarij?
CREATE TABLE table_name_81 (tonnage INTEGER,name_of_ship VARCHAR)
SELECT AVG(tonnage) FROM table_name_81 WHERE name_of_ship = "proletarij"
What is the Transfer fee, when the Transfer window is 'winter', and when the item 'Moving to' is Northwich Victoria?
CREATE TABLE table_67298 ("Name" text,"Country" text,"Status" text,"Moving to" text,"Transfer window" text,"Transfer fee" text)
SELECT "Transfer fee" FROM table_67298 WHERE "Transfer window" = 'winter' AND "Moving to" = 'northwich victoria'
Name the people who wrote number 67
CREATE TABLE table_12419515_5 (written_by VARCHAR,series__number VARCHAR)
SELECT written_by FROM table_12419515_5 WHERE series__number = 67
how many time did patient 82235 produce a or urine output until 11/2103?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE charteve...
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82235)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'or urine' AND d_it...
Where was the istanbul marathon?
CREATE TABLE table_28357 ("Road race" text,"Distance" text,"Location" text,"Country" text,"Month held" text)
SELECT "Location" FROM table_28357 WHERE "Road race" = 'Istanbul Marathon'
What is the best top 10 when there are fewer than 0 wins?
CREATE TABLE table_name_30 (top_10s INTEGER,wins INTEGER)
SELECT MAX(top_10s) FROM table_name_30 WHERE wins < 0
When austin, texas is the hometown what is the lowest age?
CREATE TABLE table_1859855_2 (age INTEGER,hometown VARCHAR)
SELECT MIN(age) FROM table_1859855_2 WHERE hometown = "Austin, Texas"
What is the content of the rai 1 television service?
CREATE TABLE table_15887683_1 (content VARCHAR,television_service VARCHAR)
SELECT content FROM table_15887683_1 WHERE television_service = "Rai 1"
How many golds for teams ranking below 7 with 3 bronze and less than 5 total medals?
CREATE TABLE table_name_79 (gold VARCHAR,total VARCHAR,bronze VARCHAR,rank VARCHAR)
SELECT COUNT(gold) FROM table_name_79 WHERE bronze = 3 AND rank > 7 AND total < 5
how many had position s ?
CREATE TABLE table_203_481 (id number,"n\u00b0" number,"name" text,"position" text,"date of birth" text,"nationality" text)
SELECT COUNT(*) FROM table_203_481 WHERE "position" = 's'
Top 100 Reputation in Iran.
CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId nu...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Iran%' ORDER BY Reputation DESC LIMIT 1000
Which player has a total of 8 (24)?
CREATE TABLE table_name_8 (name VARCHAR,total VARCHAR)
SELECT name FROM table_name_8 WHERE total = "8 (24)"
Which area has a telephone of (052) of 3862279?
CREATE TABLE table_name_1 (area__km_2__ VARCHAR,telephone__052_ VARCHAR)
SELECT area__km_2__ FROM table_name_1 WHERE telephone__052_ = "3862279"
What was the score of the Kings game when they had a record of 8 11 1?
CREATE TABLE table_53791 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Score" FROM table_53791 WHERE "Record" = '8–11–1'
Show minimal age from each job, I want to show by the bars in descending.
CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)
SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY job DESC
What was launched and laid down in February 1819?
CREATE TABLE table_name_14 (launched VARCHAR,laid_down VARCHAR)
SELECT launched FROM table_name_14 WHERE laid_down = "february 1819"
What is the giant slalom with a 37 super g?
CREATE TABLE table_40854 ("Season" real,"Overall" text,"Slalom" text,"Giant Slalom" text,"Super G" text,"Downhill" text,"Combined" text)
SELECT "Giant Slalom" FROM table_40854 WHERE "Super G" = '37'
Name the style for 27
CREATE TABLE table_30665 ("Couple" text,"Style" text,"Music" text,"Trine Dehli Cleve" real,"Tor Fl\u00f8ysvik" real,"Karianne Gulliksen" real,"Christer Tornell" real,"Total" real)
SELECT "Style" FROM table_30665 WHERE "Total" = '27'
Who had an order of 907 and more than 1 game?
CREATE TABLE table_name_67 (name VARCHAR,games VARCHAR,order VARCHAR)
SELECT name FROM table_name_67 WHERE games > 1 AND order = 907
what is the total number of pylons listed ?
CREATE TABLE table_203_375 (id number,"name" text,"year built" text,"country" text,"town" text,"height" text,"remarks" text)
SELECT COUNT("name") FROM table_203_375
Top uses from France in tag 'elixir' or 'phoenix-framework'.
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...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", 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 u.Id =...
provide the number of patients whose admission location is transfer from hosp/extram and procedure long title is temporary colostomy?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Temporary colostomy"
count the number of patients whose diagnoses is sarcoidosis and drug route is ng.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Sarcoidosis" AND prescriptions.route = "NG"
what is the average base price of different bed type? List bed type and average base price.
CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType
Which School has a Location of peru?
CREATE TABLE table_name_37 (school VARCHAR,location VARCHAR)
SELECT school FROM table_name_37 WHERE location = "peru"
What is the Ship Type of the Prize Disposition of ship and a tonnage less than 151?
CREATE TABLE table_62121 ("Date" text,"Ship Name" text,"Tonnage" real,"Ship Type" text,"Location" text,"Disposition of Ship" text)
SELECT "Ship Type" FROM table_62121 WHERE "Disposition of Ship" = 'prize' AND "Tonnage" < '151'
What are the names of all clubs?
CREATE TABLE club (clubname VARCHAR)
SELECT clubname FROM club
For those employees who did not have any job in the past, visualize a bar chart about the distribution of hire_date and the average of department_id bin hire_date by weekday, and sort by the the average of department id from high to low.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(DEPARTMENT_ID) DESC
Find the order dates of the orders with price above 1000.
CREATE TABLE ref_service_types (service_type_code text,parent_service_type_code text,service_type_description text)CREATE TABLE services (service_id number,service_type_code text,workshop_group_id number,product_description text,product_name text,product_price number,other_product_service_details text)CREATE TABLE perf...
SELECT T1.order_date FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_price > 1000
what is the number of patients under the age of 70 who were admitted in emergency?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.age < "70"
For each bed type, find the average base price of different bed type Show bar chart, and show by the Y from high to low.
CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY AVG(basePrice) DESC
What was Obama's percentage in those places where McCain's percentage was 55.46%?
CREATE TABLE table_20524090_1 (obama_percentage VARCHAR,mccain_percentage VARCHAR)
SELECT obama_percentage FROM table_20524090_1 WHERE mccain_percentage = "55.46%"
Which year's genre was jazz under the columbia label when it was nominated for the title Trio jeepy?
CREATE TABLE table_name_37 (year VARCHAR,title VARCHAR,result VARCHAR,genre VARCHAR,label VARCHAR)
SELECT year FROM table_name_37 WHERE genre = "jazz" AND label = "columbia" AND result = "nominated" AND title = "trio jeepy"
What district is represented by a Republican Appropriations Committee?
CREATE TABLE table_12679326_1 (district VARCHAR,party VARCHAR,committee VARCHAR)
SELECT district FROM table_12679326_1 WHERE party = "Republican" AND committee = "Appropriations"
How many points are there, when the grade is A?
CREATE TABLE table_54524 ("Grade" text,"Points" real,"Sit-up (reps)" text,"Standing Broad Jump (cm)" text,"Chin-up (reps)" text,"Shuttle Run (sec)" text,"2.4km Run (min:sec)" text)
SELECT MAX("Points") FROM table_54524 WHERE "Grade" = 'a'
What is the most households with a median household income of $54,086 with less than 231,236 in population?
CREATE TABLE table_name_2 (number_of_households INTEGER,median_household_income VARCHAR,population VARCHAR)
SELECT MAX(number_of_households) FROM table_name_2 WHERE median_household_income = "$54,086" AND population < 231 OFFSET 236
How many faculty lines are there at San Francisco State University in 2004?
CREATE TABLE enrollments (campus number,year number,totalenrollment_ay number,fte_ay number)CREATE TABLE campuses (id number,campus text,location text,county text,year number)CREATE TABLE discipline_enrollments (campus number,discipline number,year number,undergraduate number,graduate number)CREATE TABLE csu_fees (camp...
SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2004 AND T2.campus = "San Francisco State University"
What is the total of tries for a player with conv smaller than 45, 19 starts and pens fewer than 22?
CREATE TABLE table_10151 ("Player" text,"Span" text,"Start" real,"Tries" real,"Conv" real,"Pens" real,"Drop" real)
SELECT COUNT("Tries") FROM table_10151 WHERE "Conv" < '45' AND "Start" = '19' AND "Pens" < '22'
What was the North Melbourne's score when they played as the home team?
CREATE TABLE table_name_52 (home_team VARCHAR)
SELECT home_team AS score FROM table_name_52 WHERE home_team = "north melbourne"
which country had the least amount of tourism income in 2003 ?
CREATE TABLE table_203_54 (id number,"selected\nlatin american\ncountries" text,"internl.\ntourism\narrivals\n2010\n(x 1000)" number,"internl.\ntourism\nreceipts.\n2010\n(usd\n(x1000)" number,"average\nreceipt\nper visitor\n2009\n(usd/turista)" number,"tourist\narrivals\nper\n1000 inhab\n(estimated)\n2007" number,"rece...
SELECT "selected\nlatin american\ncountries" FROM table_203_54 ORDER BY "tourism\nincome\n%\ngdp\n2003" LIMIT 1
What is the fewest number of laps completed by a rank 32?
CREATE TABLE table_name_12 (laps INTEGER,rank VARCHAR)
SELECT MIN(laps) FROM table_name_12 WHERE rank = "32"
how many jamerican cuisine are there in santa cruz county ?
CREATE TABLE restaurant (id int,name varchar,food_type varchar,city_name varchar,rating "decimal)CREATE TABLE geographic (city_name varchar,county varchar,region varchar)CREATE TABLE location (restaurant_id int,house_number int,street_name varchar,city_name varchar)
SELECT COUNT(*) FROM geographic, restaurant WHERE geographic.county = 'santa cruz county' AND restaurant.city_name = geographic.city_name AND restaurant.name = 'jamerican cuisine'
What is Place, when Player is 'Arnold Palmer'?
CREATE TABLE table_9812 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Place" FROM table_9812 WHERE "Player" = 'arnold palmer'
Tiger Woods has played less than 21 events and is what rank?
CREATE TABLE table_5180 ("Rank" real,"Player" text,"Country" text,"Earnings ($)" real,"Events" real,"Wins" real)
SELECT COUNT("Rank") FROM table_5180 WHERE "Player" = 'tiger woods' AND "Events" < '21'
what is the last ward id patient 028-39354 got since 4 years ago.
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabe...
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-39354') AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.unitadmittime DESC LIMIT 1
What is the D 48 with a D 46 with r 33 o?
CREATE TABLE table_52302 ("D 49 \u221a" text,"D 48 \u221a" text,"D 47 \u221a" text,"D 46 \u221a" text,"D 45 \u221a" text,"D 44 \u221a" text,"D 43 \u221a" text,"D 42 \u221a" text,"D 41 \u221a" text)
SELECT "D 48 \u221a" FROM table_52302 WHERE "D 46 \u221a" = 'r 33 o'
what is the number of patients whose admission location is emergency room admit and procedure short title is exc/dest hrt lesion open?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Exc/dest hrt lesion open"
What is the maximum torque that has 2,445 CC Displacement, and an Iveco 8144.61 engine?
CREATE TABLE table_75415 ("Model" text,"Engine" text,"Displacement" text,"Valvetrain" text,"Fuel system" text,"Max. power at rpm" text,"Max. torque at rpm" text)
SELECT "Max. torque at rpm" FROM table_75415 WHERE "Displacement" = '2,445 cc' AND "Engine" = 'iveco 8144.61'
how many games were won by the swarm by over 2 goals ?
CREATE TABLE table_203_47 (id number,"game" number,"date" text,"opponent" text,"location" text,"score" text,"ot" text,"attendance" number,"record" text)
SELECT COUNT("game") FROM table_203_47 WHERE "score" - "score" > 2
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, could you rank total number of manager id in ascending order please?
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of first_name and employee_id , and display by the total number in ascending.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STAT...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID
Draw a pie chart about the proportion of Sex and the sum of Weight.
CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex
Which player went to Michigan State?
CREATE TABLE table_10966926_2 (player_name VARCHAR,college VARCHAR)
SELECT player_name FROM table_10966926_2 WHERE college = "Michigan State"
WHO WAS THE COVER MODEL OF PLAYBOY WHERE THE CENTERFOLD MODEL WAS SHALLAN MEIERS?
CREATE TABLE table_20220 ("Date" text,"Cover model" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text,"Pictorials" text)
SELECT "Cover model" FROM table_20220 WHERE "Centerfold model" = 'Shallan Meiers'
Count questions tagged with a given tag combination.
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 PostHistory (Id number,PostHistoryTypeId number,PostId number,R...
SELECT COUNT(*) AS CNT FROM Posts WHERE Tags LIKE '%java%' AND Tags LIKE '%collision-detection%'
What is the name of each course and the corresponding number of student enrollment. Show bar chart.
CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment ...
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
serum creatinine greater than or equal to 1.3 mg / dl for female , and greater than or equal to 1.5 mg / dl for male
CREATE TABLE table_dev_30 ("id" int,"gender" string,"leukopenia" int,"cd4_count" int,"stroke" bool,"platelets" int,"hematocrit_hct" float,"fasting_triglycerides" int,"coronary_stenosis" int,"hyperlipidemia" bool,"lymphopenia" int,"fasting_ldl_cholesterol" int,"coronary_artery_disease_cad" bool,"serum_creatinine" float,...
SELECT * FROM table_dev_30 WHERE (serum_creatinine >= 1.3 AND gender = 'female') OR (serum_creatinine >= 1.5 AND gender = 'male')
Which 2005 has a 2004 of 3 2?
CREATE TABLE table_34429 ("Tournament" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"2013" text,"Win %" real)
SELECT "2005" FROM table_34429 WHERE "2004" = '3–2'
what are the five most frequent diagnoses of patients with age 30s since 6 years ago?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
Find the phone number of all the customers and staff.
CREATE TABLE staff (phone_number VARCHAR)CREATE TABLE customers (phone_number VARCHAR)
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff
My answers on the algorithm tag.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoR...
SELECT Q.Title, A.* FROM Posts AS A JOIN Posts AS Q ON A.ParentId = Q.Id JOIN PostTags ON PostTags.PostId = Q.Id JOIN Tags ON PostTags.TagId = Tags.Id WHERE A.OwnerUserId = '##UserId##' AND A.PostTypeId = 2 AND Q.PostTypeId = 1 AND TagName = 'algorithm' ORDER BY A.Score DESC
Which Bronze has a Nation of spain?
CREATE TABLE table_name_99 (bronze INTEGER,nation VARCHAR)
SELECT MAX(bronze) FROM table_name_99 WHERE nation = "spain"
What was the attendance when the VFL played Glenferrie Oval?
CREATE TABLE table_33609 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT SUM("Crowd") FROM table_33609 WHERE "Venue" = 'glenferrie oval'
What is the earliest year associated with 0 wins and 42 points?
CREATE TABLE table_name_22 (year INTEGER,wins VARCHAR,points VARCHAR)
SELECT MIN(year) FROM table_name_22 WHERE wins > 0 AND points = 42
Which Men's doubles have a Year smaller than 1960, and Men's singles of noel b. radford?
CREATE TABLE table_75490 ("Year" real,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text)
SELECT "Men's doubles" FROM table_75490 WHERE "Year" < '1960' AND "Men's singles" = 'noel b. radford'
Where was the game in which Carl Landry (25) did the most high points played?
CREATE TABLE table_73505 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Location Attendance" FROM table_73505 WHERE "High points" = 'Carl Landry (25)'
What was the highest number played when there were 21 goals conceded and a draw greater than 3?
CREATE TABLE table_name_47 (played INTEGER,goals_conceded VARCHAR,draw VARCHAR)
SELECT MAX(played) FROM table_name_47 WHERE goals_conceded = 21 AND draw > 3
What is the average Attendance, when Venue is 'Candlestick Park', and when Date is 'November 25'?
CREATE TABLE table_name_54 (attendance INTEGER,venue VARCHAR,date VARCHAR)
SELECT AVG(attendance) FROM table_name_54 WHERE venue = "candlestick park" AND date = "november 25"
SELECT TOP 10 * FROM tags ORDER BY Count DESC.
CREATE TABLE PostHistoryTypes (Id number,Name text)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 SuggestedEdits (Id number,PostId number,Creatio...
SELECT * FROM Tags ORDER BY Count DESC LIMIT 10
Which school or club team has a pick of 139?
CREATE TABLE table_name_60 (school_club_team VARCHAR,pick VARCHAR)
SELECT school_club_team FROM table_name_60 WHERE pick = 139
What circuit has volvo cars australia as the team?
CREATE TABLE table_name_15 (circuit VARCHAR,team VARCHAR)
SELECT circuit FROM table_name_15 WHERE team = "volvo cars australia"
what's the economics score with education being 92.0
CREATE TABLE table_145439_1 (economics VARCHAR,education VARCHAR)
SELECT economics FROM table_145439_1 WHERE education = "92.0"
What is the highest attendance at a game with a result of 5-1?
CREATE TABLE table_78774 ("Date" text,"Round" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real,"Scorers" text)
SELECT MAX("Attendance") FROM table_78774 WHERE "Result" = '5-1'
calculate the minimum age of male patients who were discharged to long term hospital care.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.discharge_location = "LONG TERM CARE HOSPITAL"
What was the away team's score at the game held at MCG?
CREATE TABLE table_name_44 (away_team VARCHAR,venue VARCHAR)
SELECT away_team AS score FROM table_name_44 WHERE venue = "mcg"
What manufacturer made class b-2?
CREATE TABLE table_8809 ("Class" text,"Wheel arrangement" text,"Fleet number(s)" text,"Manufacturer" text,"Year made" text,"Quantity made" text,"Quantity preserved" text)
SELECT "Manufacturer" FROM table_8809 WHERE "Class" = 'b-2'
What is Away, when Home is 'marathon'?
CREATE TABLE table_name_14 (away VARCHAR,home VARCHAR)
SELECT away FROM table_name_14 WHERE home = "marathon"
Who was Silva's Partner in the Amarante Tournament played on a Hard Surface?
CREATE TABLE table_name_35 (partner VARCHAR,surface VARCHAR,tournament VARCHAR)
SELECT partner FROM table_name_35 WHERE surface = "hard" AND tournament = "amarante"
What is the year First elected, when the State is vic, and when the Member is Hon Don Chipp?
CREATE TABLE table_70142 ("Member" text,"Party" text,"Electorate" text,"State" text,"First elected" text)
SELECT "First elected" FROM table_70142 WHERE "State" = 'vic' AND "Member" = 'hon don chipp'
get the number of patients with base type drug prescription who have diagnoses icd9 code 6959.
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "6959" AND prescriptions.drug_type = "BASE"
how many patients stayed in hospital for more than 34 days and used the drug pancrelipase 5000?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "34" AND prescriptions.drug = "Pancrelipase 5000"
For those products with a price between 60 and 120, show me about the correlation between code and manufacturer in a scatter chart.
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 Code, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120
Name the college that has 7 rounds and boston celtics team
CREATE TABLE table_name_86 (college VARCHAR,team VARCHAR,round VARCHAR)
SELECT college FROM table_name_86 WHERE team = "boston celtics" AND round = "7"
How many Australians were in the UN commission on Korea?
CREATE TABLE table_15938 ("UN Operation name" text,"UN Operation title" text,"Location" text,"Dates of Australian involvement" text,"Number of Australians involved" text,"Australian role" text)
SELECT COUNT("Number of Australians involved") FROM table_15938 WHERE "UN Operation title" = 'UN Commission on Korea'
What Player has a To par of +1 and a Score of 73-71-71=217?
CREATE TABLE table_name_24 (player VARCHAR,to_par VARCHAR,score VARCHAR)
SELECT player FROM table_name_24 WHERE to_par = "+1" AND score = 73 - 71 - 71 = 217
For those employees who did not have any job in the past, a bar chart shows the distribution of job_id and the average of salary , and group by attribute job_id, and sort by the y axis in descending.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the amount of name , and group by attribute name, and list from low to high by the Name please.
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 T1.Name, COUNT(T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name
What player represented Vista Murrieta High School?
CREATE TABLE table_17064 ("Player" text,"Position" text,"School" text,"Hometown" text,"College" text)
SELECT "Player" FROM table_17064 WHERE "School" = 'Vista Murrieta High School'
Name the days for current champions of dean ambrose
CREATE TABLE table_15274 ("Championship" text,"Current champion(s)" text,"Reign" text,"Date won" text,"Days held" real,"Location" text)
SELECT "Days held" FROM table_15274 WHERE "Current champion(s)" = 'dean ambrose'
Who was the writer of the episode with a production code of 5aky04?
CREATE TABLE table_26826304_1 (written_by VARCHAR,production_code VARCHAR)
SELECT written_by FROM table_26826304_1 WHERE production_code = "5AKY04"
How many episodes aired on 22january2009
CREATE TABLE table_17641206_8 (episode VARCHAR,original_airdate VARCHAR)
SELECT COUNT(episode) FROM table_17641206_8 WHERE original_airdate = "22January2009"
Which airport has an ICAO of ybcg?
CREATE TABLE table_36855 ("City" text,"State/Territory" text,"IATA" text,"ICAO" text,"Airport" text,"Begin" text)
SELECT "Airport" FROM table_36855 WHERE "ICAO" = 'ybcg'
What is the title of production code 514?
CREATE TABLE table_11630008_7 (title VARCHAR,production_code VARCHAR)
SELECT title FROM table_11630008_7 WHERE production_code = 514
Name the language for sopachuy 10
CREATE TABLE table_27392 ("Language" text,"Padilla Municipality" real,"Tomina Municipality" real,"Sopachuy Municipality" real,"Villa Alcal\u00e1 Municipality" real,"El Villar Municipality" real)
SELECT "Language" FROM table_27392 WHERE "Sopachuy Municipality" = '10'
What are the id of students who registered courses or attended courses?
CREATE TABLE student_course_attendance (student_id number,course_id number,date_of_attendance time)CREATE TABLE candidate_assessments (candidate_id number,qualification text,assessment_date time,asessment_outcome_code text)CREATE TABLE candidates (candidate_id number,candidate_details text)CREATE TABLE courses (course_...
SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance
What did Alex Tagliani get for Qual 1?
CREATE TABLE table_name_93 (qual_1 VARCHAR,name VARCHAR)
SELECT qual_1 FROM table_name_93 WHERE name = "alex tagliani"
Which championship has a margin of 8 strokes?
CREATE TABLE table_39604 ("Year" real,"Championship" text,"54 Holes" text,"Winning Score" text,"Margin" text,"Runner(s)-up" text)
SELECT "Championship" FROM table_39604 WHERE "Margin" = '8 strokes'
Which method has a record of 3-0?
CREATE TABLE table_name_27 (method VARCHAR,record VARCHAR)
SELECT method FROM table_name_27 WHERE record = "3-0"