instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the weekly rank where the number is 4? | CREATE TABLE table_11753080_2 (weekly_rank VARCHAR,_number VARCHAR) | SELECT weekly_rank FROM table_11753080_2 WHERE _number = 4 |
Name the median income for age band being under 20 | CREATE TABLE table_72617 ("Age band" text,"Median income" text,"Mean income" text,"Median income (men)" text,"Mean income (men)" text,"Median income (women)" text,"Mean income (women)" text) | SELECT "Median income" FROM table_72617 WHERE "Age band" = 'Under 20' |
Find all movies featuring ' Benedict Cumberbatch ' and ' Keira Knightley | CREATE TABLE written_by (id int,msid int,wid int)CREATE TABLE keyword (id int,keyword text)CREATE TABLE cast (id int,msid int,aid int,role text)CREATE TABLE actor (aid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE company (id int,name text,country_code varchar)CREATE TABLE write... | SELECT movie.title FROM actor AS ACTOR_0, actor AS ACTOR_1, cast AS CAST_0, cast AS CAST_1, movie WHERE ACTOR_0.name = 'Benedict Cumberbatch' AND ACTOR_1.name = 'Keira Knightley' AND CAST_0.aid = ACTOR_0.aid AND CAST_1.aid = ACTOR_1.aid AND movie.mid = CAST_0.msid AND movie.mid = CAST_1.msid |
how many patients whose marital status is married and ethnicity is american indian/alaska native? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" |
When is Part 2, when Part 4 is on December 9, 2007? | CREATE TABLE table_name_44 (part_2 VARCHAR,part_4 VARCHAR) | SELECT part_2 FROM table_name_44 WHERE part_4 = "december 9, 2007" |
What is the Partner during the Asian Games Year? | CREATE TABLE table_name_23 (partner VARCHAR,year VARCHAR) | SELECT partner FROM table_name_23 WHERE year = "asian games" |
List the number of counties of all appellations in a bar chart, and list by the Y-axis in descending. | CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)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) | SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County) DESC |
What was South Melbourne's score when they played as the away team? | CREATE TABLE table_name_5 (away_team VARCHAR) | SELECT away_team AS score FROM table_name_5 WHERE away_team = "south melbourne" |
What is the average pick # from the Quebec Major Junior Hockey League player Samuel Carrier? | CREATE TABLE table_name_11 (pick__number INTEGER,league_from VARCHAR,player VARCHAR) | SELECT AVG(pick__number) FROM table_name_11 WHERE league_from = "quebec major junior hockey league" AND player = "samuel carrier" |
How many goals did the player from Ipswich town score? | CREATE TABLE table_30450 ("Player" text,"Cap(s)" real,"Goal(s)" real,"International Debut" text,"Club(s)" text) | SELECT MIN("Goal(s)") FROM table_30450 WHERE "Club(s)" = 'Ipswich Town' |
what was the total number of laps for ecurie savin calberson and dana chevrolet inc. . ? | CREATE TABLE table_203_366 (id number,"pos" number,"class" text,"no" number,"team" text,"drivers" text,"chassis" text,"engine" text,"laps" number) | SELECT SUM("laps") FROM table_203_366 WHERE "team" IN ('ecurie savin-calberson', 'dana chevrolet inc') |
What is the title of the episode directed by Peter Markle and written by Jerry Stahl? | CREATE TABLE table_10715317_2 (title VARCHAR,directed_by VARCHAR,written_by VARCHAR) | SELECT title FROM table_10715317_2 WHERE directed_by = "Peter Markle" AND written_by = "Jerry Stahl" |
what is gender and drug name of subject id 2560? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT demographic.gender, prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560" |
Which Road Team has a Home Team of rochester, and a Game of game 2? | CREATE TABLE table_77454 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text) | SELECT "Road Team" FROM table_77454 WHERE "Home Team" = 'rochester' AND "Game" = 'game 2' |
Questions with version-specific tag lacking the generic tag. Find questions that lack the generic tag while having a version-specific one. Suitable for retaggers :) | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE T... | SELECT Tags, Title, AcceptedAnswerId, CreationDate, 'http://dba.stackexchange.com/questions/' + CAST(Id AS TEXT) AS URL FROM Posts WHERE Tags LIKE '%' + '##mainTag:string##' + '-%' AND NOT Tags LIKE '%<' + '##mainTag:string##' + '>%' ORDER BY CreationDate DESC |
What's the highest League Cup with an FA Cup thats larger than 2? | CREATE TABLE table_name_95 (league INTEGER,fa_cup INTEGER) | SELECT MAX(league) AS Cup FROM table_name_95 WHERE fa_cup > 2 |
How many patients' procedure long title is thoracentesis and lab test category is hematology? | 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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Hematology" |
How many locations? Draw a bar chart, order by the Y from high to low. | 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)CREATE TABLE train (Train_ID int,Name text,Time text,Service text) | SELECT Location, COUNT(Location) FROM station GROUP BY Location ORDER BY COUNT(Location) DESC |
Give me a bar chart that bins the payment date into the Year interval and then shows the total amount of each payment, and then sort the bars in ascending order of date. | CREATE TABLE Payments (Payment_ID INTEGER,Settlement_ID INTEGER,Payment_Method_Code VARCHAR(255),Date_Payment_Made DATE,Amount_Payment INTEGER)CREATE TABLE Claims (Claim_ID INTEGER,Policy_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER)CREATE TABLE Settlements (Sett... | SELECT Date_Payment_Made, SUM(Amount_Payment) FROM Payments ORDER BY Date_Payment_Made |
What's the tie number when the away team was Mansfield Town? | CREATE TABLE table_63323 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Tie no" FROM table_63323 WHERE "Away team" = 'mansfield town' |
Show me about the distribution of Date_of_Birth and Height in a bar chart, could you list by the Y-axis in descending? | CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real) | SELECT Date_of_Birth, Height FROM people ORDER BY Height DESC |
Players of amanda coetzer and marcos ondruska is what team? | CREATE TABLE table_5820 ("Placing" real,"Team" text,"Players" text,"Seeding" text,"Playoffs W-L" text,"Matches W-L" text) | SELECT "Team" FROM table_5820 WHERE "Players" = 'amanda coetzer and marcos ondruska' |
Show the names of countries and the average speed of roller coasters from each country with a bar chart, display by the y-axis in asc. | CREATE TABLE country (Country_ID int,Name text,Population int,Area int,Languages text)CREATE TABLE roller_coaster (Roller_Coaster_ID int,Name text,Park text,Country_ID int,Length real,Height real,Speed text,Opened text,Status text) | SELECT T1.Name, AVG(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name ORDER BY AVG(T2.Speed) |
Can you draw the trend of salary over the hire date?, list from high to low by the x-axis. | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (... | SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE DESC |
Name the venue for staines town | CREATE TABLE table_name_43 (venue VARCHAR,opponent VARCHAR) | SELECT venue FROM table_name_43 WHERE opponent = "staines town" |
Which player had 50 balls? | CREATE TABLE table_65137 ("Rank" real,"Player" text,"Team" text,"Runs" text,"Balls" real,"Year" real,"Against" text) | SELECT "Player" FROM table_65137 WHERE "Balls" = '50' |
What is the average Points for a year before 1955? | CREATE TABLE table_name_68 (points INTEGER,year INTEGER) | SELECT AVG(points) FROM table_name_68 WHERE year < 1955 |
how many locations were used at least twice ? | CREATE TABLE table_203_565 (id number,"wrestlers" text,"times" number,"date" text,"location" text,"notes" text) | SELECT COUNT(*) FROM (SELECT "location" FROM table_203_565 GROUP BY "location" HAVING COUNT(*) >= 2) |
GroupBy vs Distinct Query Plan. | CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CR... | SELECT AGE FROM Users GROUP BY AGE |
When Interpol is in 6th, who is in 7th? | CREATE TABLE table_72845 ("Poll Year" text,"Winner" text,"Second" text,"Third" text,"Fourth" text,"Fifth" text,"Sixth" text,"Seventh" text,"Eighth" text,"Ninth" text,"Tenth" text) | SELECT COUNT("Seventh") FROM table_72845 WHERE "Sixth" = 'Interpol' |
what is the number of office admitted patients who have abdominal abscess primary disease? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "ABDOMINAL ABSCESS" |
Who was the trainer when Mckaymackenna won? | CREATE TABLE table_46917 ("Year" real,"Winner" text,"Jockey" text,"Trainer" text,"Owner" text) | SELECT "Trainer" FROM table_46917 WHERE "Winner" = 'mckaymackenna' |
when was the last year bo ` ness united made the roll of honor for east superleague ? | CREATE TABLE table_204_428 (id number,"season" text,"east superleague" text,"east premier league" text,"east region south division" text,"east region central division" text,"east region north division" text) | SELECT "season" FROM table_204_428 WHERE "east superleague" = "bo'ness united" ORDER BY "season" DESC LIMIT 1 |
What is the Result of the event with a Record of 1-3? | CREATE TABLE table_name_39 (result VARCHAR,record VARCHAR) | SELECT result FROM table_name_39 WHERE record = "1-3" |
what was the goal difference in the game on february 18th ? | CREATE TABLE table_204_861 (id number,"tie no" number,"home team" text,"score" text,"away team" text,"date" text) | SELECT ABS("score" - "score") FROM table_204_861 WHERE "date" = '18 february 1976' |
What was the highest number of Draws scored by Sebastapol when the value for Against was less than 1802? | CREATE TABLE table_name_24 (draws INTEGER,ballarat_fl VARCHAR,against VARCHAR) | SELECT MAX(draws) FROM table_name_24 WHERE ballarat_fl = "sebastapol" AND against < 1802 |
What is the average speed for ships before 1974 with over 1.73 passengers? | CREATE TABLE table_name_31 (speed INTEGER,year VARCHAR,passengers VARCHAR) | SELECT AVG(speed) FROM table_name_31 WHERE year < 1974 AND passengers > 1.73 |
What is the total amount of grants given by each organisations? Also list the organisation id. | CREATE TABLE document_types (document_type_code text,document_description text)CREATE TABLE research_staff (staff_id number,employer_organisation_id number,staff_details text)CREATE TABLE project_staff (staff_id number,project_id number,role_code text,date_from time,date_to time,other_details text)CREATE TABLE document... | SELECT SUM(grant_amount), organisation_id FROM grants GROUP BY organisation_id |
Which episode had 16.38 million U.S. viewers? | CREATE TABLE table_16361 ("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) | SELECT "Title" FROM table_16361 WHERE "U.S. viewers (millions)" = '16.38' |
What is the celtics record after game 33 when they score of the game was 111-108? | CREATE TABLE table_name_21 (record VARCHAR,game VARCHAR,score VARCHAR) | SELECT record FROM table_name_21 WHERE game > 33 AND score = "111-108" |
what is the only product utilizing rdf input and output format ? | CREATE TABLE table_204_870 (id number,"product" text,"main functionality" text,"input format" text,"output format" text,"platform" text,"license and cost" text,"notes" text) | SELECT "product" FROM table_204_870 WHERE "input format" = 'rdf' AND "output format" = 'rdf' |
Users Whose Top Question is in Tag t. | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId num... | SELECT maxQScores.OwnerUserId AS "user_link", maxQScores.maxQScore, p1.Id AS "post_link" FROM (SELECT p.OwnerUserId, MAX(p.Score) AS maxQScore FROM Posts AS p WHERE p.PostTypeId = 1 GROUP BY p.OwnerUserId) AS maxQScores INNER JOIN Posts AS p1 ON p1.Score = maxQScores.maxQScore AND p1.PostTypeId = 1 AND p1.OwnerUserId =... |
What date sent has cancer as the constellation? | CREATE TABLE table_38584 ("Designation HD" text,"Constellation" text,"Date sent" text,"Arrival date" text,"Message" text) | SELECT "Date sent" FROM table_38584 WHERE "Constellation" = 'cancer' |
How many vacators have October 22, 1808 as date successor seated? | CREATE TABLE table_225093_4 (vacator VARCHAR,date_successor_seated VARCHAR) | SELECT COUNT(vacator) FROM table_225093_4 WHERE date_successor_seated = "October 22, 1808" |
Get me the list of patients who died on or before 2126 that had drug code ggac5l. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2126.0" AND prescriptions.formulary_drug_cd = "GGAC5L" |
had any organism been found during the last urine microbiology test of patient 25312 in 01/this year? | 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 transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid numb... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25312) AND microbiologyevents.spec_type_desc = 'urine' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETI... |
Find the unit of measurement and product category code of product named 'chervil'. | CREATE TABLE characteristics (characteristic_id number,characteristic_type_code text,characteristic_data_type text,characteristic_name text,other_characteristic_details text)CREATE TABLE ref_product_categories (product_category_code text,product_category_description text,unit_of_measure text)CREATE TABLE ref_colors (co... | SELECT t2.unit_of_measure, t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil" |
What was the finishing place for 1953? | CREATE TABLE table_70677 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real) | SELECT "Finish" FROM table_70677 WHERE "Year" = '1953' |
Name the winners of the mens doubles in the season of 1963/64. | CREATE TABLE table_30408 ("Season" text,"Mens Singles" text,"Womens Singles" text,"Mens Doubles" text,"Womens Doubles" text,"Mixed Doubles" text) | SELECT "Mens Doubles" FROM table_30408 WHERE "Season" = '1963/64' |
Which MCDB classes don 't meet on Friday ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests i... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.friday = 'N' AND course.department = 'MCDB' AND semester.semester = 'WN' AND s... |
When was the game when Footscray was the away team? | CREATE TABLE table_name_38 (date VARCHAR,away_team VARCHAR) | SELECT date FROM table_name_38 WHERE away_team = "footscray" |
What Winning constructor has a Circuit of lasarte? | CREATE TABLE table_name_82 (winning_constructor VARCHAR,circuit VARCHAR) | SELECT winning_constructor FROM table_name_82 WHERE circuit = "lasarte" |
Name the location attendance for 4 game | CREATE TABLE table_25855 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text) | SELECT "Location Attendance" FROM table_25855 WHERE "Game" = '4' |
What is the average Grid that has a Time/Retired of +2 laps, and under 51 laps? | CREATE TABLE table_name_83 (grid INTEGER,time_retired VARCHAR,laps VARCHAR) | SELECT AVG(grid) FROM table_name_83 WHERE time_retired = "+2 laps" AND laps < 51 |
how many toyotas were there in the top 10 finishes ? | CREATE TABLE table_203_131 (id number,"pos." number,"car #" number,"driver" text,"make" text,"team" text) | SELECT COUNT(*) FROM table_203_131 WHERE "make" = 'toyota' |
WHAT IS THE TOURNAMENT WITH A 2010 OF A, 2009 OF A, AND 001 PERFORMANCE OF Q1? | CREATE TABLE table_50695 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "Tournament" FROM table_50695 WHERE "2010" = 'a' AND "2009" = 'a' AND "2011" = 'q1' |
flights from CHARLOTTE to BALTIMORE | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE days (days_code varchar,day_name varchar)CREATE... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHARLOTTE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALT... |
What is JCTV's digital channel? | CREATE TABLE table_19097 ("Call sign" text,"Analog channel" text,"Digital channel" text,"Virtual channel" text,"Network" text,"Station Ownership" text) | SELECT "Digital channel" FROM table_19097 WHERE "Network" = 'JCTV' |
Most common mutual questioner - answerer pairs. | CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteU... | WITH Raw AS (SELECT Q.OwnerUserId AS QId, A.OwnerUserId AS AId, COUNT(*) AS Count FROM Posts AS Q, Posts AS A WHERE A.ParentId = Q.Id AND A.OwnerUserId > 0 AND Q.OwnerUserId > 0 AND A.OwnerUserId != Q.OwnerUserId AND Q.CommunityOwnedDate IS NULL AND A.CommunityOwnedDate IS NULL GROUP BY Q.OwnerUserId, A.OwnerUserId) SE... |
Who were the developers for the Action RPG made after 2010? | CREATE TABLE table_63848 ("Year" real,"Game" text,"Genre" text,"Platform(s)" text,"Developer(s)" text) | SELECT "Developer(s)" FROM table_63848 WHERE "Year" > '2010' AND "Genre" = 'action rpg' |
in this year, when did patient 032-9230 come to the hospital via the other hospital for the first time? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweigh... | SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '032-9230' AND patient.hospitaladmitsource = 'other hospital' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaladmittime LIMIT 1 |
What is the city where the Telstra Dome is? | CREATE TABLE table_name_83 (city VARCHAR,stadium VARCHAR) | SELECT city FROM table_name_83 WHERE stadium = "telstra dome" |
What is Highest Number of Bearers 2008, when Surname is Jacobsen? | CREATE TABLE table_77262 ("Rank" real,"Surname" text,"Number of bearers 2008" real,"Type" text,"Etymology" text) | SELECT MAX("Number of bearers 2008") FROM table_77262 WHERE "Surname" = 'jacobsen' |
how many caps did jean pierre rives and michel crauste accrue ? | CREATE TABLE table_204_342 (id number,"#" number,"player" text,"span" text,"caps" number,"total caps" number,"win %" text) | SELECT SUM("total caps") FROM table_204_342 WHERE "player" IN ('jean-pierre rives', 'michel crauste') |
Bar chart x axis minister y axis how many minister, and rank by the total number in ascending. | CREATE TABLE member (Member_ID int,Member_Name text,Party_ID text,In_office text)CREATE TABLE party_events (Event_ID int,Event_Name text,Party_ID int,Member_in_charge_ID int)CREATE TABLE party (Party_ID int,Minister text,Took_office text,Left_office text,Region_ID int,Party_name text)CREATE TABLE region (Region_ID int,... | SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY COUNT(Minister) |
Name the traditional for | CREATE TABLE table_2013618_1 (traditional VARCHAR,simplified VARCHAR) | SELECT traditional FROM table_2013618_1 WHERE simplified = "屏南县" |
How many touchdowns were there with QB rating of 66.6? | CREATE TABLE table_20906175_3 (touchdowns VARCHAR,qb_rating VARCHAR) | SELECT touchdowns FROM table_20906175_3 WHERE qb_rating = "66.6" |
A bar chart for showing the number of the countries that have managers of age above 50 or below 46, list in descending by the bars. | CREATE TABLE railway_manage (Railway_ID int,Manager_ID int,From_Year text)CREATE TABLE railway (Railway_ID int,Railway text,Builder text,Built text,Wheels text,Location text,ObjectNumber text)CREATE TABLE train (Train_ID int,Train_Num text,Name text,From text,Arrival text,Railway_ID int)CREATE TABLE manager (Manager_ID... | SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY Country DESC |
Who was the skipper for the vessel with a corrected time of 2:18:31:49? | CREATE TABLE table_22433 ("Position" real,"Sail Number" text,"Yacht" text,"State/Country" text,"Yacht Type" text,"LOA (Metres)" text,"Skipper" text,"Corrected Time d:hh:mm:ss" text) | SELECT "Skipper" FROM table_22433 WHERE "Corrected Time d:hh:mm:ss" = '2:18:31:49' |
show me all flights from ONTARIO to TACOMA one way | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,r... | 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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TACOMA' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = ... |
Show the number of debates for each person on the affirmative side in a bar chart. | CREATE TABLE debate_people (Debate_ID int,Affirmative int,Negative int,If_Affirmative_Win bool)CREATE TABLE people (People_ID int,District text,Name text,Party text,Age int)CREATE TABLE debate (Debate_ID int,Date text,Venue text,Num_of_Audience int) | SELECT Name, COUNT(Name) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Name |
Who was the runner-up on September 11? | CREATE TABLE table_21808535_1 (runner_up VARCHAR,date VARCHAR) | SELECT runner_up FROM table_21808535_1 WHERE date = "September 11" |
How many incumbents are there in district Louisiana 5? | CREATE TABLE table_1341690_18 (incumbent VARCHAR,district VARCHAR) | SELECT COUNT(incumbent) FROM table_1341690_18 WHERE district = "Louisiana 5" |
What play is from the country Belgium? | CREATE TABLE table_name_18 (play VARCHAR,country VARCHAR) | SELECT play FROM table_name_18 WHERE country = "belgium" |
Show the company name with the number of gas station by a bar chart, and show in descending by the y-axis. | CREATE TABLE station_company (Station_ID int,Company_ID int,Rank_of_the_Year int)CREATE TABLE gas_station (Station_ID int,Open_Year int,Location text,Manager_Name text,Vice_Manager_Name text,Representative_Name text)CREATE TABLE company (Company_ID int,Rank int,Company text,Headquarters text,Main_Industry text,Sales_bi... | SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID ORDER BY COUNT(*) DESC |
How many lectures each week does CDB 598 have ? | 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 instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester in... | SELECT (SELECT SUM(CASE WHEN DERIVED_TABLEalias0.FRIDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.MONDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SATURDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SUNDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalia... |
What round had a record of 8-2? | CREATE TABLE table_name_73 (round VARCHAR,record VARCHAR) | SELECT round FROM table_name_73 WHERE record = "8-2" |
What type of settlement is Jazak? | CREATE TABLE table_27893 ("Settlement" text,"Cyrillic Name Other Names" text,"Type" text,"Population (2011)" real,"Largest ethnic group (2002)" text,"Dominant religion (2002)" text) | SELECT "Type" FROM table_27893 WHERE "Settlement" = 'Jazak' |
How many millions of viewers did the episode directed by Jeffrey Blitz have? | CREATE TABLE table_27555 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (million)" text) | SELECT "U.S. viewers (million)" FROM table_27555 WHERE "Directed by" = 'Jeffrey Blitz' |
Which Against is the highest one that has a Difference of 12? | CREATE TABLE table_name_14 (against INTEGER,difference VARCHAR) | SELECT MAX(against) FROM table_name_14 WHERE difference = "12" |
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre? | CREATE TABLE artist (artist_name text,country text,gender text,preferred_genre text)CREATE TABLE files (f_id number,artist_name text,file_size text,duration text,formats text)CREATE TABLE genre (g_name text,rating text,most_popular_in text)CREATE TABLE song (song_name text,artist_name text,country text,f_id number,genr... | SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = "modern") |
What courses do I have to take before I can take CHE 472 ? | CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE area (course_id int,area varchar)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE program_requirement (program_id int... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT... |
What is the smallest amount of points for parmalat forti ford entrant later than 1995? | CREATE TABLE table_name_86 (points INTEGER,entrant VARCHAR,year VARCHAR) | SELECT MIN(points) FROM table_name_86 WHERE entrant = "parmalat forti ford" AND year > 1995 |
What Nationality is Jeff Hornacek? | CREATE TABLE table_52825 ("Player" text,"Nationality" text,"Position" text,"Years for Jazz" text,"School/Club Team" text) | SELECT "Nationality" FROM table_52825 WHERE "Player" = 'jeff hornacek' |
Largest gap in score between question and answer. | CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text te... | SELECT q.Id AS "post_link", a.Id AS "post_link", q.Score, a.Score, a.Score - q.Score AS gap FROM Posts AS q INNER JOIN (SELECT Id, ParentId, Score, PostTypeId, OwnerUserId FROM Posts WHERE PostTypeId = 2) AS a ON q.Id = a.ParentId INNER JOIN Users AS u ON u.Id = a.OwnerUserId WHERE q.PostTypeId = 1 AND (a.Score > q.Sco... |
How many Airspeed Fleet Shadower aircraft are retired? | CREATE TABLE table_13605170_2 (retired VARCHAR,aircraft_type VARCHAR) | SELECT retired FROM table_13605170_2 WHERE aircraft_type = "Airspeed Fleet Shadower" |
What district is incumbent frank chelf from? | CREATE TABLE table_1341884_19 (district VARCHAR,incumbent VARCHAR) | SELECT district FROM table_1341884_19 WHERE incumbent = "Frank Chelf" |
give me the number of patients whose drug code is senn187? | 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 prescriptions.formulary_drug_cd = "SENN187" |
What is the average Mean, when Drug is 'Alcohol', and when Psychological Dependence is greater than 1.9? | CREATE TABLE table_58852 ("Drug" text,"Mean" real,"Pleasure" real,"Psychological dependence" real,"Physical dependence" real) | SELECT AVG("Mean") FROM table_58852 WHERE "Drug" = 'alcohol' AND "Psychological dependence" > '1.9' |
Bar chart x axis nationality y axis sum meter 100, and I want to sort in desc by the X. | CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Openin... | SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC |
Show me the number of all home by all home in a histogram, and could you order by the bars from high to low? | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT All_Home, COUNT(All_Home) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC |
Name the open cup for usl pdl for did not qualify | CREATE TABLE table_26223 ("Year" real,"Division" real,"League" text,"Regular Season" text,"Playoffs" text,"Open Cup" text) | SELECT "Open Cup" FROM table_26223 WHERE "League" = 'USL PDL' AND "Playoffs" = 'Did not qualify' |
Comments including the word 'fixed'. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName ... | SELECT CreationDate, Id AS "comment_link" FROM Comments WHERE LOWER(Text) LIKE '%fixed%' AND CreationDate >= '2018-01-01' ORDER BY LENGTH(Text) LIMIT 1000 |
what's the engine where number range is 8 9, 13 16 | CREATE TABLE table_1181375_1 (engine VARCHAR,number_range VARCHAR) | SELECT engine FROM table_1181375_1 WHERE number_range = "8–9, 13–16" |
what drug was prescribed to patient 65582 within 2 days after having undergone the pancreat sphincteroplas since 02/2105? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREA... | SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 65582 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ... |
What is the Japanese name of the station with a number 3? | CREATE TABLE table_name_98 (japanese VARCHAR,number VARCHAR) | SELECT japanese FROM table_name_98 WHERE number = 3 |
compared to second measured on the current intensive care unit visit, is heartrate of patient 025-50213 less than first measured on the current intensive care unit visit? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio... | SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50213') AND patient.unitdischargetime IS NULL... |
If the latitude is 77 28 n, what is the longitude? | CREATE TABLE table_name_27 (longitude VARCHAR,latitude VARCHAR) | SELECT longitude FROM table_name_27 WHERE latitude = "77°28′n" |
What are the names of the clubs that have players in the position of 'Right Wing'? | CREATE TABLE club (club_id number,name text,region text,start_year text)CREATE TABLE competition (competition_id number,year number,competition_type text,country text)CREATE TABLE player (player_id number,name text,position text,club_id number,apps number,tries number,goals text,points number)CREATE TABLE club_rank (ra... | SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.club_id = T2.club_id WHERE T2.position = "Right Wing" |
get the number of patients born before 2120 who are suffering from sternal wound infection primary disease. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STERNAL WOUND INFECTION" AND demographic.dob_year < "2120" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.