table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE table_6085 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the date of the game when St. Louis was the home team?
SELECT "Date" FROM table_6085 WHERE "Home" = 'st. louis'
CREATE TABLE table_25479607_3 ( fixed_charge___rs__kwh_ VARCHAR, unit__kwh__time_range VARCHAR )
What is the fixed charge for the user with a unit/time range of i-2: peak (18:30-22:30)?
SELECT fixed_charge___rs__kwh_ FROM table_25479607_3 WHERE unit__kwh__time_range = "I-2: Peak (18:30-22:30)"
CREATE TABLE table_78906 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
What is the average total in 1969?
SELECT AVG("Total") FROM table_78906 WHERE "Year(s) won" = '1969'
CREATE TABLE table_11677691_4 ( school VARCHAR, hometown VARCHAR )
How many players' hometown was Akron, Ohio?
SELECT COUNT(school) FROM table_11677691_4 WHERE hometown = "Akron, Ohio"
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
when did patient 005-12192 first receive a prescription for calcium gluconate 100 mg/ml (10 %) iv : 10 ml?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-12192')) AND medication.drugname = 'calcium gluconate 100 ...
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(2...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of last_name and salary .
SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
CREATE TABLE table_16771 ( "Race Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Constructor" text, "Report" text )
Who won the Modena circuit?
SELECT "Winning driver" FROM table_16771 WHERE "Circuit" = 'Modena'
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description...
Users by badges by badge category?.
WITH linqbadges AS (SELECT RANK() OVER (PARTITION BY b.UserId ORDER BY b.Date) AS rn, b.UserId, b.Date, b.Name FROM Badges AS b WHERE b.Name = 'Necromancer') SELECT u.DisplayName, linqbadges.Date AS date_earned, CASE rn WHEN 1 THEN 'bronze linq' WHEN 2 THEN 'silver linq' WHEN 3 THEN 'gold linq' END AS badge, linqbadges...
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 record ( ID int, Result text, Swimmer_ID int, Event_ID int ) ...
Show me about the distribution of meter_300 and ID in a bar chart, could you show by the Y-axis in asc?
SELECT meter_300, ID FROM swimmer ORDER BY ID
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Show me the comparison of the total number of all ships' nationalities with a bar graph, and I want to sort in desc by the x axis.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Nationality ORDER BY Nationality DESC
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
when was the last time on this hospital visit that patient 007-849 was prescribed medication?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-849' AND patient.hospitaldischargetime IS NULL)) ORDER BY ...
CREATE TABLE table_10728 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What college did hunter henry go to?
SELECT "College" FROM table_10728 WHERE "Player" = 'hunter henry'
CREATE TABLE table_name_52 ( record VARCHAR, opponent VARCHAR )
What is the team's record in games against the Hartford Whalers?
SELECT record FROM table_name_52 WHERE opponent = "hartford whalers"
CREATE TABLE table_204_144 ( id number, "represent" number, "contestant" text, "age" number, "height" text, "hometown" text )
name each contestant whose age is 21 ?
SELECT "contestant" FROM table_204_144 WHERE "age" = 21
CREATE TABLE operate_company ( id number, name text, type text, principal_activities text, incorporated_in text, group_equity_shareholding number ) CREATE TABLE airport ( id number, city text, country text, iata text, icao text, name text ) CREATE TABLE flight ( id ...
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'
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...
provide the number of patients whose drug code is warf1 and lab test fluid is pleural.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "WARF1" AND lab.fluid = "Pleural"
CREATE TABLE table_204_649 ( id number, "rank" number, "name" text, "image" number, "height\nft (m)" text, "floors" number, "year" number, "notes" text )
what is the difference in height between key tower and 55 public square
SELECT ABS((SELECT "height\nft (m)" FROM table_204_649 WHERE "name" = 'key tower') - (SELECT "height\nft (m)" FROM table_204_649 WHERE "name" = '55 public square'))
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREAT...
what times does the late afternoon flight leave from WASHINGTON for DENVER
SELECT DISTINCT flight.departure_time 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 = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name ...
CREATE TABLE table_71139 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Event" text )
What tournament was after 2009?
SELECT "Tournament" FROM table_71139 WHERE "Year" > '2009'
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE offering_i...
Will the NURS 556 course be offered in Spring-Summer 2002 ?
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NURS' AND course.number = 556 AND semester.semester = 'Spring-Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2002
CREATE TABLE table_18946749_1 ( prominence__m_ INTEGER, peak VARCHAR )
When mount gauttier is the peak what is the highest prominence in meters?
SELECT MAX(prominence__m_) FROM table_18946749_1 WHERE peak = "Mount Gauttier"
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...
how many patients staying in the hospital for more than 20 days had the procedure under icd9 code 9907?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "20" AND procedures.icd9_code = "9907"
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the maximum hospital cost that involves a procedure known as a esophagogastroduodenoscopy in 2105?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'esophagogastroduodenoscopy')) AND STRFTIME('...
CREATE TABLE table_name_3 ( overall VARCHAR, name VARCHAR, round VARCHAR )
Name of calvin o'neal, and a Round smaller than 6 had what number total overall?
SELECT COUNT(overall) FROM table_name_3 WHERE name = "calvin o'neal" AND round < 6
CREATE TABLE table_name_18 ( common_name VARCHAR, color VARCHAR )
What is the common name for the creature with darker colors?
SELECT common_name FROM table_name_18 WHERE color = "darker colors"
CREATE TABLE table_22048 ( "Team" text, "Average" text, "Points" real, "Played" real, "1988-89" text, "1989-90" text, "1990-1991" real )
What was the team that scored 122 points?
SELECT "Team" FROM table_22048 WHERE "Points" = '122'
CREATE TABLE table_2803106_1 ( dance_song VARCHAR, total VARCHAR )
What dance had a score total of 31?
SELECT dance_song FROM table_2803106_1 WHERE total = "31"
CREATE TABLE table_38958 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
Which Extra points is the lowest one that has a Player of ross kidston, and Points smaller than 5?
SELECT MIN("Extra points") FROM table_38958 WHERE "Player" = 'ross kidston' AND "Points" < '5'
CREATE TABLE table_10476 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
How many laps have a Time/Retired of +1:35.553?
SELECT COUNT("Laps") FROM table_10476 WHERE "Time/Retired" = '+1:35.553'
CREATE TABLE table_57991 ( "Player" text, "Car." real, "Yards" real, "Avg." real, "TD's" real, "Long" real )
How many yards did kevin swayne average, with a long carry over 7?
SELECT MIN("Avg.") FROM table_57991 WHERE "Player" = 'kevin swayne' AND "Long" > '7'
CREATE TABLE table_name_15 ( date VARCHAR, score VARCHAR )
What was the date of the game with a score of 15 6?
SELECT date FROM table_name_15 WHERE score = "15–6"
CREATE TABLE table_11239 ( "Date" text, "Visiting Team" text, "Final Score" text, "Host Team" text, "Stadium" text )
Who was the host team at Louisiana Superdome when the final score was 10-20?
SELECT "Host Team" FROM table_11239 WHERE "Stadium" = 'louisiana superdome' AND "Final Score" = '10-20'
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Descr...
Users with the Highest Score in a Tag with at Least X Answers.
SELECT ROW_NUMBER() OVER (ORDER BY Score DESC) AS Rank, Id AS "user_link", Score, 'count' AS TotalAnswers, Average FROM (SELECT u.Id, SUM(a.Score) AS Score, COUNT(a.Score) AS "Count", AVG(a.Score) AS Average FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER J...
CREATE TABLE table_name_57 ( blank_ends VARCHAR, shot_pct VARCHAR, stolen_ends VARCHAR, skip VARCHAR )
What is the number of blank ends when the stolen ends were 17 and Jennifer Jones was skipped with a more than 83 shot pct?
SELECT COUNT(blank_ends) FROM table_name_57 WHERE stolen_ends = 17 AND skip = "jennifer jones" AND shot_pct > 83
CREATE TABLE table_79865 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
Round larger than 6, and a Pick # smaller than 25, and a College of southern Illinois has what position?
SELECT "Position" FROM table_79865 WHERE "Round" > '6' AND "Pick #" < '25' AND "College" = 'southern illinois'
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TA...
Which classes are prerequisites for most other classes and available this semester ?
SELECT COUNT(DISTINCT course_prerequisite.course_id), course.department, course.name, course.number FROM course, course_offering, course_prerequisite, semester WHERE course.course_id = course_offering.course_id AND course.course_id = course_prerequisite.pre_course_id AND course.department = 'EECS' AND semester.semester...
CREATE TABLE table_name_56 ( Id VARCHAR )
What is the 2006 value with a 1r in 2011?
SELECT 2006 FROM table_name_56 WHERE 2011 = "1r"
CREATE TABLE table_name_18 ( result VARCHAR, opponent VARCHAR )
WHAT IS THE RESULT WHEN THE OPPONENT WAS CHICAGO BEARS?
SELECT result FROM table_name_18 WHERE opponent = "chicago bears"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
how many patients whose age is less than 77 and diagnoses long title is abscess of intestine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "77" AND diagnoses.long_title = "Abscess of intestine"
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, ...
Closed non-duplicate questions answered by a user.
SELECT q.Id AS "post_link", q.Score AS "question_score", a.Score AS "answer_score", q.AcceptedAnswerId AS "accepted_answer" FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE NOT q.ClosedDate IS NULL AND a.OwnerUserId = '##UserId##' AND q.Id NOT IN (SELECT PostId FROM PostLinks) ORDER BY q.ClosedDate DESC
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ...
My Profiles Across Stack Exchange.
SELECT * FROM sys.databases
CREATE TABLE table_30027 ( "Year" real, "Location" text, "Distance (miles)" real, "Rider Names" text, "Horse Name" text, "Best-Conditioned Horse" text )
How many different riders are there that won riding Omr Tsunami?
SELECT COUNT("Rider Names") FROM table_30027 WHERE "Horse Name" = 'OMR Tsunami'
CREATE TABLE table_train_248 ( "id" int, "anemia" bool, "prostate_specific_antigen_psa" float, "hemoglobin_a1c_hba1c" float, "body_weight" float, "fasting_triglycerides" int, "hyperlipidemia" bool, "hgb" int, "fasting_total_cholesterol" int, "fasting_ldl_cholesterol" int, "bo...
hyperlipidemia ( fasting total cholesterol > 240 mg / dl and / or fasting triglycerides > 200 mg / dl and / or fasting ldl cholesterol > 140 mg / dl ) ;
SELECT * FROM table_train_248 WHERE hyperlipidemia = 1 OR (fasting_total_cholesterol > 240 OR fasting_triglycerides > 200 OR fasting_ldl_cholesterol > 140)
CREATE TABLE table_name_24 ( round INTEGER, position VARCHAR, pick__number VARCHAR, overall VARCHAR )
What is the highest round with a pick# of 11, a position of offensive tackle, and overall less than 414?
SELECT MAX(round) FROM table_name_24 WHERE pick__number = 11 AND overall < 414 AND position = "offensive tackle"
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...
what is the total number of patients who had brain mass, intracranial hemorrhage as primary disease and had a lab test for ascites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND lab.fluid = "Ascites"
CREATE TABLE table_name_80 ( player VARCHAR, score VARCHAR )
What Player had a Score of 70-71=141?
SELECT player FROM table_name_80 WHERE score = 70 - 71 = 141
CREATE TABLE table_3072 ( "Country" text, "Skip" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real, "Shot %" text )
What ends lost came out to 37?
SELECT "Stolen Ends" FROM table_3072 WHERE "Ends Lost" = '37'
CREATE TABLE table_3141 ( "Week" real, "Date" text, "Kickoff" text, "Opponent" text, "Final score" text, "Team record" text, "Game site" text, "Attendance" real )
How many people attended the game at Jahn-sportpark?
SELECT MIN("Attendance") FROM table_3141 WHERE "Game site" = 'Jahn-Sportpark'
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Show me about the correlation between ACC_Percent and All_Games_Percent in a scatter chart.
SELECT ACC_Percent, All_Games_Percent FROM basketball_match
CREATE TABLE table_name_31 ( fat32 VARCHAR, ntfs VARCHAR )
Which FAT32 has yes v1.0/v1.1 for NTFS?
SELECT fat32 FROM table_name_31 WHERE ntfs = "yes v1.0/v1.1"
CREATE TABLE table_203_330 ( id number, "year of election" number, "candidates elected" number, "# of seats available" number, "# of votes" number, "% of popular vote" text )
how many more seats were available in 1975 than 1963 ?
SELECT (SELECT "# of seats available" FROM table_203_330 WHERE "year of election" = 1975) - (SELECT "# of seats available" FROM table_203_330 WHERE "year of election" = 1963)
CREATE TABLE table_8631 ( "Position" real, "Name" text, "Played" real, "Drawn" real, "Lost" real, "Points" real )
what is the sum of points when lost is less than 10, name is vfl denklingen and position is higher than 2?
SELECT SUM("Points") FROM table_8631 WHERE "Lost" < '10' AND "Name" = 'vfl denklingen' AND "Position" > '2'
CREATE TABLE table_7239 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Which venue held the Euro 2012 Qualifier?
SELECT "Venue" FROM table_7239 WHERE "Competition" = 'euro 2012 qualifier'
CREATE TABLE table_38655 ( "Discipline" text, "Peter" real, "Adam" real, "Jade" real, "Plat'num" real )
What is Adam's score when Peter's score is less than 3 and the plat'num is greater than 6?
SELECT MIN("Adam") FROM table_38655 WHERE "Peter" < '3' AND "Plat'num" > '6'
CREATE TABLE table_21800 ( "Scientific name" text, "Common name" text, "Length (male)" text, "Length (female)" text, "Color" text, "Lifespan (years)" text )
Name the number of color for furcifer pardalis
SELECT COUNT("Color") FROM table_21800 WHERE "Scientific name" = 'Furcifer pardalis'
CREATE TABLE table_23248940_10 ( high_assists VARCHAR, game VARCHAR )
How many people led in assists on game 71?
SELECT COUNT(high_assists) FROM table_23248940_10 WHERE game = 71
CREATE TABLE table_22785 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "U.S. air date" text, "Production code" text, "U.S. viewers (million)" text )
When 3t7461 is the production code who is the director?
SELECT "Directed by" FROM table_22785 WHERE "Production code" = '3T7461'
CREATE TABLE table_204_670 ( id number, "week" number, "date" text, "opponent" text, "result" text, "record" text, "attendance" number )
what is the number of fans who attended the december 7 , 1969 game against the broncos ?
SELECT "attendance" FROM table_204_670 WHERE "date" = 'december 7, 1969'
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 demographic ...
on which date was the patient with patient id 74463 born?
SELECT demographic.dob FROM demographic WHERE demographic.subject_id = "74463"
CREATE TABLE table_203_41 ( id number, "name" text, "variant name(s)" text, "source" text, "source coordinates" text, "length" text, "mouth" text, "mouth coordinates" text )
which tributary has at least 3 variant names ?
SELECT "name" FROM table_203_41 WHERE "variant name(s)" >= 3
CREATE TABLE table_name_70 ( date VARCHAR, record VARCHAR )
Record of 92 70 had what date?
SELECT date FROM table_name_70 WHERE record = "92–70"
CREATE TABLE table_20928682_1 ( game INTEGER, opponent VARCHAR )
Which game number was played against Georgia?
SELECT MIN(game) FROM table_20928682_1 WHERE opponent = "Georgia"
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number...
Number of bounties with accepted answer depending on the day (time) when bounty started.
WITH tmp AS (SELECT p.Id, p.AcceptedAnswerId AS Acc, Period = CASE @Frequency WHEN 1 THEN TIME_TO_STR(bs.CreationDate, '%h') WHEN 2 THEN TIME_TO_STR(bs.CreationDate, '%W') WHEN 3 THEN ROUND((CAST(TIME_TO_STR(bs.CreationDate, '%W') AS FLOAT) + CAST(TIME_TO_STR(bs.CreationDate, '%h') AS FLOAT) / 24), 2) END FROM Posts AS...
CREATE TABLE table_name_47 ( date VARCHAR, opponent VARCHAR )
On what Date was the Opponent the Tennessee Titans?
SELECT date FROM table_name_47 WHERE opponent = "tennessee titans"
CREATE TABLE table_name_27 ( rank INTEGER, name VARCHAR )
What is the greatest rank for Fifth third center?
SELECT MAX(rank) FROM table_name_27 WHERE name = "fifth third center"
CREATE TABLE table_203_737 ( id number, "#" number, "employer" text, "# of employees" number )
what is the difference between the number of employees at mundelein elementary school district 75 and fremon school district 79 ?
SELECT ABS((SELECT "# of employees" FROM table_203_737 WHERE "employer" = 'mundelein elementary school district 75') - (SELECT "# of employees" FROM table_203_737 WHERE "employer" = 'fremont school district 79'))
CREATE TABLE table_43191 ( "Team" text, "Match" text, "Points" text, "Draw" text, "Lost" text )
What is the draw for a match that had 10 points?
SELECT "Draw" FROM table_43191 WHERE "Points" = '10'
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE admissions ( ro...
what were the top three most frequent diagnoses that patients were given within 2 months after being diagnosed with acidosis this year?
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...
CREATE TABLE table_70377 ( "Year" real, "Division" text, "League" text, "Regular Season" text, "Playoffs" text, "U.S. Open Cup" text, "Avg. Attendance" text )
Which regular season was 2013 in?
SELECT "Regular Season" FROM table_70377 WHERE "Year" = '2013'
CREATE TABLE table_63766 ( "Coaster Name" text, "Park" text, "Location" text, "Track" text, "Builder" text, "Year Opened" text )
What is the coaster name that was opened in 1978, and have wooden track?
SELECT "Coaster Name" FROM table_63766 WHERE "Year Opened" = '1978' AND "Track" = 'wooden'
CREATE TABLE table_61166 ( "Distance" text, "Event" text, "Time" text, "Meet" text, "Location" text )
What Meet has a Time of 1:04.84?
SELECT "Meet" FROM table_61166 WHERE "Time" = '1:04.84'
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what were the five most frequently ordered procedures for patients who had previously been given angiogram - with stenting during the same hospital encounter in 2105?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'angio...
CREATE TABLE table_name_97 ( office VARCHAR, greenback_ticket VARCHAR )
Which office was Richard M. Griffin vying for on the Greenback ticket?
SELECT office FROM table_name_97 WHERE greenback_ticket = "richard m. griffin"
CREATE TABLE airport ( id number, city text, country text, iata text, icao text, name text ) CREATE TABLE flight ( id number, vehicle_flight_number text, date text, pilot text, velocity number, altitude number, airport_id number, company_id number ) CREATE TABLE...
What are the names and types of the companies that have ever operated a flight?
SELECT T1.name, T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
CREATE TABLE table_train_21 ( "id" int, "pregnancy_or_lactation" bool, "severe_sepsis" bool, "systolic_blood_pressure_sbp" int, "active_infection" bool, "limited_care" bool, "septic_shock" bool, "coagulopathy" bool, "age" float, "lactate" int, "NOUSE" float )
patients greater than 18 years of age who present to the emergency department with the diagnosis of severe sepsis / septic shock.
SELECT * FROM table_train_21 WHERE age > 18 AND (severe_sepsis = 1 OR septic_shock = 1)
CREATE TABLE table_51569 ( "Season" text, "Champion" text, "Team" text, "Chassis" text, "Engine" text )
What was the winning car's chassis for the 1982 season?
SELECT "Chassis" FROM table_51569 WHERE "Season" = '1982'
CREATE TABLE table_9131 ( "Tournament" text, "Surface" text, "Week" text, "Winner" text, "Finalist" text, "Semifinalists" text )
Where was the tournament where monica seles was the finalist who played on a hard surface?
SELECT "Tournament" FROM table_9131 WHERE "Surface" = 'hard' AND "Finalist" = 'monica seles'
CREATE TABLE table_name_75 ( goals_against VARCHAR, minutes VARCHAR )
What is the goals against for the goalkeeper with 2520 minutes?
SELECT goals_against FROM table_name_75 WHERE minutes = 2520
CREATE TABLE table_66161 ( "Pick" real, "Player" text, "Team" text, "Position" text, "School" text )
What is John Curtice's position?
SELECT "Position" FROM table_66161 WHERE "Player" = 'john curtice'
CREATE TABLE table_35758 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "9:30" text, "10:00" text, "10:30" text )
What 9:00 has entertainment tonight as 7:00?
SELECT "9:00" FROM table_35758 WHERE "7:00" = 'entertainment tonight'
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, De...
Java questions from higher-rep users.
SELECT DISTINCT A.Id, A.CreationDate, C.Reputation FROM Posts AS A INNER JOIN PostTypes AS B ON A.PostTypeId = B.Id INNER JOIN Users AS C ON A.OwnerUserId = C.Id INNER JOIN PostTags AS D ON A.Id = D.PostId INNER JOIN Tags AS E ON D.TagId = E.Id WHERE A.CreationDate > DATEADD(week, DATEDIFF(week, 0, GETDATE()) - 1, -1) ...
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
how many patients who died in or before 2111 had undergone the lab test lactate dehydrogenase (ld)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" AND lab.label = "Lactate Dehydrogenase (LD)"
CREATE TABLE table_204_465 ( id number, "#" number, "temple name" text, "hangul" text, "hanja" text, "period of reign" text, "personal name" text, "relationship" text, "note" text )
who reigned longer , geunchogo or chaekgye ?
SELECT "temple name" FROM table_204_465 WHERE "temple name" IN ('geunchogo', 'chaekgye') ORDER BY "period of reign" - "period of reign" DESC LIMIT 1
CREATE TABLE table_name_88 ( venue VARCHAR, home_team VARCHAR )
Which venue has a Home team of south melbourne?
SELECT venue FROM table_name_88 WHERE home_team = "south melbourne"
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, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
Show all allergy types and the number of allergies in each type in a bar chart, and show in descending by the total number please.
SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY COUNT(*) DESC
CREATE TABLE table_57961 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalogue" text )
What format is catalogue WPCR13504 in?
SELECT "Format" FROM table_57961 WHERE "Catalogue" = 'wpcr13504'
CREATE TABLE Scientists ( SSN int, Name Char(30) ) CREATE TABLE Projects ( Code Char(4), Name Char(50), Hours int ) CREATE TABLE AssignedTo ( Scientist int, Project char(4) )
What is the name of the project that has a scientist assigned to it whose name contains 'Smith', and count them by a bar chart
SELECT T2.Name, COUNT(T2.Name) FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.Name
CREATE TABLE table_name_76 ( year INTEGER, departed_from VARCHAR )
From how many years did tampa, FL depart?
SELECT SUM(year) FROM table_name_76 WHERE departed_from = "tampa, fl"
CREATE TABLE people ( people_id number, name text, age number, height number, hometown text ) CREATE TABLE gymnast ( gymnast_id number, floor_exercise_points number, pommel_horse_points number, rings_points number, vault_points number, parallel_bars_points number, horizo...
List the names of gymnasts in ascending order by their heights.
SELECT T2.name FROM gymnast AS T1 JOIN people AS T2 ON T1.gymnast_id = T2.people_id ORDER BY T2.height
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 who have died in or before year 2148 with 3970 as the diagnosis icd9 code.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2148.0" AND diagnoses.icd9_code = "3970"
CREATE TABLE table_name_2 ( score VARCHAR, place VARCHAR )
How many scores have a Place of t5?
SELECT COUNT(score) FROM table_name_2 WHERE place = "t5"
CREATE TABLE region ( region_code VARCHAR, region_name VARCHAR )
Show all region code and region name sorted by the codes.
SELECT region_code, region_name FROM region ORDER BY region_code
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE cours...
Is there an exam for every upper-level class ?
SELECT COUNT(*) = 0 FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_exams = 'N' AND program_course.category LIKE '%ULCS%'
CREATE TABLE table_75349 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
What is the lowest number of field goals when the points were less than 5?
SELECT MIN("Field goals") FROM table_75349 WHERE "Points" < '5'
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE region ( Region_ID int, Region_name tex...
Give me a histogram for how many members are in each party?, display by the Y from low to high.
SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID ORDER BY COUNT(*)
CREATE TABLE table_76514 ( "Verb" text, "2 (VF)" text, "2 (F)" text, "3 (F)" text, "2/3 (P)" text )
What is the verb for Khola?
SELECT "3 (F)" FROM table_76514 WHERE "Verb" = 'khola'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
what are the changes in the value of pt of patient 007-10135 last measured on the first hospital visit compared to the second to last value measured on the first hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-10135' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
CREATE TABLE submission ( submission_id number, scores number, author text, college text ) CREATE TABLE workshop ( workshop_id number, date text, venue text, name text ) CREATE TABLE acceptance ( submission_id number, workshop_id number, result text )
What are the authors of submissions and their colleges?
SELECT author, college FROM submission
CREATE TABLE table_name_55 ( city VARCHAR, home_arena VARCHAR )
Which city includes Barclays Center?
SELECT city FROM table_name_55 WHERE home_arena = "barclays center"
CREATE TABLE table_name_95 ( rank INTEGER, province VARCHAR )
What is the average rank of the province alborz, which had more than 14526 in 1956?
SELECT AVG(rank) FROM table_name_95 WHERE province = "alborz" AND 1956 > 14526