table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_42010 ( "Member State" text, "Population in millions" real, "Population % of EU" text, "Area km 2" real, "Area % of EU" text, "Pop. density People/km 2" real )
What is the lowest area km2 of the member state of the Czech Republic and has a population in millions lesss than 10.3?
SELECT MIN("Area km 2") FROM table_42010 WHERE "Member State" = 'czech republic' AND "Population in millions" < '10.3'
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, s...
tell me the cost for the asbestosis diagnosis?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'asbestosis'))
CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( ...
Show the number of the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000, could you list from high to low by the Y?
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count > 100 OR amount_of_transaction > 1000 ORDER BY COUNT(date_of_transaction) DESC
CREATE TABLE table_33578 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the away team at the match where the crowd was larger than 30,000?
SELECT "Away team" FROM table_33578 WHERE "Crowd" > '30,000'
CREATE TABLE table_39396 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
What frequency has call sign w228bg?
SELECT "Frequency MHz" FROM table_39396 WHERE "Call sign" = 'w228bg'
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...
I 'm looking for courses worth 9 credits , which are they ?
SELECT DISTINCT name, number FROM course WHERE credits = 9 AND department = 'EECS'
CREATE TABLE table_65578 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Series" text )
What is the lowest game when the score is 102-104?
SELECT MIN("Game") FROM table_65578 WHERE "Score" = '102-104'
CREATE TABLE table_name_8 ( year INTEGER, venue VARCHAR, event VARCHAR, result VARCHAR )
What is earliest year that had a 50km event with a 2nd place result played in London, United Kingdom?
SELECT MIN(year) FROM table_name_8 WHERE event = "50km" AND result = "2nd" AND venue = "london, united kingdom"
CREATE TABLE table_name_32 ( location VARCHAR, res VARCHAR, method VARCHAR )
Where was the match held when the result was win, and tko as the method?
SELECT location FROM table_name_32 WHERE res = "win" AND method = "tko"
CREATE TABLE table_66028 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the hioghest amount of silver medals for a nation ranked higher than 19 and less than 2 gold medals?
SELECT MAX("Silver") FROM table_66028 WHERE "Rank" = '19' AND "Gold" < '2'
CREATE TABLE table_name_30 ( circuit VARCHAR, round INTEGER )
Which circuit had a round larger than 5?
SELECT circuit FROM table_name_30 WHERE round > 5
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id numb...
in the case of patients who received a contrast aortogram until 1 year ago, what were the three most frequent lab tests that followed within 2 months?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_i...
CREATE TABLE table_1520559_1 ( venue VARCHAR, champion VARCHAR )
At what venues did Lorena Ochoa win the championship?
SELECT venue FROM table_1520559_1 WHERE champion = "Lorena Ochoa"
CREATE TABLE table_52949 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What did the team score when playing at home in victoria park?
SELECT "Home team score" FROM table_52949 WHERE "Venue" = 'victoria park'
CREATE TABLE table_69682 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Name the least lane for lenny krayzelburg
SELECT MIN("Lane") FROM table_69682 WHERE "Name" = 'lenny krayzelburg'
CREATE TABLE table_48085 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Which Time has a Round larger than 2, and an Opponent of jesse brock?
SELECT "Time" FROM table_48085 WHERE "Round" > '2' AND "Opponent" = 'jesse brock'
CREATE TABLE table_name_27 ( club_province VARCHAR, caps VARCHAR, position VARCHAR )
What club/province does the prop player with over 45 caps play for?
SELECT club_province FROM table_name_27 WHERE caps > 45 AND position = "prop"
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...
how many patients whose gender is f and diagnoses short title is adv eff benzodiaz tranq?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Adv eff benzodiaz tranq"
CREATE TABLE table_68289 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Which place has horton smith as the player?
SELECT "Place" FROM table_68289 WHERE "Player" = 'horton smith'
CREATE TABLE table_204_109 ( id number, "district" text, "incumbent" text, "party" text, "first\nelected" text, "result" text, "candidates" text )
who was the next incumbent after john randolph ?
SELECT "incumbent" FROM table_204_109 WHERE id = (SELECT id FROM table_204_109 WHERE "incumbent" = 'john randolph') + 1
CREATE TABLE editor ( Age VARCHAR )
Please show the most common age of editors.
SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_7903 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text )
Who was the highest drafted player that attended college at Virginia?
SELECT MAX("Pick") FROM table_7903 WHERE "College" = 'virginia'
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, ...
find a flight on DL from PHILADELPHIA to SAN FRANCISCO
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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
CREATE TABLE table_name_18 ( total VARCHAR, silver VARCHAR, rank VARCHAR )
How many medals were won total for the country that won 1 silver and was ranked 2 or lower?
SELECT COUNT(total) FROM table_name_18 WHERE silver = 1 AND rank < 2
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE pat...
what are the four most commonly prescribed medications for patients that are also prescribed with propofol at the same time, until 2 years ago?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'propofol' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRE...
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, find name and code , and group by attribute founder, and visualize them by a bar chart, and show Y in descending order.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Code DESC
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid ...
what was the yearly maximum intake of misc. that patient 022-44805 had received?
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-44805')) AND intakeoutput.celllabel = 'misc....
CREATE TABLE table_name_98 ( points INTEGER, year VARCHAR, chassis VARCHAR )
What was the total amount of points in 1978 with a Chassis of arrows fa1?
SELECT SUM(points) FROM table_name_98 WHERE year = 1978 AND chassis = "arrows fa1"
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, show me about the distribution of headquarter and the amount of headquarter , and group by attribute headquarter in a bar chart, and I want to display x axis in descending order please.
SELECT Headquarter, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC
CREATE TABLE table_13613 ( "Model number" text, "sSpec number" text, "Frequency" text, "Turbo" text, "GPU frequency" text, "Cores" text, "L2 cache" text, "L3 cache" text, "I/O bus" text, "Mult." text, "Memory" text, "Voltage" text, "Socket" text, "Release date" te...
What is the voltage when there are 2 cores, turbo is 5/8 and the release date is September 2010?
SELECT "Voltage" FROM table_13613 WHERE "Cores" = '2' AND "Release date" = 'september 2010' AND "Turbo" = '5/8'
CREATE TABLE table_23992 ( "Round" real, "Pick #" real, "Player" text, "Position" text, "Height" text, "Weight" text, "College" text, "Status" text )
state the status of pick # 32
SELECT "Status" FROM table_23992 WHERE "Pick #" = '32'
CREATE TABLE table_13342 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" real, "Water (sqmi)" real, "Latitude" real, "Longitude" real, "GEO ID" real, "ANSI code" real )
what is the average water sqmi with a population (2010) more than 47 in the Brenna Township with Longitude less than -97.171507
SELECT AVG("Water (sqmi)") FROM table_13342 WHERE "Pop. (2010)" > '47' AND "Township" = 'brenna' AND "Longitude" < '-97.171507'
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, ...
how many patients whose admission type is elective and lab test name is lymphocytes, percent?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Lymphocytes, Percent"
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit te...
what are the top four common diagnoses of patients of age 30s until 3 years ago?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
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...
which patients have ou route of drug administration?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "OU"
CREATE TABLE table_41651 ( "Year" text, "Starts" real, "Cuts Made" real, "Wins" real, "Top 10" real, "Top 25" real, "Earnings (\u20ac)" real, "Money list rank" text )
What is the average number of starts when 11 cuts were made and the top 10 ranking is larger than 4?
SELECT AVG("Starts") FROM table_41651 WHERE "Cuts Made" = '11' AND "Top 10" > '4'
CREATE TABLE table_name_7 ( attendance VARCHAR, week VARCHAR )
What was the Attendance in Week 1?
SELECT attendance FROM table_name_7 WHERE week = 1
CREATE TABLE table_47294 ( "Year" real, "Date" text, "Winner" text, "Result" text, "Loser" text, "Location" text )
Who was the loser when the New York Giants were the winners on November 14?
SELECT "Loser" FROM table_47294 WHERE "Winner" = 'new york giants' AND "Date" = 'november 14'
CREATE TABLE table_25275 ( "Constituency" text, "Winner" text, "Party" text, "Margin" real, "Runner-up a" text, "Party a" text )
Name the most margin for nco party and p. ramachandran won
SELECT MAX("Margin") FROM table_25275 WHERE "Party" = 'NCO' AND "Winner" = 'P. Ramachandran'
CREATE TABLE complaints ( complaint_status_code VARCHAR )
Which complaint status has more than 3 records on file?
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING COUNT(*) > 3
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 prescriptions ( subject_id text, hadm_id...
how many inpatient hospital admission patients have prescription for gentamicin medication?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.drug = "Gentamicin"
CREATE TABLE table_54393 ( "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyres" text, "Driver" text, "Rounds" text )
I want the tyres for hans binder
SELECT "Tyres" FROM table_54393 WHERE "Driver" = 'hans binder'
CREATE TABLE table_name_71 ( nationality VARCHAR, goals VARCHAR )
What country is the player who scored 27 goals from?
SELECT nationality FROM table_name_71 WHERE goals = 27
CREATE TABLE table_name_84 ( team_name VARCHAR, schools VARCHAR )
What is the name of the team from cisne fairfield school?
SELECT team_name FROM table_name_84 WHERE schools = "cisne fairfield"
CREATE TABLE table_name_7 ( total VARCHAR, finish VARCHAR )
Name the total number of total with finish of t45
SELECT COUNT(total) FROM table_name_7 WHERE finish = "t45"
CREATE TABLE table_59419 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
Which player has a place of t2?
SELECT "Player" FROM table_59419 WHERE "Place" = 't2'
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare...
show me all TW flights please
SELECT DISTINCT flight_id FROM flight WHERE airline_code = 'TW'
CREATE TABLE table_11207040_6 ( team VARCHAR, outgoing_manager VARCHAR )
What teams does jim mcinally manage?
SELECT team FROM table_11207040_6 WHERE outgoing_manager = "Jim McInally"
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
tell me the name of the specimen test patient 031-3355 last got this month?
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND DATETIME(microlab.culturetakentime, 'start of month') ...
CREATE TABLE table_name_98 ( date VARCHAR, venue VARCHAR )
What date was the match at mcg played?
SELECT date FROM table_name_98 WHERE venue = "mcg"
CREATE TABLE table_1206114_2 ( netflow_version VARCHAR, vendor_and_type VARCHAR )
What is the netflow version when vendor and type is pc and servers?
SELECT netflow_version FROM table_1206114_2 WHERE vendor_and_type = "PC and Servers"
CREATE TABLE table_8508 ( "White" text, "Black" text, "Year" real, "Result" text, "Moves" real, "Tournament" text, "Opening" text )
What year had a black of Kramnik, opening of E05 Catalan Opening, moves greater than 38, and a result of ?
SELECT MAX("Year") FROM table_8508 WHERE "Result" = '½–½' AND "Black" = 'kramnik' AND "Opening" = 'e05 catalan opening' AND "Moves" > '38'
CREATE TABLE table_264 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" real )
What is the tournament of aug 29?
SELECT "Tournament" FROM table_264 WHERE "Date" = 'Aug 29'
CREATE TABLE table_9527 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
what is the to par when the place is 8?
SELECT "To par" FROM table_9527 WHERE "Place" = '8'
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE restriction ( ...
what is the earliest flight from MEMPHIS to CINCINNATI on 6 30
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 = 'CINCINNATI' AND date_day.day_number = 30 AND date_day.month_number = 6 A...
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 )
Return a bar chart showing the total number of ships' nationalities, and order Nationality in asc order.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Nationality ORDER BY Nationality
CREATE TABLE table_name_64 ( date VARCHAR, region VARCHAR, catalog VARCHAR )
On what date was the catalog cy-24623 for New Zealand?
SELECT date FROM table_name_64 WHERE region = "new zealand" AND catalog = "cy-24623"
CREATE TABLE table_name_30 ( total INTEGER, year_s__won VARCHAR )
Name the least total for 1978 years won
SELECT MIN(total) FROM table_name_30 WHERE year_s__won = "1978"
CREATE TABLE table_65295 ( "Rank" real, "Lane" real, "Athlete" text, "Nationality" text, "Time" real, "React" real )
What is the average react for a rank more than 8?
SELECT AVG("React") FROM table_65295 WHERE "Rank" > '8'
CREATE TABLE table_28023 ( "Episode #" text, "Original Air Date (UK)" text, "Episode Title" text, "Director" text, "Writer" text, "Cast" text )
What is the title of the episode that aired on 13 august 1981?
SELECT "Episode Title" FROM table_28023 WHERE "Original Air Date (UK)" = '13 August 1981'
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Tags ( Id number, TagName text, Cou...
Users with votes but no or few posts. Users with no questions
SELECT u.Id AS "user_link", COUNT(p.OwnerUserId) AS TotalPosts, u.UpVotes, u.DownVotes FROM Users AS u LEFT JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE p.Id IS NULL AND u.UpVotes + u.DownVotes > '##MinVotes##' GROUP BY u.Id, u.UpVotes, u.DownVotes ORDER BY COUNT(p.OwnerUserId), u.UpVotes DESC
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense...
Days between Question Asked and Answer Accepted.
SELECT p.Id AS "post_link", p.CreationDate AS QuestionAsked, p.AnswerCount AS NumberOfAnswers, v.CreationDate AS AnswerAccepted, DATEDIFF(day, p.CreationDate, CreationDate) AS DiffDate FROM Posts AS p INNER JOIN Posts AS a ON a.Id = p.AcceptedAnswerId INNER JOIN Votes AS v ON a.Id = v.PostId WHERE p.PostTypeId = 1 AND ...
CREATE TABLE table_72867 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Name the record for score of l 93 104 (ot)
SELECT "Record" FROM table_72867 WHERE "Score" = 'L 93–104 (OT)'
CREATE TABLE table_22282917_26 ( code_ VARCHAR, _location VARCHAR, launch_site_condition_owner VARCHAR )
What is every code and location where the launch site condition and owner is obliterated?
SELECT code_ & _location FROM table_22282917_26 WHERE launch_site_condition_owner = "Obliterated"
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, ...
Top 10 Tags Associated with Posts Created in 2017.
SELECT Tags, COUNT(DISTINCT Id) AS post_cnt FROM Posts WHERE YEAR(CreationDate) = '2017' GROUP BY Tags ORDER BY post_cnt DESC LIMIT 10
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
What is lab test abnormal status and lab test name of Roxana Weaver?
SELECT lab.flag, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Roxanna Weaver"
CREATE TABLE table_204_480 ( id number, "title" text, "alternate title(s)" text, "year" number, "manufacturer" text, "genre(s)" text, "max. players" number )
how many arcade games were released before 1979 ?
SELECT COUNT(*) FROM table_204_480 WHERE "year" < 1979
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
My unaccepted answers with non-zero probability of acceptance.
SELECT Q.Id AS "post_link" FROM Posts AS Q INNER JOIN Posts AS A ON (Q.Id = A.ParentId) INNER JOIN Users AS U ON (Q.OwnerUserId = U.Id) WHERE Q.PostTypeId = 1 AND A.PostTypeId = 2 AND A.OwnerUserId = @UserId AND Q.AcceptedAnswerId IS NULL AND Q.ClosedDate IS NULL AND NOT EXISTS(SELECT A2.Id FROM Posts AS A2 WHERE A2.Po...
CREATE TABLE table_name_33 ( class VARCHAR, quantity VARCHAR, gwr_nos VARCHAR )
Which class is smaller than 5 and the GWR is 1322 1323?
SELECT class FROM table_name_33 WHERE quantity < 5 AND gwr_nos = "1322–1323"
CREATE TABLE table_15193 ( "Name" text, "Race" text, "Current age" real, "Age at offense" real, "Years on death row" real, "Location of offense" text )
Who is the prisoner that is older than 45 and has served less than 22 years on death row?
SELECT "Name" FROM table_15193 WHERE "Current age" > '45' AND "Years on death row" < '22'
CREATE TABLE table_66155 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" real, "Water (sqmi)" real, "Latitude" real, "Longitude" real, "GEO ID" real, "ANSI code" real )
What's the total of Water (sqmi) with a Land (sqmi) of 35.918 and has a Longitude that is smaller than -97.115459?
SELECT SUM("Water (sqmi)") FROM table_66155 WHERE "Land ( sqmi )" = '35.918' AND "Longitude" < '-97.115459'
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Find Deletable Questions I voted to close.
SELECT DISTINCT Q.Id AS "post_link", A.CreationDate FROM Posts AS Q INNER JOIN PostHistory AS PH ON Q.Id = PH.PostId INNER JOIN Posts AS A ON Q.Id = A.ParentId WHERE PH.CreationDate <= DATEADD(d, -2, GETDATE()) AND PH.PostHistoryTypeId = 10 AND PH.UserId = @UserId AND NOT Q.ClosedDate IS NULL AND A.Score > 0
CREATE TABLE table_name_40 ( rank_points VARCHAR, event VARCHAR, score_points VARCHAR )
What Rank points has an Event of wc beijing, and Score points of 11?
SELECT rank_points FROM table_name_40 WHERE event = "wc beijing" AND score_points = "11"
CREATE TABLE table_26010 ( "Pos" real, "Constructor" text, "Chassis" text, "Starts" real, "Finishes" real, "Wins" real, "Podiums" real, "Stage wins" real, "Power stage wins" real, "Points" real )
What is the finishes maximum number?
SELECT MAX("Finishes") FROM table_26010
CREATE TABLE table_1601027_1 ( headphone_model VARCHAR, driver_matched_db VARCHAR, us_msrp VARCHAR )
Which headphone models have a driver-matched DB of 0.1 and a US MSRP of $49?
SELECT headphone_model FROM table_1601027_1 WHERE driver_matched_db = "0.1" AND us_msrp = "$49"
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_i...
what is the average daily number of people diagnosed with cv dis nec-deliver w p/p until 2102?
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cv dis nec-deliver w p/p') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2102' GROUP BY STRFTIME('%y...
CREATE TABLE diagnoses ( 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 procedures ( ...
what is days of hospital stay and procedure short title of subject id 813?
SELECT demographic.days_stay, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "813"
CREATE TABLE table_name_84 ( lane VARCHAR, react VARCHAR, rank VARCHAR )
What Lane has a 0.209 React entered with a Rank entry that is larger than 6?
SELECT lane FROM table_name_84 WHERE react > 0.209 AND rank > 6
CREATE TABLE table_20396 ( "N\u00b0" text, "Television service" text, "Country" text, "Language" text, "Content" text, "DAR" text, "HDTV" text, "PPV" text, "Package/Option" text )
What package offers cinema content and is n. 333?
SELECT "Package/Option" FROM table_20396 WHERE "Content" = 'cinema' AND "N\u00b0" = '333'
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additio...
Which upper level CS courses are offered next semester ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.catego...
CREATE TABLE table_203_767 ( id number, "season" text, "club" text, "league" text, "apps" number, "goals" number )
did ibricic score more or less goals in his 3 seasons with hajduk split when compared to his 4 seasons with nk zagreb ?
SELECT (SELECT SUM("goals") FROM table_203_767 WHERE "club" = 'hajduk split') > (SELECT SUM("goals") FROM table_203_767 WHERE "club" = 'nk zagreb')
CREATE TABLE table_name_15 ( callback_venue VARCHAR, audition_city VARCHAR )
What was the callback venue for the Phoenix, Arizona auditions?
SELECT callback_venue FROM table_name_15 WHERE audition_city = "phoenix, arizona"
CREATE TABLE Behavior_Incident ( incident_id INTEGER, incident_type_code VARCHAR(10), student_id INTEGER, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR(255), recommendations VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Ref_Incident_Type ( ...
A bar chart shows the distribution of date_address_from and the amount of date_address_from , and group by attribute other_details and bin date_address_from by time.
SELECT date_address_from, COUNT(date_address_from) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
CREATE TABLE table_72640 ( "Date" text, "Tournament" text, "Player" text, "Country" text, "Rounds" text, "Score" real, "To par" text, "Finish" text )
What players finished 2nd?
SELECT "Player" FROM table_72640 WHERE "Finish" = '2nd'
CREATE TABLE table_3358 ( "Total" real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Canadian air date" text, "UK air date" text, "Canadian Viewers (millions)" text )
If the UK air date is February 18, 2013, who was the episode written by?
SELECT "Written by" FROM table_3358 WHERE "UK air date" = 'February 18, 2013'
CREATE TABLE table_49851 ( "Date" text, "H/A/N" text, "Opponent" text, "Score" text, "Record" text )
Who did they play when the score was 95-118?
SELECT "Opponent" FROM table_49851 WHERE "Score" = '95-118'
CREATE TABLE table_42109 ( "Source" text, "Date" text, "Clinton" text, "Obama" text, "Undecided" text )
What kind of Obama that has a Source of rasmussen reports?
SELECT "Obama" FROM table_42109 WHERE "Source" = 'rasmussen reports'
CREATE TABLE table_44462 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the Player that has a To standard of 1, and a Score of 71-68-76=215?
SELECT "Player" FROM table_44462 WHERE "To par" = '–1' AND "Score" = '71-68-76=215'
CREATE TABLE table_78757 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Director" text, "Result" text )
What is the ceremony year when Ganito Kami Noon, Paano Kayo Ngayon was the original title?
SELECT "Year (Ceremony)" FROM table_78757 WHERE "Original title" = 'ganito kami noon, paano kayo ngayon'
CREATE TABLE complaints ( complaint_id number, product_id number, customer_id number, complaint_outcome_code text, complaint_status_code text, complaint_type_code text, date_complaint_raised time, date_complaint_closed time, staff_id number ) CREATE TABLE customers ( customer_id...
Return the city with the customer type code 'Good Credit Rating' that had the fewest customers.
SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY COUNT(*) LIMIT 1
CREATE TABLE table_7664 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What is the Format when Alfa records is the label, and there is a Catalog of alca-9016?
SELECT "Format" FROM table_7664 WHERE "Label" = 'alfa records' AND "Catalog" = 'alca-9016'
CREATE TABLE table_42850 ( "Year" real, "Chassis" text, "Engine" text, "Start" real, "Finish" real, "Entrant" text )
What start has a ford cosworth dfx as the engine, a year later than 1981, and kraco enterprises as the entrant?
SELECT "Start" FROM table_42850 WHERE "Engine" = 'ford cosworth dfx' AND "Year" > '1981' AND "Entrant" = 'kraco enterprises'
CREATE TABLE table_54457 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When was Windy Hill used as a venue?
SELECT "Date" FROM table_54457 WHERE "Venue" = 'windy hill'
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 cost ( costid num...
when did patient 029-16431 have a base excess test for the last time when they came to the hospital last time?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-16431' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
CREATE TABLE table_25756 ( "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 directed by Rodney Clouden?
SELECT "Title" FROM table_25756 WHERE "Directed by" = 'Rodney Clouden'
CREATE TABLE table_name_6 ( rank INTEGER, silver INTEGER )
what is the rank when silver is less than 0?
SELECT SUM(rank) FROM table_name_6 WHERE silver < 0
CREATE TABLE table_name_76 ( date INTEGER, score VARCHAR )
On what Date was the Score of 3 6, 6 4, 3 6, 6 1, 6 2
SELECT SUM(date) FROM table_name_76 WHERE score = "3–6, 6–4, 3–6, 6–1, 6–2"
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...
what is the name of the disease that dawn cooper is primarily suffering from? also find his admission type.
SELECT demographic.admission_type, demographic.diagnosis FROM demographic WHERE demographic.name = "Dawn Cooper"
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text,...
Bronze Badges for React in London, UK.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Users.Id AS "user_link", Reputation, Location, Name FROM Users, Badges WHERE Users.Id = Badges.UserId AND Badges.TagBased = 1 AND Users.Location LIKE '%United%' AND Badges.Name = 'knockout.js' AND Badges.Name = 'reactjs' ORDER BY Reputation DESC
CREATE TABLE table_12338595_1 ( average VARCHAR, state VARCHAR )
How much is the average score for New York state?
SELECT average FROM table_12338595_1 WHERE state = "New York"