instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What was the score of the game on November 12?
CREATE TABLE table_10812293_3 (score VARCHAR,date VARCHAR)
SELECT score FROM table_10812293_3 WHERE date = "November 12"
What was the Tie Number of the Bradford City away team?
CREATE TABLE table_45071 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Tie no" FROM table_45071 WHERE "Away team" = 'bradford city'
where together we can do more is gloria mujica ( ph ) what are all the cons.
CREATE TABLE table_2651755_2 (cons VARCHAR,together_we_can_do_more VARCHAR)
SELECT cons FROM table_2651755_2 WHERE together_we_can_do_more = "Gloria Mujica ( PH )"
When was the swiss grand prix?
CREATE TABLE table_name_91 (date VARCHAR,race VARCHAR)
SELECT date FROM table_name_91 WHERE race = "swiss grand prix"
how many black/haitian patients have phenylephrine medication prescription?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND prescriptions.drug = "Phenylephrine"
What is the grid for the driver who earned 14 points?
CREATE TABLE table_72875 ("Fin. Pos" real,"Car No." real,"Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" real,"Laps Led" real,"Points" text)
SELECT "Grid" FROM table_72875 WHERE "Points" = '14'
In Los Banos, California, when the ERP W is than 10, what is the average Frequency MHz?
CREATE TABLE table_69638 ("Call sign" text,"Frequency MHz" real,"City of license" text,"ERP W" real,"Class" text,"FCC info" text)
SELECT AVG("Frequency MHz") FROM table_69638 WHERE "City of license" = 'los banos, california' AND "ERP W" < '10'
did patient 70516 have any tests for phosphate since 3 years ago?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE labevents (row_id number,subject_id number,h...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'phosphate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70516) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-3 year')
When did the construction of the unit Chinon B1 with net power of 905 MW start?
CREATE TABLE table_12983929_1 (construction_start VARCHAR,net_power VARCHAR,unit VARCHAR)
SELECT construction_start FROM table_12983929_1 WHERE net_power = "905 MW" AND unit = "Chinon B1"
What stadium had an opponent of Cal State Fullerton Titans?
CREATE TABLE table_78002 ("Bowl" text,"Score" text,"Season" real,"Opponent" text,"Stadium" text,"Location" text,"Attendance" text,"Head coach" text)
SELECT "Stadium" FROM table_78002 WHERE "Opponent" = 'cal state fullerton titans'
Bar chart x axis document name y axis the number of document name, rank X-axis in descending order.
CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR(15),Budget_Type_Description VARCHAR(255))CREATE TABLE Statements (Statement_ID INTEGER,Statement_Details VARCHAR(255))CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document...
SELECT Document_Name, COUNT(Document_Name) FROM Documents GROUP BY Document_Name ORDER BY Document_Name DESC
what does restriction AP/57 mean
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)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...
SELECT DISTINCT advance_purchase, application, maximum_stay, minimum_stay, no_discounts, restriction_code, saturday_stay_required, stopovers FROM restriction WHERE restriction_code = 'AP/57'
What is the score when the home team is queens park rangers?
CREATE TABLE table_name_29 (score VARCHAR,home_team VARCHAR)
SELECT score FROM table_name_29 WHERE home_team = "queens park rangers"
Who were the opponents in the final at Noida?
CREATE TABLE table_name_15 (opponents_in_the_final VARCHAR,tournament VARCHAR)
SELECT opponents_in_the_final FROM table_name_15 WHERE tournament = "noida"
age < 18 years
CREATE TABLE table_train_22 ("id" int,"pre_treatment_with_hydroxyethyl_starch" int,"requiring_dialysis" bool,"intracerebral_hemorrhage" bool,"serum_creatinine" float,"kidney_disease" bool,"allergy_to_hydroxyethyl_starch" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_22 WHERE age < 18
Which 1st leg has a Team 1 of drita?
CREATE TABLE table_name_3 (team_1 VARCHAR)
SELECT 1 AS st_leg FROM table_name_3 WHERE team_1 = "drita"
When turquoise is the map colour how many avg. trips per mile ( 1000) are there?
CREATE TABLE table_17839_1 (avg_trips_per_mile__ VARCHAR,map_colour VARCHAR)
SELECT COUNT(avg_trips_per_mile__) AS ×1000_ FROM table_17839_1 WHERE map_colour = "Turquoise"
With a Mark of 46.47, What is the lowest Heat?
CREATE TABLE table_48948 ("Heat" real,"Lane" real,"Name" text,"Country" text,"Mark" text)
SELECT MIN("Heat") FROM table_48948 WHERE "Mark" = '46.47'
in this year, when did patient 65401 last visit the hospital?
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 d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id nu...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 65401 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime DESC LIMIT 1
Questions (total, answered, unanswered, users) by Date.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,...
SELECT DATE(p.CreationDate) AS date, COUNT(DISTINCT p.OwnerUserId) AS users, SUM(1) AS total, SUM(CASE WHEN COALESCE(p.AcceptedAnswerId, 0) = 0 THEN 1 ELSE 0 END) AS unanswered, SUM(CASE WHEN COALESCE(p.AcceptedAnswerId, 0) = 0 THEN 0 ELSE 1 END) AS answered FROM Posts AS p GROUP BY DATE(p.CreationDate) ORDER BY DATE(p...
What date was the pyramid location?
CREATE TABLE table_43610 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text)
SELECT "Date" FROM table_43610 WHERE "Location" = 'the pyramid'
how many different positions are there?
CREATE TABLE player (player_id number,name text,position text,club_id number,apps number,tries number,goals text,points number)CREATE TABLE competition_result (competition_id number,club_id_1 number,club_id_2 number,score text)CREATE TABLE club_rank (rank number,club_id number,gold number,silver number,bronze number,to...
SELECT COUNT(DISTINCT position) FROM player
Links to answers by a given user.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,T...
SELECT CreationDate, Id AS "post_link" FROM Posts WHERE (PostTypeId = 2) AND (OwnerUserId = '##UserId##') ORDER BY CreationDate DESC
What Trainer had Jockey William Jenkins in a race with Time of 1:44.80?
CREATE TABLE table_43196 ("Year" real,"Winner" text,"Jockey" text,"Trainer" text,"Owner" text,"Distance (Miles)" text,"Time" text,"Purse" text)
SELECT "Trainer" FROM table_43196 WHERE "Time" = '1:44.80' AND "Jockey" = 'william jenkins'
A bar chart for finding the number of the names of stadiums that some Australian swimmers have been to, list from high to low by the names.
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year 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...
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY T4.Name DESC
What was the record at the game that had a loss of Brandon (4 8)?
CREATE TABLE table_15204 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Record" text)
SELECT "Record" FROM table_15204 WHERE "Loss" = 'brandon (4–8)'
Which home team score occurred at Victoria Park?
CREATE TABLE table_4578 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team score" FROM table_4578 WHERE "Venue" = 'victoria park'
What are all the different product names, and how many complains has each received. Show the proportion.
CREATE TABLE Products (product_id INTEGER,parent_product_id INTEGER,product_category_code VARCHAR(20),date_product_first_available DATETIME,date_product_discontinued DATETIME,product_name VARCHAR(80),product_description VARCHAR(255),product_price DECIMAL(19,4))CREATE TABLE Customers (customer_id INTEGER,customer_type_c...
SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name
What is Milena Reljin's place with a smaller than 9.8 rope?
CREATE TABLE table_name_5 (place VARCHAR,rope VARCHAR,name VARCHAR)
SELECT place FROM table_name_5 WHERE rope < 9.8 AND name = "milena reljin"
In what year was the score 204 (-6)?
CREATE TABLE table_name_3 (year VARCHAR,score VARCHAR)
SELECT year FROM table_name_3 WHERE score = "204 (-6)"
Show the names and total passengers for all train stations not in London Visualize by bar chart, I want to list in asc by the y-axis please.
CREATE TABLE train (Train_ID int,Name text,Time text,Service text)CREATE TABLE station (Station_ID int,Name text,Annual_entry_exit real,Annual_interchanges real,Total_Passengers real,Location text,Main_Services text,Number_of_Platforms int)CREATE TABLE train_station (Train_ID int,Station_ID int)
SELECT Name, Total_Passengers FROM station WHERE Location <> 'London' ORDER BY Total_Passengers
tell me the name of allergies patient 009-9534 was having until 08/2102?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,...
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-9534')) AND STRFTIME('%y-%m', allergy.allergytime) <= '2102-08'
in 2104, what are the five most frequent interventions that patients were given within 2 months after receiving administration of electrolytes - magnesium?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE cost (costid number,uniquepid text,pat...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'administration of electrolytes - magnesi...
List the distinct payment method codes with the number of orders mad. Plot them as pie chart.
CREATE TABLE Invoice_Items (Invoice_Item_ID INTEGER,Invoice_ID INTEGER,Order_ID INTEGER,Order_Item_ID INTEGER,Product_ID INTEGER,Order_Quantity INTEGER,Other_Item_Details VARCHAR(255))CREATE TABLE Invoices (Invoice_ID INTEGER,Order_ID INTEGER,payment_method_code CHAR(15),Product_ID INTEGER,Order_Quantity VARCHAR(288),O...
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code
The driver Jacky Ickx had what time/retired?
CREATE TABLE table_54423 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_54423 WHERE "Driver" = 'jacky ickx'
when did patient 83062 receive a microbiology test in this hospital visit for the last time?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABL...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83062 AND admissions.dischtime IS NULL) ORDER BY microbiologyevents.charttime DESC LIMIT 1
What is the Area of the Parish with a Population of 71?
CREATE TABLE table_name_71 (area_km_2 VARCHAR,population VARCHAR)
SELECT area_km_2 FROM table_name_71 WHERE population = 71
What is the sum of Overall, when Pick is greater than 5, when Round is less than 11, and when Name is 'Tom Barrington'?
CREATE TABLE table_name_69 (overall INTEGER,name VARCHAR,pick VARCHAR,round VARCHAR)
SELECT SUM(overall) FROM table_name_69 WHERE pick > 5 AND round < 11 AND name = "tom barrington"
What is the 2010 with a rank higher than 15 and a 2011 maserati?
CREATE TABLE table_name_72 (rank VARCHAR)
SELECT 2010 FROM table_name_72 WHERE rank > 15 AND 2011 = "maserati"
What is the class AAAAA of the school year 1993-94 with a class AAA of Mont Belvieu Barbers Hill?
CREATE TABLE table_38477 ("School Year" text,"Class A" text,"Class AA" text,"Class AAA" text,"Class AAAA" text,"Class AAAAA" text)
SELECT "Class AAAAA" FROM table_38477 WHERE "Class AAA" = 'mont belvieu barbers hill' AND "School Year" = '1993-94'
What is the event name when the method is submission (brabo choke)?
CREATE TABLE table_9833 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" text)
SELECT "Event" FROM table_9833 WHERE "Method" = 'submission (brabo choke)'
Among patients admitted before the year 2154, how many were treated with drug sw?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2154" AND prescriptions.drug = "SW"
What team played Geelong at their away game?
CREATE TABLE table_57432 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_57432 WHERE "Away team" = 'geelong'
What shows for 2010 when 2007 is a and 2004 is 2r?
CREATE TABLE table_name_97 (Id VARCHAR)
SELECT 2010 FROM table_name_97 WHERE 2007 = "a" AND 2004 = "2r"
When 1 is the number in series who is the director?
CREATE TABLE table_73005 ("No. overall" real,"No. in series" real,"Title" text,"Director" text,"Writer" text,"Original air date" text,"Production code" real)
SELECT "Director" FROM table_73005 WHERE "No. in series" = '1'
What is the largest mass for Tycho Crater?
CREATE TABLE table_42977 ("U.S. mission" text,"Mass (kg)" real,"Booster" text,"Launched" text,"Mission goal" text,"Landing zone" text,"Lat / Lon" text)
SELECT MAX("Mass (kg)") FROM table_42977 WHERE "Landing zone" = 'tycho crater'
What nationality is pick # 89
CREATE TABLE table_17462 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text)
SELECT "Nationality" FROM table_17462 WHERE "Pick #" = '89'
Who does p draig harrington play for?
CREATE TABLE table_46223 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "Country" FROM table_46223 WHERE "Player" = 'pádraig harrington'
what was the one year survival rate of s/p vascular bypass patients who were prescribed with prednisone?
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 (uniquepid text,patienthealthsystemstayid number,patientunitstayid...
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
What is his record at ufc 115?
CREATE TABLE table_32705 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Record" FROM table_32705 WHERE "Event" = 'ufc 115'
What country has an LP format, catalog s 31503?
CREATE TABLE table_name_20 (country VARCHAR,format VARCHAR,catalog VARCHAR)
SELECT country FROM table_name_20 WHERE format = "lp" AND catalog = "s 31503"
What is the top lap that had a tyre time?
CREATE TABLE table_77902 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MAX("Laps") FROM table_77902 WHERE "Time/Retired" = 'tyre'
Which Chief Judge has Active service of 1873 1875?
CREATE TABLE table_name_23 (chief_judge VARCHAR,active_service VARCHAR)
SELECT chief_judge FROM table_name_23 WHERE active_service = "1873–1875"
What is the film title used in nomination for the film from South Korea?
CREATE TABLE table_15045 ("Country" text,"Film title used in nomination" text,"Language" text,"Original title" text,"Director" text)
SELECT "Film title used in nomination" FROM table_15045 WHERE "Country" = 'south korea'
how many times , from june 23 , 1992 to december 3 , 2000 , did the suicide blondes hold the title ?
CREATE TABLE table_204_23 (id number,"#" number,"wrestlers" text,"reign" number,"date" text,"days held" number,"location" text,"event" text,"notes" text)
SELECT COUNT(*) FROM table_204_23 WHERE "wrestlers" = 'the suicide blondes'
what was the first single released for the epic label ?
CREATE TABLE table_203_123 (id number,"year" number,"title" text,"b-side" text,"mediums" text,"label (catalog)" text)
SELECT "title" FROM table_203_123 WHERE "label (catalog)" = 'epic' ORDER BY id LIMIT 1
what are the three most commonly ordered specimen tests for patients who have been diagnosed with hyperlipidemia previously within 2 months in 2105?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientu...
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hyperlipidemia' AND STRFTIME('%y', diagnosis...
when did patient 2238 have the .9% normal saline for the last time until 619 days ago?
CREATE TABLE labevents (row_id number,subject_id number,hadm_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,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE chartevents (row_i...
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2238)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label ...
Who is in July where October is jill de vries?
CREATE TABLE table_name_7 (july VARCHAR,october VARCHAR)
SELECT july FROM table_name_7 WHERE october = "jill de vries"
For those employees who was hired before 2002-06-21, find job_id and the sum of employee_id , and group by attribute job_id, and visualize them by a bar chart.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0)...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
Who won the men's doubles the year Pernille Nedergaard won the women's singles?
CREATE TABLE table_80012 ("Year" real,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text)
SELECT "Men's doubles" FROM table_80012 WHERE "Women's singles" = 'pernille nedergaard'
Give me the comparison about the sum of ID over the meter_200 , and group by attribute meter_200 by a bar chart, order Y in descending order please.
CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year 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 ...
SELECT meter_200, SUM(ID) FROM swimmer GROUP BY meter_200 ORDER BY SUM(ID) DESC
For those records from the products and each product's manufacturer, give me the comparison about the average of manufacturer over the name , and group by attribute name, and could you order X from high to low order please?
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC
Potential formatting issues due to MathJax enabling.
CREATE TABLE FlagTypes (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 text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Review...
SELECT Id AS "post_link", Body FROM Posts WHERE Body LIKE '%$%$%'
Upvotes and downvotes cast by a community.
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPos...
SELECT SUM(UpVotes) AS "Upvotes", SUM(DownVotes) AS "Downvotes", SUM(DownVotes) * 100 / (SUM(UpVotes) + SUM(DownVotes)) AS "Downvote %" FROM Users
Show me the total number by studio in a histogram, I want to rank by the bar in asc.
CREATE TABLE market (Market_ID int,Country text,Number_cities int)CREATE TABLE film (Film_ID int,Title text,Studio text,Director text,Gross_in_dollar int)CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)
SELECT Studio, COUNT(*) FROM film GROUP BY Studio ORDER BY Studio
I want to see trend the total number over year by semester, and sort in ascending by the X.
CREATE TABLE advisor (s_ID varchar(5),i_ID varchar(5))CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numeric(8,2))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot...
SELECT year, COUNT(*) FROM section GROUP BY semester, year ORDER BY year
What is the club for the 132 SHTS?
CREATE TABLE table_6735 ("Rank" real,"Goalkeeper" text,"Club" text,"MINS" real,"SHTS" real,"W-L-T" text)
SELECT "Club" FROM table_6735 WHERE "SHTS" = '132'
What is shown on Tuesday when Thursday shows Fox Sports Tonight (ends 1 am next day)?
CREATE TABLE table_name_71 (tuesday VARCHAR,thursday VARCHAR)
SELECT tuesday FROM table_name_71 WHERE thursday = "fox sports tonight (ends 1 am next day)"
Which season had f/laps is 0 and races is 2?
CREATE TABLE table_27631002_1 (season VARCHAR,f_laps VARCHAR,races VARCHAR)
SELECT season FROM table_27631002_1 WHERE f_laps = 0 AND races = 2
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
CREATE TABLE mill (architect_id number,id number,location text,name text,type text,built_year number,notes text)CREATE TABLE bridge (architect_id number,id number,name text,location text,length_meters number,length_feet number)CREATE TABLE architect (id text,name text,nationality text,gender text)
SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80
how many patients were treated with prt lg intes exc nec/nos in this year?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,e...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'prt lg intes exc nec/nos') AND DATETIME(procedures_i...
Name the most stage for alejandro valverde and astana greg henderson
CREATE TABLE table_25254 ("Stage" real,"Winner" text,"General Classification" text,"Mountains Classification" text,"Sprint Classification" text,"Team Classification" text)
SELECT MAX("Stage") FROM table_25254 WHERE "General Classification" = 'Alejandro Valverde' AND "Team Classification" = 'Astana' AND "Winner" = 'Greg Henderson'
Count the number of schools that have had basketball matches.
CREATE TABLE basketball_match (team_id number,school_id number,team_name text,acc_regular_season text,acc_percent text,acc_home text,acc_road text,all_games text,all_games_percent number,all_home text,all_road text,all_neutral text)CREATE TABLE university (school_id number,school text,location text,founded number,affil...
SELECT COUNT(DISTINCT school_id) FROM basketball_match
What is the average goals when the last appearance was before 1984, there were more than 17 appearances, the first appearance was before 1961 and the position was mf?
CREATE TABLE table_63684 ("Position" text,"Appearances" real,"Goals" real,"First appearance" real,"Last appearance" real)
SELECT AVG("Goals") FROM table_63684 WHERE "Last appearance" < '1984' AND "Appearances" > '17' AND "First appearance" < '1961' AND "Position" = 'mf'
What is the On-air ID of the broadcaster at frequency 0 801?
CREATE TABLE table_name_13 (on_air_id VARCHAR,frequency VARCHAR)
SELECT on_air_id FROM table_name_13 WHERE frequency = "0 801"
how many medicaid insurance patients were admitted in hospital before 2103?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicaid" AND demographic.admityear < "2103"
What was Democrat: Tom Harkin's percentage when the poll source was Rasmussen Reports and the lead margin was 14?
CREATE TABLE table_45522 ("Poll Source" text,"Dates administered" text,"Democrat: Tom Harkin" text,"Republican: Christopher Reed" text,"Lead Margin" real)
SELECT "Democrat: Tom Harkin" FROM table_45522 WHERE "Poll Source" = 'rasmussen reports' AND "Lead Margin" = '14'
List the number of counties of all appellations in a bar chart, and I want to list in ascending by the bars.
CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)
SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY County
Name the time for result msst 29 24
CREATE TABLE table_26842217_18 (time VARCHAR,result VARCHAR)
SELECT time FROM table_26842217_18 WHERE result = "MSST 29–24"
is there LIMOUSINE service available at BALTIMORE airport
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE month (month_number int,month_name text)CREATE TABLE food_service (meal_co...
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'BALTIMORE' AND ground_service.airport_code = airport.airport_code AND ground_service.transport_...
Which courses offer 13 credits in regards to the RELIGION 200 -level ?
CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch...
SELECT DISTINCT department, name, number FROM course WHERE credits = 13 AND department = 'RELIGION' AND number < 200 + 100 AND number >= 200
Which team was in 1951?
CREATE TABLE table_name_40 (team VARCHAR,year VARCHAR)
SELECT team FROM table_name_40 WHERE year = 1951
what is maximum age of patients whose admission type is urgent and admission year is greater than or equal to 2177?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear >= "2177"
What is the name of the ship with the largest tonnage?
CREATE TABLE ship (Name VARCHAR,Tonnage VARCHAR)
SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1
calculate the duration of patient 027-82318's stay in the first icu.
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch...
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-82318') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
Which person is in the tronto/broadway and has a uk tour of n/a
CREATE TABLE table_10402018_1 (toronto___broadway VARCHAR,uk_tour VARCHAR)
SELECT toronto___broadway FROM table_10402018_1 WHERE uk_tour = "n/a"
how do i get to PHILADELPHIA downtown from the airport
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 (restriction_code text,advance_purchase int,stopovers...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'PHILADELPHIA' AND ground_service.city_code = city.city_code
Answers posted after a Reward Existing Answer bounty.
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Bod...
SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", PostNotices.CreationDate AS BountyPosted, Posts.CreationDate AS AnswerPosted FROM PostNotices JOIN Posts ON PostNotices.PostId = Posts.ParentId WHERE PostNotices.PostNoticeTypeId = 15 AND PostNotices.CreationDate < Posts.CreationDate ORDER BY Posts.Creat...
You can return a bar chart to show the employees' first name and the corresponding manager's id, order in desc by the y axis.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE employees (EM...
SELECT FIRST_NAME, MANAGER_ID FROM employees ORDER BY MANAGER_ID DESC
how many laps have a time/retired of +1 lap and mark blundell is the driver?
CREATE TABLE table_10667 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT AVG("Laps") FROM table_10667 WHERE "Time/Retired" = '+1 lap' AND "Driver" = 'mark blundell'
Which player is on the roster for the Sydney University Lions?
CREATE TABLE table_61435 ("Name" text,"Pos." text,"Height" text,"Weight" text,"Date of Birth" text,"Club" text)
SELECT "Name" FROM table_61435 WHERE "Club" = 'sydney university lions'
What is the place of player tom watson?
CREATE TABLE table_77212 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Place" FROM table_77212 WHERE "Player" = 'tom watson'
What is Score, when Outcome is 'winner', when Partnering is 'Nicole Sewell', and when Opponent in Final is 'Victoria Davies / Kate Warne-Holland'?
CREATE TABLE table_49920 ("Outcome" text,"Date" text,"Location" text,"Surface" text,"Partnering" text,"Opponent in final" text,"Score" text)
SELECT "Score" FROM table_49920 WHERE "Outcome" = 'winner' AND "Partnering" = 'nicole sewell' AND "Opponent in final" = 'victoria davies / kate warne-holland'
What was the table position for the team whose outgoing manager was Brian Laws?
CREATE TABLE table_26593762_3 (position_in_table VARCHAR,outgoing_manager VARCHAR)
SELECT position_in_table FROM table_26593762_3 WHERE outgoing_manager = "Brian Laws"
Name the amount of Map Key which has a Pop (2004) smaller than 433,819, and a Capital City of hajjah, and an Area km smaller than 9,376? Question 1
CREATE TABLE table_76266 ("Governorate" text,"Capital City" text,"Area km\u00b2" real,"Pop (2004)" real,"Map Key" real)
SELECT AVG("Map Key") FROM table_76266 WHERE "Pop (2004)" < '433,819' AND "Capital City" = 'hajjah' AND "Area km\u00b2" < '9,376'
What was the tries against count for the club whose tries for count was 29?
CREATE TABLE table_12886178_4 (tries_against VARCHAR,tries_for VARCHAR)
SELECT tries_against FROM table_12886178_4 WHERE tries_for = "29"
What were the years active where Asian Cup played as a captain is Iran 1976?
CREATE TABLE table_272865_20 (years_active VARCHAR,asian_cup_played_as_a_captain VARCHAR)
SELECT years_active FROM table_272865_20 WHERE asian_cup_played_as_a_captain = "Iran 1976"
provide the number of patients whose ethnicity is hispanic or latino and drug type is main?
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,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND prescriptions.drug_type = "MAIN"
What is the muzzle energy with 40,000 psi max pressure?
CREATE TABLE table_name_40 (muzzle_energy VARCHAR,max_pressure VARCHAR)
SELECT muzzle_energy FROM table_name_40 WHERE max_pressure = "40,000 psi"