instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
how many self pay insurance patients are male?
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Self Pay"
Find the movies with the highest average rating. Return the movie titles and average rating.
CREATE TABLE movie (mid number,title text,year number,director text)CREATE TABLE reviewer (rid number,name text)CREATE TABLE rating (rid number,mid number,stars number,ratingdate time)
SELECT T2.title, AVG(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.mid ORDER BY AVG(T1.stars) DESC LIMIT 1
How many laps had a qualification of 136.168?
CREATE TABLE table_71303 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real)
SELECT COUNT("Laps") FROM table_71303 WHERE "Qual" = '136.168'
How many songs have mi-chemin as their Japanese name and romanji name?
CREATE TABLE table_10979230_4 (romaji_title VARCHAR,japanese_title VARCHAR)
SELECT COUNT(romaji_title) FROM table_10979230_4 WHERE japanese_title = "Mi-Chemin"
What is the masculine an form for the word with a feminine ending of siangar and a masculine u ending of sunar?
CREATE TABLE table_name_49 (masculine_an_stems VARCHAR,feminine_ō_stems VARCHAR,masculine_u_stems VARCHAR)
SELECT masculine_an_stems FROM table_name_49 WHERE feminine_ō_stems = "siangar" AND masculine_u_stems = "sunar"
What is Week 14 Nov 24, that has Week 11 Nov 3 of USC (6-2)?
CREATE TABLE table_38972 ("Preseason" text,"Week 1 Aug 26" text,"Week 2 Sept 2" text,"Week 3 Sept 8" text,"Week 4 Sept 15" text,"Week 5 Sept 22" text,"Week 6 Sept 29" text,"Week 7 Oct 6" text,"Week 8 Oct 13" text,"Week 9 Oct 20" text,"Week 10 Oct 27" text,"Week 11 Nov 3" text,"Week 12 Nov 10" text,"Week 13 Nov 17" text...
SELECT "Week 14 Nov 24" FROM table_38972 WHERE "Week 11 Nov 3" = 'usc (6-2)'
Who was the minister of the labor party and had 26 goverments?
CREATE TABLE table_61585 ("Minister" text,"Party" text,"Governments" text,"Term start" text,"Term end" text)
SELECT "Minister" FROM table_61585 WHERE "Party" = 'labor party' AND "Governments" = '26'
How many products are there?
CREATE TABLE ref_colors (color_code text,color_description text)CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selling_price text,product_description text,other_product_details text)CREATE TABLE ref_product_categories (product_cate...
SELECT COUNT(*) FROM products
What is the value for Drawn, when the value for Losing bonus is 6?
CREATE TABLE table_67685 ("Club" text,"Played" 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 "Drawn" FROM table_67685 WHERE "Losing bonus" = '6'
List the number of shows that had 12.04 million viewers in the united states
CREATE TABLE table_22904780_1 (title VARCHAR,us_viewers__million_ VARCHAR)
SELECT COUNT(title) FROM table_22904780_1 WHERE us_viewers__million_ = "12.04"
Find the major that is studied by the most female students.
CREATE TABLE voting_record (stuid number,registration_date text,election_cycle text,president_vote number,vice_president_vote number,secretary_vote number,treasurer_vote number,class_president_vote number,class_senator_vote number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number...
SELECT major FROM student WHERE sex = "F" GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
What is the capacity when the 2007 08 season was 1st Serie D/I?
CREATE TABLE table_58728 ("Club" text,"City" text,"Stadium" text,"Capacity" real,"2007\u201308 season" text)
SELECT "Capacity" FROM table_58728 WHERE "2007\u201308 season" = '1st serie d/i'
What is the Opponent of the Game on October 20?
CREATE TABLE table_name_50 (opponent VARCHAR,date VARCHAR)
SELECT opponent FROM table_name_50 WHERE date = "october 20"
What is the total number of regions where the average family size is 2.8?
CREATE TABLE table_20506 ("Region of USSR" text,"Number of families" real,"Number of people" real,"Average family size" text,"% of total deportees" text)
SELECT COUNT("% of total deportees") FROM table_20506 WHERE "Average family size" = '2.8'
Show the ids and names of festivals that have at least two nominations for artworks by a bar chart, rank in descending by the y axis.
CREATE TABLE artwork (Artwork_ID int,Type text,Name text)CREATE TABLE nomination (Artwork_ID int,Festival_ID int,Result text)CREATE TABLE festival_detail (Festival_ID int,Festival_Name text,Chair_Name text,Location text,Year int,Num_of_Audience int)
SELECT T3.Festival_Name, T1.Festival_ID FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T1.Festival_ID DESC
Name the opponent for record 10-4
CREATE TABLE table_18894744_5 (opponent VARCHAR,record VARCHAR)
SELECT opponent FROM table_18894744_5 WHERE record = "10-4"
What Inchicore Class has a GSWR Class smaller than 268, and a Type of 0-4-2t?
CREATE TABLE table_name_60 (inchicore_class VARCHAR,gswr_class VARCHAR,type VARCHAR)
SELECT inchicore_class FROM table_name_60 WHERE gswr_class < 268 AND type = "0-4-2t"
what is AA 's last flight from BOSTON to WASHINGTON on 7 21
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE air...
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 = 'WASHINGTON' AND date_day.day_number = 21 AND date_day.month_number = 7 ...
Find meter_500 and meter_100 , and visualize them by a bar chart, could you list by the X in asc?
CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te...
SELECT meter_500, meter_100 FROM swimmer ORDER BY meter_500
What is the lane total when rank is 2?
CREATE TABLE table_name_89 (lane INTEGER,rank VARCHAR)
SELECT SUM(lane) FROM table_name_89 WHERE rank = 2
how many patients who have stayed in the hospital for more than 43 days have 4432 as their procedure icd9 code?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "43" AND procedures.icd9_code = "4432"
Are any of the RCIDIV 318 classes before noon ?
CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project va...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'RCIDIV' AND course.number = 318 AND semester.semester = 'WN' AND semester.semester_id = course_o...
I want the standing for january 29 and finished of 3rd and total points less than 248
CREATE TABLE table_name_59 (standing VARCHAR,date VARCHAR,total_points VARCHAR,finished VARCHAR)
SELECT standing FROM table_name_59 WHERE total_points < 248 AND finished = "3rd" AND date = "january 29"
How many Played has a % Win of 50.00%, and Losses of 1, and Wins smaller than 1?
CREATE TABLE table_37361 ("Year" text,"Played" real,"Wins" real,"Losses" real,"No Result" real,"% Win" text)
SELECT COUNT("Played") FROM table_37361 WHERE "% Win" = '50.00%' AND "Losses" = '1' AND "Wins" < '1'
Show names of shops that have more than one kind of device in stock.
CREATE TABLE shop (Shop_Name VARCHAR,Shop_ID VARCHAR)CREATE TABLE stock (Shop_ID VARCHAR)
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1
Record of 47 5 (1) involved what res?
CREATE TABLE table_6646 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Round" text)
SELECT "Res." FROM table_6646 WHERE "Record" = '47–5 (1)'
japan finished below how many countries ?
CREATE TABLE table_204_183 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT COUNT("nation") FROM table_204_183 WHERE "rank" < (SELECT "rank" FROM table_204_183 WHERE "nation" = 'japan')
Find the number of the names of swimmers who has a result of 'win', show names in ascending order please.
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadiu...
SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY name
Top answers on UX Stack Exchange.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDa...
SELECT CONCAT('http://dba.stackexchange.com/a/', Posts.Id) AS "Url", Posts.Score, Users.DisplayName FROM Posts JOIN Users ON (Posts.OwnerUserId = Users.Id) WHERE PostTypeId = 2 ORDER BY Score DESC LIMIT 100
What year had more than 2 goals and 11 (2) games?
CREATE TABLE table_64598 ("Name" text,"Games" text,"W-League" text,"Finals" text,"Goals" real,"Years" text)
SELECT "Years" FROM table_64598 WHERE "Goals" > '2' AND "Games" = '11 (2)'
Who replaced when the position in table is 5th?
CREATE TABLE table_name_58 (replaced_by VARCHAR,position_in_table VARCHAR)
SELECT replaced_by FROM table_name_58 WHERE position_in_table = "5th"
MSE rate of posting (non-zero).
CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE...
SELECT COUNT(*) AS Q_count, p.OwnerUserId AS uid FROM Posts AS p WHERE p.PostTypeId = 1 AND p.OwnerUserId IN (141525, 146126, 811, 50049, 1438, 164200, 115866, 155160, 98786, 209637, 147336, 131182, 135201, 23354, 51, 6212, 146719, 166017, 4, 2, 130213, 159928, 13, 176330, 208518, 142481, 229741, 232374, 147574, 235711...
How many viewers did Episode 5 have?
CREATE TABLE table_17872 ("No." real,"Episode" text,"Writer" text,"Director" text,"Viewers(millions)" text,"Original airdate" text)
SELECT "Viewers(millions)" FROM table_17872 WHERE "Episode" = 'Episode 5'
Name the captain for ben sigmund
CREATE TABLE table_17930 ("Club" text,"Australian Marquee" text,"International Marquee" text,"Junior Marquee player" text,"Captain" text,"Vice-Captain" text)
SELECT "Captain" FROM table_17930 WHERE "Vice-Captain" = 'Ben Sigmund'
how many urgent hospital admission patients have diagnoses icd9 code 99813?
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 lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "99813"
What was the lowest Attendance on 8 October 1986?
CREATE TABLE table_name_1 (attendance INTEGER,date VARCHAR)
SELECT MIN(attendance) FROM table_name_1 WHERE date = "8 october 1986"
What is the average grid for johnny herbert with a Time/Retired of +1 lap?
CREATE TABLE table_name_38 (grid INTEGER,time_retired VARCHAR,driver VARCHAR)
SELECT AVG(grid) FROM table_name_38 WHERE time_retired = "+1 lap" AND driver = "johnny herbert"
Who were the opponents that played on a hard surface on July 13, 2008?
CREATE TABLE table_name_85 (opponents VARCHAR,surface VARCHAR,date VARCHAR)
SELECT opponents FROM table_name_85 WHERE surface = "hard" AND date = "july 13, 2008"
Which episodes has the lowest average ratings of 8.7%?
CREATE TABLE table_64295 ("Japanese Title" text,"Romaji Title" text,"TV Station" text,"Episodes" real,"Average Ratings" text)
SELECT MIN("Episodes") FROM table_64295 WHERE "Average Ratings" = '8.7%'
What are the id and name of the stations that have ever had more than 12 bikes available? Plot them as a bar chart, sort total number in descending order.
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temp...
SELECT name, id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 ORDER BY id DESC
Which Venue has an Against of 25?
CREATE TABLE table_name_26 (venue VARCHAR,against VARCHAR)
SELECT venue FROM table_name_26 WHERE against = 25
What is the earliest season that has a position over 12?
CREATE TABLE table_name_80 (season INTEGER,position INTEGER)
SELECT MIN(season) FROM table_name_80 WHERE position > 12
list the top four most common diagnoses that patients were diagnosed with within 2 months after being diagnosed with thoracic aortic aneurysm until 1 year ago.
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_labitems (row_id number,itemid number,label text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)C...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
When the Away team was south melbourne what was the home team?
CREATE TABLE table_52429 ("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_52429 WHERE "Away team" = 'south melbourne'
Who is the March playmate with a November playmate Cara Wakelin?
CREATE TABLE table_14376 ("January" text,"February" text,"March" text,"April" text,"June" text,"July" text,"August" text,"September" text,"October" text,"November" text,"December" text)
SELECT "March" FROM table_14376 WHERE "November" = 'cara wakelin'
when standard speed (6th gear) is 88, what is the rpm?
CREATE TABLE table_23165 ("RPM" real,"Standard HP" text,"Standard torque (lb/ft)" text,"Standard speed (6th gear)" text,"Modified speed (6th gear)" real,"Modified HP" text,"Modified torque (lb/ft)" text)
SELECT "RPM" FROM table_23165 WHERE "Standard speed (6th gear)" = '88'
What's the name of the train that goes to Bhubaneswar?
CREATE TABLE table_26102 ("Service" real,"Train number" real,"Train name" text,"Source" text,"Departure" text,"Destination" text,"Arrival" text)
SELECT "Train name" FROM table_26102 WHERE "Destination" = 'Bhubaneswar'
how many married patients have the diagnosis icd9 code as 53089?
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 lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.icd9_code = "53089"
On which day has it neither been foggy nor rained in the zip code of 94107, and count them by a bar chart, and I want to order in descending by the Y-axis.
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time ...
SELECT date, COUNT(date) FROM weather WHERE zip_code = 94107 AND events <> "Fog" AND events <> "Rain" ORDER BY COUNT(date) DESC
How many tracks belong to rock genre?
CREATE TABLE GENRE (GenreId VARCHAR,Name VARCHAR)CREATE TABLE TRACK (GenreId VARCHAR)
SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"
what is the last date ?
CREATE TABLE table_204_130 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT "date" FROM table_204_130 ORDER BY "date" DESC LIMIT 1
List the name of browsers in descending order by market share.
CREATE TABLE browser (id number,name text,market_share number)CREATE TABLE accelerator_compatible_browser (accelerator_id number,browser_id number,compatible_since_year number)CREATE TABLE web_client_accelerator (id number,name text,operating_system text,client text,connection text)
SELECT name FROM browser ORDER BY market_share DESC
Which Total is the highest one that has a Gold of 1, and a Nation of czechoslovakia?
CREATE TABLE table_34114 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Total") FROM table_34114 WHERE "Gold" = '1' AND "Nation" = 'czechoslovakia'
What is the booking end dates of the apartments with type code 'Duplex'? Bin the year into weekday interval with a bar chart.
CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name CHAR(15),building_full_name VARCHAR(80),building_description VARCHAR(255),building_address VARCHAR(255),building_manager VARCHAR(50),building_phone VARCHAR(80))CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE ...
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex"
what country scored the top number of bronze medals in taekwondo at the 2013 bolivarian games ?
CREATE TABLE table_204_922 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "nation" FROM table_204_922 ORDER BY "bronze" DESC LIMIT 1
How much salary did the top 3 well-paid players get in 2001?
CREATE TABLE manager_half (player_id text,year number,team_id text,league_id text,inseason number,half number,g number,w number,l number,rank number)CREATE TABLE team_half (year number,league_id text,team_id text,half number,div_id text,div_win text,rank number,g number,w number,l number)CREATE TABLE fielding_postseaso...
SELECT salary FROM salary WHERE year = 2001 ORDER BY salary DESC LIMIT 3
How many silver medals when the bronze is more than 2 and having a rank more than 5?
CREATE TABLE table_62943 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Silver") FROM table_62943 WHERE "Rank" > '5' AND "Bronze" > '2'
Give me a bar chart for how many competition type of each competition type, and rank the number of competition type in ascending order.
CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int,Apps real,Tries real,Goals text,Points real)CREATE TABLE competitio...
SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type)
What model has a number built smaller than 6.526, and the Chassis code w109.015?
CREATE TABLE table_61686 ("Model" text,"Chassis code" text,"Production time" text,"Number built" real,"Engine" text)
SELECT "Model" FROM table_61686 WHERE "Number built" < '6.526' AND "Chassis code" = 'w109.015'
what is the minimum production code with title 'foreign exchange problem / turn about
CREATE TABLE table_16019 ("Episode #" real,"Production code" real,"Title" text,"Directed by" text,"Written by" text,"Airdate" text)
SELECT MIN("Production code") FROM table_16019 WHERE "Title" = 'Foreign Exchange Problem / Turn About'
Candidate John Mccain had how many delegates?
CREATE TABLE table_16186152_1 (delegates VARCHAR,candidate VARCHAR)
SELECT delegates FROM table_16186152_1 WHERE candidate = "John McCain"
WHAT IS THE ROUND WITH PICK OF 7?
CREATE TABLE table_name_9 (round INTEGER,pick VARCHAR)
SELECT SUM(round) FROM table_name_9 WHERE pick = 7
Find the name of the customer that has been involved in the most policies.
CREATE TABLE customers (customer_id number,customer_details text)CREATE TABLE claims_documents (claim_id number,document_type_code text,created_by_staff_id number,created_date number)CREATE TABLE policies (policy_id number,customer_id number,policy_type_code text,start_date time,end_date time)CREATE TABLE claims_proces...
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY COUNT(*) DESC LIMIT 1
what is the name of the drug that has been prescribed two or more times in 12/2105 to patient 015-58787?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient...
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015...
please list the flights from CHARLOTTE to NEWARK
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion va...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHARLOTTE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWA...
What is Original title, when Director is Veljko Bulaji category:articles with hcards, and when Film title used in nomination is Train Without A Timetable?
CREATE TABLE table_name_35 (original_title VARCHAR,director VARCHAR,film_title_used_in_nomination VARCHAR)
SELECT original_title FROM table_name_35 WHERE director = "veljko bulajić category:articles with hcards" AND film_title_used_in_nomination = "train without a timetable"
What is Position, when Overallis less than 314, and when Pick is less than 8?
CREATE TABLE table_name_84 (position VARCHAR,overall VARCHAR,pick VARCHAR)
SELECT position FROM table_name_84 WHERE overall < 314 AND pick < 8
What was the attendance during week 7?
CREATE TABLE table_name_88 (attendance VARCHAR,week VARCHAR)
SELECT attendance FROM table_name_88 WHERE week = 7
A bar chart for what are the number of the wines that have prices lower than 50 and have appelations in Monterey county?, I want to sort by the Y in descending please.
CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)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)
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name) DESC
What is the total number of January ( C) temperatures when the July ( C) temperatures were 23/15?
CREATE TABLE table_24690 ("Location" text,"July (\u00b0C)" text,"July (\u00b0F)" text,"January (\u00b0C)" text,"January (\u00b0F)" text)
SELECT COUNT("January (\u00b0C)") FROM table_24690 WHERE "July (\u00b0C)" = '23/15'
what is the total number of patients discharged from a hospital in 2104?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREA...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND STRFTIME('%y', admissions.dischtime) = '2104'
What is Player, when Score is '66-74-76=216'?
CREATE TABLE table_77408 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Player" FROM table_77408 WHERE "Score" = '66-74-76=216'
What was the winning score when the runner-up was Beth Daniel and the margin of victory was 7 strokes?
CREATE TABLE table_9800 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Winning score" FROM table_9800 WHERE "Runner(s)-up" = 'beth daniel' AND "Margin of victory" = '7 strokes'
How many millions of U.S. viewers watched the episode directed by Allison Liddi-Brown?
CREATE TABLE table_18102421_2 (us_viewers__millions_ VARCHAR,directed_by VARCHAR)
SELECT us_viewers__millions_ FROM table_18102421_2 WHERE directed_by = "Allison Liddi-Brown"
Name the drug type and route of administration for the drug with drug code KPHO45I.
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 prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "KPHO45I"
For those products with a price between 60 and 120, find name and code , and visualize them by a bar chart, list Y-axis in ascending 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 Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Code
A bar chart showing the average weight for each gender, I want to sort total number from high to low order.
CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)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)
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY AVG(Weight) DESC
Find the name and active date of the customer that use email as the contact channel.
CREATE TABLE customers (customer_name VARCHAR,customer_id VARCHAR)CREATE TABLE customer_contact_channels (active_from_date VARCHAR,customer_id VARCHAR,channel_code VARCHAR)
SELECT t1.customer_name, t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'
For each denomination, return the denomination and the count of schools with that denomination Visualize by bar chart, and could you list Denomination in asc order?
CREATE TABLE school_details (School_ID int,Nickname text,Colors text,League text,Class text,Division text)CREATE TABLE school (School_ID int,School text,Location text,Enrollment real,Founded real,Denomination text,Boys_or_Girls text,Day_or_Boarding text,Year_Entered_Competition real,School_Colors text)CREATE TABLE play...
SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY Denomination
How many people were at the game with a record of 6-1?
CREATE TABLE table_33769 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"TV Time" text,"Attendance" text)
SELECT "Attendance" FROM table_33769 WHERE "Record" = '6-1'
What are the ids of all students who don't play sports?
CREATE TABLE video_games (gameid number,gname text,gtype text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE plays_games (stuid number,gameid number,hours_played number)CREATE TABLE sportsinfo (stuid number,sportname text,hoursperweek...
SELECT stuid FROM student EXCEPT SELECT stuid FROM sportsinfo
What is the Tournament with a Score that is 2 6, 6 4, 3 6?
CREATE TABLE table_40621 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Tournament" FROM table_40621 WHERE "Score" = '2–6, 6–4, 3–6'
Find the number of rooms with more than 50 capacity for each building Show bar chart, and could you display by the names from low to high?
CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE classroom (building varchar(15),room_number...
SELECT building, COUNT(*) FROM classroom WHERE capacity > 50 GROUP BY building ORDER BY building
Name the total number of wd number for lms number being 7638
CREATE TABLE table_73194 ("LMS No." real,"WD No." real,"Builder" text,"Serial No." real,"Date built" real)
SELECT COUNT("WD No.") FROM table_73194 WHERE "LMS No." = '7638'
Top users who haven't changed their username.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)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 PendingFla...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Rank, Id AS "user_link", Reputation FROM Users WHERE DisplayName = 'user' + CAST(Id AS TEXT(40)) LIMIT 100
The most viewed ELL questions.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE TagS...
SELECT Id AS "post_link", ViewCount, Score FROM Posts ORDER BY ViewCount DESC LIMIT 200
What is the highest crude death rate when deaths are 3 433 and average population is greater than 298?
CREATE TABLE table_name_16 (crude_death_rate__per_1000_ INTEGER,deaths VARCHAR,average_population__x_1000_ VARCHAR)
SELECT MAX(crude_death_rate__per_1000_) FROM table_name_16 WHERE deaths = "3 433" AND average_population__x_1000_ > 298
what is the four most frequent drugs that were prescribed during the same hospital encounter to failure to wean female patients of age 40s after they have been diagnosed with failure to wean since 2104?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'failure to wean...
Score of 3 6, 7 5, 6 4 included what date?
CREATE TABLE table_5136 ("Date" text,"Tournament" text,"Surface" text,"Opponent in the Final" text,"Score" text)
SELECT "Date" FROM table_5136 WHERE "Score" = '3–6, 7–5, 6–4'
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find hire_date and the sum of salary bin hire_date by weekday, and visualize them by a bar chart, and sort total number in descending 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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAI...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY) DESC
Which Opponent has a Result of 1 1, and a Date of 28 november 1998?
CREATE TABLE table_63097 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real)
SELECT "Opponent" FROM table_63097 WHERE "Result" = '1–1' AND "Date" = '28 november 1998'
Who was the CM winning team when the FM winning team was #17 Elva - Ford?
CREATE TABLE table_29225103_2 (cm_winning_team VARCHAR,fm_winning_team VARCHAR)
SELECT cm_winning_team FROM table_29225103_2 WHERE fm_winning_team = "#17 Elva - Ford"
give me the number of patients whose procedure short title is lap periton adhesiolysis?
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 procedures.short_title = "Lap periton adhesiolysis"
What is Result, when Date is 11 August 1992?
CREATE TABLE table_name_26 (result VARCHAR,date VARCHAR)
SELECT result FROM table_name_26 WHERE date = "11 august 1992"
What is the rank number that aired october 26, 2007?
CREATE TABLE table_11251109_3 (_number VARCHAR,air_date VARCHAR)
SELECT RANK(_number) FROM table_11251109_3 WHERE air_date = "October 26, 2007"
What was the score for the game with FK Bratstvo as home team?
CREATE TABLE table_75081 ("Venue" text,"Home" text,"Guest" text,"Score" text,"Attendance" real)
SELECT "Score" FROM table_75081 WHERE "Home" = 'fk bratstvo'
what is the number of patients whose diagnoses short title is dmi renl nt st uncntrld and procedure short title is infusion of vasopressor?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE diagnoses.short_title = "DMI renl nt st uncntrld" AND procedures.short_title = "Infusion of vasopressor"
Which team had 1 race, 1 F/lap and in the series 24 hours of Nurburgring?
CREATE TABLE table_49322 ("Season" text,"Series" text,"Team" text,"Races" text,"Wins" text,"Poles" text,"F/Laps" text,"Podiums" text,"Points" text,"Position" text)
SELECT "Team" FROM table_49322 WHERE "Races" = '1' AND "F/Laps" = '1' AND "Series" = '24 hours of nurburgring'
What record has pittsburgh as the visitor, and November 23 as the date?
CREATE TABLE table_name_45 (record VARCHAR,visitor VARCHAR,date VARCHAR)
SELECT record FROM table_name_45 WHERE visitor = "pittsburgh" AND date = "november 23"
What are the names of catalog entries with level number 8, and count them by a bar chart, and display from high to low by the Y-axis.
CREATE TABLE Catalog_Contents (catalog_entry_id INTEGER,catalog_level_number INTEGER,parent_entry_id INTEGER,previous_entry_id INTEGER,next_entry_id INTEGER,catalog_entry_name VARCHAR(80),product_stock_number VARCHAR(50),price_in_dollars DOUBLE,price_in_euros DOUBLE,price_in_pounds DOUBLE,capacity VARCHAR(20),length VA...
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY COUNT(catalog_entry_name) DESC