table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty_Participates_in (
FacID IN... | How many students are advised by each rank of faculty? List the rank and the number of students Plot them as bar chart, I want to display from low to high by the Rank please. | SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY Rank |
CREATE TABLE table_name_43 (
architect VARCHAR,
built VARCHAR,
building VARCHAR
) | Who was the architect that built the Electric Railway Chambers before 1915? | SELECT architect FROM table_name_43 WHERE built < 1915 AND building = "electric railway chambers" |
CREATE TABLE table_name_2 (
player VARCHAR,
position VARCHAR
) | What players have a position of F? | SELECT player FROM table_name_2 WHERE position = "f" |
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 CloseAsOffTopicReasonTypes (
Id number,
... | Find Questions with one tag and specific answer text. | SELECT P.Id AS "post_link", P.Tags FROM Posts AS P, PostTags AS Pt, Tags AS T WHERE P.Id = Pt.PostId AND T.Id = Pt.TagId AND T.TagName = '##tag1##' AND P.PostTypeId = 1 AND P.AnswerCount > 0 AND NOT P.AcceptedAnswerId IS NULL AND NOT (SELECT P2.Id FROM Posts AS P2 WHERE P2.Id = P.AcceptedAnswerId AND P2.Body LIKE '%##t... |
CREATE TABLE table_59909 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | Who was the away team against Newton Heath? | SELECT "Away team" FROM table_59909 WHERE "Home team" = 'newton heath' |
CREATE TABLE table_56197 (
"Outcome" text,
"Date" real,
"Championship" text,
"Surface" text,
"Opponent" text,
"Score" text
) | On what Date was the Score of 3 6, 6 4, 3 6, 6 1, 6 2 | SELECT SUM("Date") FROM table_56197 WHERE "Score" = '3–6, 6–4, 3–6, 6–1, 6–2' |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime t... | what's the number of hours that have passed since patient 013-38992 first stayed in ward 561 during this hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '013-38992' AND patient.wardid = 561 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
CREATE TABLE table_79341 (
"Rank" real,
"Group" text,
"Athlete" text,
"Nationality" text,
"Result" real
) | Which athlete, has an 18.55 result | SELECT "Athlete" FROM table_79341 WHERE "Result" = '18.55' |
CREATE TABLE table_71693 (
"Year" real,
"Class" text,
"Vehicle" text,
"Position" text,
"Stages won" text
) | What position did the BMW vehicle made in 2006 hold? | SELECT "Position" FROM table_71693 WHERE "Vehicle" = 'bmw' AND "Year" = '2006' |
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Courses (
course_id INTEGER,
author_... | Return a bar chart about the distribution of personal_name and author_id . | SELECT personal_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
... | what are the flights from DALLAS to BOSTON for tomorrow night or evening | 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 ((((flight.departure_time BETWEEN 1800 AND 2200) OR (NOT flight.departure_time BETWEEN 601 AND 1759)) AND date_day.day_number = 20 AND date_day.m... |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
... | find the number of patients who were admitted to the hospital in the last year. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
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
) | For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the sum of price , and group by attribute name, and rank by the y axis from low to high. | SELECT T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Price |
CREATE TABLE table_name_82 (
new_council VARCHAR,
previous_council VARCHAR,
staying_councillors VARCHAR
) | What is the full number of New Council when the previous council was 54 and the staying councilor number is bigger than 36? | SELECT COUNT(new_council) FROM table_name_82 WHERE previous_council = 54 AND staying_councillors > 36 |
CREATE TABLE table_name_35 (
date VARCHAR,
attendance VARCHAR
) | On what date was the crowd size of 71,789? | SELECT date FROM table_name_35 WHERE attendance = "71,789" |
CREATE TABLE table_16388439_3 (
date VARCHAR,
home_team VARCHAR,
ground VARCHAR
) | Name the date for adelaide for westpac stadium | SELECT date FROM table_16388439_3 WHERE home_team = "Adelaide" AND ground = "Westpac Stadium" |
CREATE TABLE table_974 (
"Quarter" text,
"Android" text,
"iOS" text,
"Symbian" text,
"BlackBerry OS" text,
"Linux" text,
"Windows Phone" text,
"Other" text,
"Total" text
) | How many total smartphones were shipped during the quarter 2012 Q1? | SELECT COUNT("Total") FROM table_974 WHERE "Quarter" = '2012 Q1' |
CREATE TABLE table_20174050_1 (
release_date VARCHAR,
target__number VARCHAR
) | When was the audio book with target number 069 69 released? | SELECT release_date FROM table_20174050_1 WHERE target__number = "069 69" |
CREATE TABLE table_204_643 (
id number,
"release" number,
"artist" text,
"title" text,
"notes" text,
"album" text
) | what song was this artist on after utabito ? | SELECT "title" FROM table_204_643 WHERE "release" > (SELECT "release" FROM table_204_643 WHERE "title" = 'utabito (歌人 singer?)') ORDER BY "release" LIMIT 1 |
CREATE TABLE table_204_771 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | name the nations that won at least 2 gold medals . | SELECT "nation" FROM table_204_771 WHERE "gold" >= 2 |
CREATE TABLE table_7871 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What's the score on february 18 when the visitors are the montreal canadiens? | SELECT "Score" FROM table_7871 WHERE "Visitor" = 'montreal canadiens' AND "Date" = 'february 18' |
CREATE TABLE team (
Team_id int,
Name text
)
CREATE TABLE country (
Country_id int,
Country_name text,
Capital text,
Official_native_language text
)
CREATE TABLE player (
Player_ID int,
Player text,
Years_Played text,
Total_WL text,
Singles_WL text,
Doubles_WL text,
... | How many players are from each country. Show a pie chart. | SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name |
CREATE TABLE table_75469 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Save" text,
"Attendance" real,
"Record" text
) | What was the score of the game that had a loss of Chad Fox (3 3)? | SELECT "Score" FROM table_75469 WHERE "Loss" = 'chad fox (3–3)' |
CREATE TABLE table_14565 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | Which Record that has a Loss of mays (0-3)? | SELECT "Record" FROM table_14565 WHERE "Loss" = 'mays (0-3)' |
CREATE TABLE table_74944 (
"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
) | If points against was 371, what is the drawn? | SELECT "Drawn" FROM table_74944 WHERE "Points against" = '371' |
CREATE TABLE table_77741 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | When the home team was fitzroy, what did the away team score? | SELECT "Away team score" FROM table_77741 WHERE "Home team" = 'fitzroy' |
CREATE TABLE customers (
customer_id VARCHAR
)
CREATE TABLE orders (
customer_id VARCHAR,
order_status VARCHAR
) | Find the id of the customers who have order status both 'On Road' and 'Shipped'. | SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped" |
CREATE TABLE table_name_17 (
away_team VARCHAR,
home_team VARCHAR,
score VARCHAR
) | Can you tell me the Away team that has the Home team of south dragons, and the Score of 94-81? | SELECT away_team FROM table_name_17 WHERE home_team = "south dragons" AND score = "94-81" |
CREATE TABLE stadium (
id number,
name text,
home_games number,
average_attendance number,
total_attendance number,
capacity_percentage number
)
CREATE TABLE game (
stadium_id number,
id number,
season number,
date text,
home_team text,
away_team text,
score text,
... | In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'? | SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem' |
CREATE TABLE table_80153 (
"Year" text,
"Men's singles" text,
"Women's singles" text,
"Men's doubles" text,
"Women's doubles" text,
"Mixed doubles" text
) | Who won the Mixed doubles when Juliane Schenk won the Women's Singles? | SELECT "Mixed doubles" FROM table_80153 WHERE "Women's singles" = 'juliane schenk' |
CREATE TABLE table_train_130 (
"id" int,
"gender" string,
"systolic_blood_pressure_sbp" int,
"right_bundle_branch_block" bool,
"space_occupying_cerebral_lesion" bool,
"huntington_disease" bool,
"psychiatric_disease" bool,
"mental_illness" bool,
"treatment_regimen" bool,
"psychoti... | patients with controlled hypertension ( sitting diastolic bp < 95 mmhg and / or sitting systolic bp < 160 mmhg ) , right bundle branch block ( complete or partial ) , and pacemakers may be included in the study. | SELECT * FROM table_train_130 WHERE hypertension = 1 OR (diastolic_blood_pressure_dbp < 95 OR systolic_blood_pressure_sbp < 160) OR right_bundle_branch_block = 1 |
CREATE TABLE Ref_Document_Types (
document_type_code CHAR(15),
document_type_description VARCHAR(255)
)
CREATE TABLE Ref_Shipping_Agents (
shipping_agent_code CHAR(15),
shipping_agent_name VARCHAR(255),
shipping_agent_description VARCHAR(255)
)
CREATE TABLE Circulation_History (
document_id IN... | List the number of documents for each receipt date and bin by weekday in a bar chart, I want to list in ascending by the total number please. | SELECT receipt_date, COUNT(receipt_date) FROM Documents ORDER BY COUNT(receipt_date) |
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER... | Bar graph to show the total number from different allergytype, and order by the x axis from high to low. | SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType DESC |
CREATE TABLE table_39380 (
"Year" real,
"English title" text,
"Original title" text,
"Country" text,
"Director" text
) | Original title of das leben der anderen had what director? | SELECT "Director" FROM table_39380 WHERE "Original title" = 'das leben der anderen' |
CREATE TABLE table_name_81 (
goals INTEGER,
apps VARCHAR,
team VARCHAR,
season VARCHAR
) | What is the average Goals for team Kairat, in the 2002 season with more than 29 apps? | SELECT AVG(goals) FROM table_name_81 WHERE team = "kairat" AND season = "2002" AND apps > 29 |
CREATE TABLE table_name_55 (
total_apps VARCHAR,
league_cup_apps VARCHAR,
position VARCHAR
) | What is the Total Apps when League Cup Apps is 0 (1), and position is df? | SELECT total_apps FROM table_name_55 WHERE league_cup_apps = "0 (1)" AND position = "df" |
CREATE TABLE table_40871 (
"Round" real,
"Pick" real,
"Player" text,
"Position" text,
"School" text
) | What school did draft pick from round 3 go to? | SELECT "School" FROM table_40871 WHERE "Round" = '3' |
CREATE TABLE table_44803 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | What is Score, when Date is 10 July 2011? | SELECT "Score" FROM table_44803 WHERE "Date" = '10 july 2011' |
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
)
CRE... | Good Question Without Good Answer: High Question / Top Answer Score Ratio. Divide the question score by the score of the top answer and sort in decreasing order.
Shows questions for which no good solution exist: most of those are either good feature requests or mathematical impossibilities. | SELECT q.Id AS "post_link", q.Score AS "Question Score", MAX(a.Score) AS "Top Answer Score", CAST(q.Score AS FLOAT) / CAST(CASE WHEN MAX(a.Score) = 0 THEN 1 ELSE MAX(a.Score) END AS FLOAT) AS Ratio FROM Posts AS q INNER JOIN Posts AS a ON q.PostTypeId = 1 AND a.ParentId = q.Id GROUP BY q.Id, q.Score ORDER BY Ratio DESC... |
CREATE TABLE table_203_790 (
id number,
"week" number,
"date" text,
"opponent" text,
"result" text,
"attendance" number
) | was attendance higher week 4 or week 8 ? | SELECT "week" FROM table_203_790 WHERE "week" IN (4, 8) ORDER BY "attendance" DESC LIMIT 1 |
CREATE TABLE table_name_50 (
nation VARCHAR,
name VARCHAR
) | What country did Chris Witty represent? | SELECT nation FROM table_name_50 WHERE name = "chris witty" |
CREATE TABLE table_name_9 (
venue VARCHAR,
competition VARCHAR
) | What venue was the 2000 AFC Asian Cup qualification held at? | SELECT venue FROM table_name_9 WHERE competition = "2000 afc asian cup qualification" |
CREATE TABLE table_name_94 (
finish VARCHAR,
player VARCHAR
) | Name the finish for lee janzen | SELECT finish FROM table_name_94 WHERE player = "lee janzen" |
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
)
C... | count the number of patients whose death status is 0 and procedure icd9 code is 3512? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "3512" |
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 prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time... | count the number of patients who underwent therapeu plasmapheresis two or more times in a year before. | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'therapeu plasmapheres... |
CREATE TABLE repair_assignment (
technician_id int,
repair_ID int,
Machine_ID int
)
CREATE TABLE machine (
Machine_ID int,
Making_Year int,
Class text,
Team text,
Machine_series text,
value_points real,
quality_rank int
)
CREATE TABLE technician (
technician_id real,
Na... | Display a bar chart for what are the names of the technicians and how many machines are they assigned to repair?, and could you rank in ascending by the X-axis? | SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name ORDER BY Name |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
... | For those employees who did not have any job in the past, show me about the distribution of job_id and the amount of job_id , and group by attribute job_id in a bar chart. | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID |
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 n... | Closed questions with reasons, sorted by date. | SELECT p.Id AS "post_link", ph.CreationDate AS "closure_date", ph.Comment AS "close_reason", ph.Text AS Voters FROM PostHistory AS ph INNER JOIN Posts AS p ON p.Id = ph.PostId WHERE ph.PostHistoryTypeId = 10 ORDER BY ph.CreationDate DESC |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLOYE... | 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, give me the comparison about the sum of manager_id over the job_id , and group by attribute job_id by a bar chart, and list total number from low to high order please. | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) |
CREATE TABLE table_name_24 (
attendance VARCHAR,
away_team VARCHAR
) | WHAT IS THE ATTENDANCE WITH A READING AWAY TEAM? | SELECT attendance FROM table_name_24 WHERE away_team = "reading" |
CREATE TABLE table_48398 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalog" text
) | When did the United Kingdom format a stereo LP? | SELECT "Date" FROM table_48398 WHERE "Region" = 'united kingdom' AND "Format" = 'stereo lp' |
CREATE TABLE table_18159601_1 (
status VARCHAR,
city VARCHAR
) | what is the status in vestal | SELECT status FROM table_18159601_1 WHERE city = "Vestal" |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CRE... | whats the difference in the systemicmean of patient 017-88691 last measured on the current intensive care unit visit compared to the value second to last measured on the current intensive care unit visit? | SELECT (SELECT vitalperiodic.systemicmean FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-88691') AND patient.unitdischargetime IS N... |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | count the number of patients whose admission year is less than 2156 and procedure long title is laryngoscopy and other tracheoscopy? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2156" AND procedures.long_title = "Laryngoscopy and other tracheoscopy" |
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
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
)
... | Give me the comparison about the sum of meter_100 over the meter_200 , and group by attribute meter_200, and could you list x-axis from high to low order? | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
CREATE TABLE table_45035 (
"Heat" real,
"Lane" real,
"Name" text,
"Country" text,
"Mark" text
) | When the lane is under 2 and the name is virgen benavides with a mark of 7.29, what's the total number of Heat found? | SELECT COUNT("Heat") FROM table_45035 WHERE "Mark" = '7.29' AND "Name" = 'virgen benavides' AND "Lane" < '2' |
CREATE TABLE table_14849 (
"Name" text,
"Code" text,
"Capacity" text,
"Power" text,
"Acceleration 0\u2013100km/h" text,
"Top speed" text,
"Combined consumption" text
) | what is the capacity when the code is d4f bi-fuel 732? | SELECT "Capacity" FROM table_14849 WHERE "Code" = 'd4f bi-fuel 732' |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
... | Where do Stack Overflow users come from?. | SELECT u.Location, u.Id, u.Reputation FROM Users AS u WHERE u.Location = 'Cheyenne, WY' |
CREATE TABLE table_11174 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | What is the Date with a Result of 8 2, and a Score with 6 2? | SELECT "Date" FROM table_11174 WHERE "Result" = '8–2' AND "Score" = '6–2' |
CREATE TABLE table_204_668 (
id number,
"#" number,
"menteri besar" text,
"took office" text,
"left office" text,
"party" text
) | what was the date the last person on the list left office ? | SELECT "left office" FROM table_204_668 ORDER BY id DESC LIMIT 1 |
CREATE TABLE table_28578 (
"Athlete" text,
"Event" text,
"Round of 32" text,
"Round of 16" text,
"Quarterfinals" text,
"Semifinals" text
) | How many times was lakpa tashi sherpa ( bhu ) w pts 12-5 in round of 32? | SELECT COUNT("Round of 16") FROM table_28578 WHERE "Round of 32" = 'Lakpa Tashi Sherpa ( BHU ) W PTS 12-5' |
CREATE TABLE table_204_975 (
id number,
"year" number,
"competition" text,
"location" text,
"event" text,
"final-rank" text,
"final-score" number,
"qualifying rank" number,
"qualifying score" number
) | which competition took place in 2008 but had only one event ? | SELECT "competition" FROM table_204_975 GROUP BY "competition" HAVING COUNT("event") = 1 |
CREATE TABLE table_75507 (
"Season" text,
"Competition" text,
"Round" text,
"Club" text,
"Home result" text,
"Away result" text
) | Away result of 0 3, and a Season of 1969-70 is what competition? | SELECT "Competition" FROM table_75507 WHERE "Away result" = '0–3' AND "Season" = '1969-70' |
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 te... | out of total number of patients who had a lab test for total protein in urine, how many of them belonged to christian scientist belief? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND lab.label = "Total Protein, Urine" |
CREATE TABLE table_203_450 (
id number,
"team" text,
"outgoing manager" text,
"manner of departure" text,
"date of vacancy" text,
"replaced by" text,
"date of appointment" text,
"position in table" text
) | how many teams had a manner of departure due to there contract being terminated ? | SELECT COUNT("team") FROM table_203_450 WHERE "manner of departure" = 'contract terminated' |
CREATE TABLE Student (
age INTEGER
) | Show the minimum, average, and maximum age of all students. | SELECT MIN(age), AVG(age), MAX(age) FROM Student |
CREATE TABLE table_17783 (
"Day" text,
"Sunday Surya (the Sun)" text,
"Monday Soma (the Moon)" text,
"Tuesday Mangala (Mars)" text,
"Wednesday Budha (Mercury)" text,
"Thursday Guru (Jupiter)" text,
"Friday Shukra (Venus)" text,
"Saturday Shani (Saturn)" text
) | In the system where Sunday is ny yitru kizhamai, what is Saturday? | SELECT "Saturday Shani (Saturn)" FROM table_17783 WHERE "Sunday Surya (the Sun)" = 'ஞாயிற்று கிழமை Nyāyitru kizhamai' |
CREATE TABLE table_name_13 (
gold INTEGER,
rank VARCHAR,
silver VARCHAR
) | What is the average number of golds for teams in rank 17 with more than 4 silver? | SELECT AVG(gold) FROM table_name_13 WHERE rank = "17" AND silver > 4 |
CREATE TABLE table_name_30 (
pick INTEGER,
player VARCHAR,
round VARCHAR
) | What was the highest Pick for Lonnie Brockman before round 9? | SELECT MAX(pick) FROM table_name_30 WHERE player = "lonnie brockman" AND round < 9 |
CREATE TABLE table_42627 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Difference" text
) | How many average plays have points greater than 14, with an against greater than 17? | SELECT AVG("Played") FROM table_42627 WHERE "Points" > '14' AND "Against" > '17' |
CREATE TABLE race (
race_id number,
name text,
class text,
date text,
track_id text
)
CREATE TABLE track (
track_id number,
name text,
location text,
seating number,
year_opened number
) | What are distinct locations where tracks are located? | SELECT DISTINCT location FROM track |
CREATE TABLE table_57043 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | What was the attendance at the Red Sox game that had a loss of Wakefield (7 10)? | SELECT "Attendance" FROM table_57043 WHERE "Loss" = 'wakefield (7–10)' |
CREATE TABLE table_26633 (
"Name" text,
"Deceased Spouse" text,
"Cause of Death" text,
"Date of Spouses Death" text,
"Length of Marriage" text,
"Children Together" text,
"Current Marital Status" text
) | Who was the deceased spouse who was married for 4 years? | SELECT "Deceased Spouse" FROM table_26633 WHERE "Length of Marriage" = '4 years' |
CREATE TABLE degrees (
year number,
campus number,
degrees number
)
CREATE TABLE discipline_enrollments (
campus number,
discipline number,
year number,
undergraduate number,
graduate number
)
CREATE TABLE enrollments (
campus number,
year number,
totalenrollment_ay number,... | What are the campuses that opened in 1958? | SELECT campus FROM campuses WHERE year = 1958 |
CREATE TABLE table_1601792_4 (
site VARCHAR,
television_station VARCHAR
) | What site(s) for tv station tv3? | SELECT site FROM table_1601792_4 WHERE television_station = "TV3" |
CREATE TABLE table_name_30 (
name VARCHAR,
year VARCHAR
) | What actor made a film in 1957? | SELECT name FROM table_name_30 WHERE year = "1957" |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Return a pie chart about the proportion of All_Home and the sum of School_ID. | SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home |
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
sc... | Is there a professor assigned to teach Other classes next Winter ? | SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr... |
CREATE TABLE checking (
custid number,
balance number
)
CREATE TABLE savings (
custid number,
balance number
)
CREATE TABLE accounts (
custid number,
name text
) | What is the total balance of savings accounts not belonging to someone with the name Brown? | SELECT SUM(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name <> 'Brown' |
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Faculty_Participates_in (
Fac... | Show the number of faculty for each rank in a bar chart. | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank |
CREATE TABLE table_name_83 (
crowd INTEGER,
away_team VARCHAR
) | What was the smallest crowd for a Melbourne away game? | SELECT MIN(crowd) FROM table_name_83 WHERE away_team = "melbourne" |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname var... | What classes does Prof. Ej Westlake teach in Spring 2005 ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Ej Westlake%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offer... |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid numb... | when did patient 017-49375 had the first intake on 04/14/this year? | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-49375')) AND intakeoutput.cellpath LIKE '%intake%... |
CREATE TABLE table_26041144_16 (
catches INTEGER,
player VARCHAR
) | If the player is Hashan Tillakaratne, what is the catches minimum? | SELECT MIN(catches) FROM table_26041144_16 WHERE player = "Hashan Tillakaratne" |
CREATE TABLE table_50160 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
) | What is the Outcome of the match with Partner Andoni Vivanco? | SELECT "Outcome" FROM table_50160 WHERE "Partner" = 'andoni vivanco' |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number... | Count of questions, comments, answers with tag over time. | SELECT DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS "week", COUNT(DISTINCT Posts.Id) AS Posts, COUNT(Posts.AcceptedAnswerId) * 100 / COUNT(DISTINCT Posts.Id) AS PercentWithAcceptedAnswer, SUM(Posts.AnswerCount) AS Answers, SUM(Posts.CommentCount) AS Comments FROM Posts INNER JOIN PostTags O... |
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,... | i need ground transportation in SEATTLE | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'SEATTLE' AND ground_service.city_code = city.city_code |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Tags (
Id number,
TagName text,
C... | posts closed in sep, oct, or nov, with reasons. | SELECT YEAR(Posts.ClosedDate) AS y, MONTH(Posts.ClosedDate) AS m, CAST(YEAR(Posts.ClosedDate) AS TEXT(10)) + '/' + CAST(MONTH(Posts.ClosedDate) AS TEXT(19)) AS ym, COUNT(CONCAT('http://programmers.stackexchange.com/q/', Posts.Id)) AS Questions FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE Posts.Clo... |
CREATE TABLE table_19516 (
"No." real,
"Station Code" text,
"Station" text,
"Arrival" text,
"Departure" text,
"Kilometers" real,
"Day" real
) | what is the arrival time where the station code is awy? | SELECT "Arrival" FROM table_19516 WHERE "Station Code" = 'AWY' |
CREATE TABLE table_name_68 (
silver INTEGER,
rank VARCHAR,
total VARCHAR
) | What is the lowest number of silver medals with a rank of 4 and total medals greater than 1? | SELECT MIN(silver) FROM table_name_68 WHERE rank = 4 AND total > 1 |
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 t... | count the number of patients whose age is less than 43 and lab test name is epithelial cells? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "43" AND lab.label = "Epithelial Cells" |
CREATE TABLE table_204_346 (
id number,
"#" number,
"date" text,
"venue" text,
"opponent" text,
"result" text,
"competition" text,
"scored" number
) | what is the number of goals scored in the algarve cup on march 5 , 2002 ? | SELECT "scored" FROM table_204_346 WHERE "date" = '5 march 2002' |
CREATE TABLE table_64946 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" text,
"Finish" text
) | Who won in 1988 with a total less than 287? | SELECT "Player" FROM table_64946 WHERE "Total" < '287' AND "Year(s) won" = '1988' |
CREATE TABLE table_29439 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (millions)" text
) | what is the title of the episode with production code '2arg09'? | SELECT "Title" FROM table_29439 WHERE "Production code" = '2ARG09' |
CREATE TABLE table_203_798 (
id number,
"party" text,
"votes" text,
"%" number,
"swing" number,
"seats" number,
"change" number
) | what party had the least number of seats ? | SELECT "party" FROM table_203_798 ORDER BY "seats" LIMIT 1 |
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE comment_instructor (
instructor_id int,
... | What are the classes offered for Other next Winter ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_cour... |
CREATE TABLE table_28037619_2 (
written_by VARCHAR,
us_viewers__million_ VARCHAR
) | How many people wrote the episode that had 7.26 million u.s. viewers? | SELECT COUNT(written_by) FROM table_28037619_2 WHERE us_viewers__million_ = "7.26" |
CREATE TABLE table_78424 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the largest number of laps with a Grid larger than 14, a Time/Retired of + 2 laps, and a Driver of helmut marko? | SELECT MAX("Laps") FROM table_78424 WHERE "Grid" > '14' AND "Time/Retired" = '+ 2 laps' AND "Driver" = 'helmut marko' |
CREATE TABLE album (
albumid number,
title text,
artistid number
)
CREATE TABLE playlisttrack (
playlistid number,
trackid number
)
CREATE TABLE genre (
genreid number,
name text
)
CREATE TABLE artist (
artistid number,
name text
)
CREATE TABLE invoiceline (
invoicelineid num... | What are all the album titles, in alphabetical order? | SELECT title FROM album ORDER BY title |
CREATE TABLE table_55954 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | Where attendance is 79,431 what is date? | SELECT "Date" FROM table_55954 WHERE "Attendance" = '79,431' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.