instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
All posts with a given tag, formatted for copying out post links. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmoun... | SELECT q.Id AS "Id", 'http://chemistry.stackexchange.com/q/' + CAST(q.Id AS TEXT(15)) AS "Link" FROM Posts AS q WHERE q.PostTypeId = 1 AND q.Tags LIKE '%<' + @Tag + '>%' ORDER BY q.Id |
Number of users which made their last comment in a given month. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,Cr... | WITH last_cte AS (SELECT UserId, MAX(Id) AS MaxId FROM Comments GROUP BY UserId), dates_cte AS (SELECT c.UserId AS odn, c.Id AS cid, c.CreationDate AS CDate FROM Comments AS c INNER JOIN last_cte ON c.Id = maxid) SELECT LAST_DATE_OF_MONTH(CDate), COUNT(odn) FROM dates_cte GROUP BY LAST_DATE_OF_MONTH(CDate) ORDER BY LAS... |
Which team was the opponent on october 21? | CREATE TABLE table_27734577_2 (team VARCHAR,date VARCHAR) | SELECT team FROM table_27734577_2 WHERE date = "October 21" |
Find password and gender_mf , and visualize them by a bar chart. | CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATETIME,login_name VARCHAR(40),password VARCHAR(10),personal_name VARCHAR(40),middle_name VARCHAR(40),family_name VARCHAR(40))CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VAR... | SELECT password, gender_mf FROM Course_Authors_and_Tutors ORDER BY personal_name |
What is the highest SiO 2, when K 2 O is greater than 0.16, when Fe 2 O 3 is greater than 0.16, and when Na 2 O is less than 7.53? | CREATE TABLE table_name_50 (sio_2 INTEGER,na_2_o VARCHAR,k_2_o VARCHAR,fe_2_o_3 VARCHAR) | SELECT MAX(sio_2) FROM table_name_50 WHERE k_2_o > 0.16 AND fe_2_o_3 > 0.16 AND na_2_o < 7.53 |
Where is the Bellerive Country Club venue located? | CREATE TABLE table_73387 ("Year" real,"Champion" text,"Country" text,"Venue" text,"Location of venue" text,"Winners Score" text,"Winners share ($)" real) | SELECT "Location of venue" FROM table_73387 WHERE "Venue" = 'Bellerive Country Club' |
Who is the opponent for week 5? | CREATE TABLE table_name_96 (opponent VARCHAR,week VARCHAR) | SELECT opponent FROM table_name_96 WHERE week = 5 |
What is the Loser when the winner was los angeles lakers (10)? | CREATE TABLE table_6902 ("Year" text,"Playoff round" text,"Venue" text,"Winner" text,"Result" text,"Loser" text) | SELECT "Loser" FROM table_6902 WHERE "Winner" = 'los angeles lakers (10)' |
How many places named asan-maina? | CREATE TABLE table_28161 ("Village" text,"Area km\u00b2" text,"Population (2000 census)" real,"Region" text,"Pop. Density" real) | SELECT COUNT("Region") FROM table_28161 WHERE "Village" = 'Asan-Maina' |
Show the number of documents in different starting date and bin starting date by year interval with a line chart. | CREATE TABLE Roles (Role_Code CHAR(15),Role_Name VARCHAR(255),Role_Description VARCHAR(255))CREATE TABLE Document_Locations (Document_ID INTEGER,Location_Code CHAR(15),Date_in_Location_From DATETIME,Date_in_Locaton_To DATETIME)CREATE TABLE Employees (Employee_ID INTEGER,Role_Code CHAR(15),Employee_Name VARCHAR(255),Gen... | SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations |
What is the Home team in the Game with a Score of 1 0? | CREATE TABLE table_62593 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Home team" FROM table_62593 WHERE "Score" = '1–0' |
how many patients of asian ethnicity are administered additive drug types? | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug_type = "ADDITIVE" |
what is the minimum amylase value until 10 months ago for patient 005-86645? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient... | SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-86645')) AND lab.labname = 'amylase' AND DATETIME(lab.labresulttime) <= DATETI... |
what 's the number of schools represented in the table ? | CREATE TABLE table_203_721 (id number,"school" text,"location" text,"control" text,"type" text,"enrollment" number,"founded" number) | SELECT COUNT("school") FROM table_203_721 |
What is the Name of the person from the Netherlands in a Lane lower than 5, with a Rank better than 5, and a time of less than 55.62? | CREATE TABLE table_71937 ("Rank" real,"Lane" real,"Name" text,"Nationality" text,"Time" real) | SELECT "Name" FROM table_71937 WHERE "Rank" < '5' AND "Time" < '55.62' AND "Lane" < '5' AND "Nationality" = 'netherlands' |
Who is the runner-up where the winning score is 8 (71-69-67-73=280)? | CREATE TABLE table_name_45 (runner_s__up VARCHAR,winning_score VARCHAR) | SELECT runner_s__up FROM table_name_45 WHERE winning_score = –8(71 - 69 - 67 - 73 = 280) |
Please give me a pie chart to show the proportion of end stations for the trips with the three smallest ids? | CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time TEXT)CREATE TABLE station (id INTEGER,name TEXT,lat NUMERIC,long NUMERIC,dock_count INTEGER,city TEXT,installation_date TEXT)CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_i... | SELECT end_station_name, COUNT(end_station_name) FROM trip GROUP BY end_station_name ORDER BY id LIMIT 3 |
What round had the opponent Lyon? | CREATE TABLE table_40547 ("Round" text,"Opposition" text,"First leg" text,"Second leg" text,"Aggregate score" text) | SELECT "Round" FROM table_40547 WHERE "Opposition" = 'lyon' |
What is the name/designation for the 1200kg payload? | CREATE TABLE table_name_81 (name_designation VARCHAR,payload VARCHAR) | SELECT name_designation FROM table_name_81 WHERE payload = "1200kg" |
Give the average quantity of stocks. | CREATE TABLE stock (shop_id number,device_id number,quantity number)CREATE TABLE shop (shop_id number,shop_name text,location text,open_date text,open_year number)CREATE TABLE device (device_id number,device text,carrier text,package_version text,applications text,software_platform text) | SELECT AVG(quantity) FROM stock |
Answer score as a function of length. Plots average answer score, +/- 1 standard deviation, as a function of binned answer length. | CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score numb... | SELECT Score, LENGTH(Body) FROM Posts WHERE PostTypeId = 2 AND LENGTH(Body) <= 20000 |
Visualize a line chart about the change of the sum of monthly_rental over date_address_to , and group by attribute other_details. | CREATE TABLE Students_in_Detention (student_id INTEGER,detention_id INTEGER,incident_id INTEGER)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_d... | SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details, date_address_to ORDER BY monthly_rental DESC |
Who was the pilot of max altitude of 55.9 miles? | CREATE TABLE table_24791 ("Pilot" text,"Organization" text,"Total Flights" real,"USAF space flights" real,"FAI space flights" real,"Max Mach" text,"Max speed (mph)" real,"Max altitude (miles)" text) | SELECT "Pilot" FROM table_24791 WHERE "Max altitude (miles)" = '55.9' |
Find the number of the physicians who are trained in a procedure that costs more than 5000. | CREATE TABLE Patient (SSN INTEGER,Name VARCHAR(30),Address VARCHAR(30),Phone VARCHAR(30),InsuranceID INTEGER,PCP INTEGER)CREATE TABLE Prescribes (Physician INTEGER,Patient INTEGER,Medication INTEGER,Date DATETIME,Appointment INTEGER,Dose VARCHAR(30))CREATE TABLE Department (DepartmentID INTEGER,Name VARCHAR(30),Head IN... | SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name |
What is Money ( $ ), when Score is '75-71-72-70=288'? | CREATE TABLE table_7944 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" text) | SELECT "Money ( $ )" FROM table_7944 WHERE "Score" = '75-71-72-70=288' |
Which Round is the highest one that has an Overall of 32, and a Pick # smaller than 4? | CREATE TABLE table_38343 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT MAX("Round") FROM table_38343 WHERE "Overall" = '32' AND "Pick #" < '4' |
What is the location and what was the attendance on those days when the score was 3-5-1? | CREATE TABLE table_27537870_3 (location_attendance VARCHAR,record VARCHAR) | SELECT location_attendance FROM table_27537870_3 WHERE record = "3-5-1" |
What is the relationship between Team_ID and ACC_Percent , and group by attribute All_Road? | CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY All_Road |
For which Game 4 did Michael O'Connor play during Game 1? | CREATE TABLE table_58356 ("Position" text,"Game 1" text,"Game 2" text,"Game 3" text,"Game 4" text) | SELECT "Game 4" FROM table_58356 WHERE "Game 1" = 'michael o''connor' |
how many hours have passed since first time that patient 027-32001 stayed in ward 962 during the current hospital encounter? | 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 treatment (treatmentid number,patientunitstayid number,treatmentname text,... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '027-32001' AND patient.wardid = 962 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
how many patients whose procedure long title is colonoscopy? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Colonoscopy" |
For those employees who did not have any job in the past, give me the comparison about the average of salary over the hire_date bin hire_date by weekday by a bar chart, and show in desc by the Y. | CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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),MANA... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(SALARY) DESC |
Which Color commentator has a Channel of fsn new england, and a Year of 2004-05? | CREATE TABLE table_name_41 (color_commentator_s_ VARCHAR,channel VARCHAR,year VARCHAR) | SELECT color_commentator_s_ FROM table_name_41 WHERE channel = "fsn new england" AND year = "2004-05" |
When was the ship launched when the commissioned or completed(*) is 6 june 1864? | CREATE TABLE table_12592074_1 (launched VARCHAR,commissioned_or_completed_ VARCHAR,_ VARCHAR) | SELECT launched FROM table_12592074_1 WHERE commissioned_or_completed_ * _ = "6 June 1864" |
What is the silver when the Total is 1, and Gold is 1? | CREATE TABLE table_64128 ("Rank" real,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Silver") FROM table_64128 WHERE "Total" = '1' AND "Gold" = '1' |
Tell me the total number of administrative panel with labour panel more than 2, nominated by taoiseach more than 6 and total of 28 | CREATE TABLE table_name_59 (administrative_panel VARCHAR,nominated_by_the_taoiseach VARCHAR,labour_panel VARCHAR,total VARCHAR) | SELECT COUNT(administrative_panel) FROM table_name_59 WHERE labour_panel > 2 AND total = 28 AND nominated_by_the_taoiseach > 6 |
Which opponent played in game 3 before October 18? | CREATE TABLE table_47327 ("Game" real,"October" real,"Opponent" text,"Score" text,"Record" text) | SELECT "Opponent" FROM table_47327 WHERE "October" < '18' AND "Game" = '3' |
How many dances did Warren & Kym have? | CREATE TABLE table_17862135_3 (number_of_dances VARCHAR,couple VARCHAR) | SELECT number_of_dances FROM table_17862135_3 WHERE couple = "Warren & Kym" |
How did the match end when his record was 15-11? | CREATE TABLE table_name_37 (method VARCHAR,record VARCHAR) | SELECT method FROM table_name_37 WHERE record = "15-11" |
Last posts with negative score. | 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,Text text,ContentLicense text)CREATE TABLE CloseReasonTypes (Id numb... | SELECT 'id' AS "post_link", 'score', 'creationdate', 'closeddate', 'body' FROM Posts WHERE Score < -10 ORDER BY CreationDate DESC LIMIT 50 |
What is the area of Mangamahu primary school? | CREATE TABLE table_69299 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real) | SELECT "Area" FROM table_69299 WHERE "Name" = 'mangamahu primary school' |
What is the series number of the episode that aired March 25, 2010? | CREATE TABLE table_2891 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"U.S. viewers (million)" text,"Original air date" text,"Production code" real) | SELECT MIN("No. in series") FROM table_2891 WHERE "Original air date" = 'March 25, 2010' |
Who is the chairman when teh captain is fawzi bashir? | CREATE TABLE table_27631756_2 (chairman VARCHAR,captain VARCHAR) | SELECT chairman FROM table_27631756_2 WHERE captain = "Fawzi Bashir" |
What season had a game in the first round with a result of 4 1, 0 1? | CREATE TABLE table_40855 ("Season" text,"Round" text,"Country" text,"Opponent" text,"Result" text) | SELECT "Season" FROM table_40855 WHERE "Round" = 'first round' AND "Result" = '4–1, 0–1' |
What writer has mort drucker as the artist, an issue greater than 470, and law & order: svu as an actual title? | CREATE TABLE table_42044 ("Actual Title" text,"Writer" text,"Artist" text,"Issue" real,"Date" text) | SELECT "Writer" FROM table_42044 WHERE "Artist" = 'mort drucker' AND "Issue" > '470' AND "Actual Title" = 'law & order: svu' |
What is Charlie Wi's To par? | CREATE TABLE table_name_29 (to_par VARCHAR,player VARCHAR) | SELECT to_par FROM table_name_29 WHERE player = "charlie wi" |
Which Set 3 has a Set 1 of 25 20? | CREATE TABLE table_71103 ("Date" text,"Time" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Total" text,"Report" text) | SELECT "Set 3" FROM table_71103 WHERE "Set 1" = '25–20' |
Show all main industry and total market value in each industry by a bar chart, show in asc by the x-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 Main_Industry, SUM(Market_Value) FROM company GROUP BY Main_Industry ORDER BY Main_Industry |
Return a pie chart about the proportion of All_Games and School_ID. | 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_Games, School_ID FROM basketball_match |
In which county is the swann covered bridge located? | CREATE TABLE table_name_4 (county VARCHAR,name VARCHAR) | SELECT county FROM table_name_4 WHERE name = "swann covered bridge" |
What is the least number of laps for the driver Jo Siffert? | CREATE TABLE table_54424 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT MIN("Laps") FROM table_54424 WHERE "Driver" = 'jo siffert' |
among patients diagnosed with fever in other diseases, how many of them were female? | CREATE TABLE procedures (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,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | 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 = "Fever in other diseases" |
How many losses for the coach that coached 19 games? | CREATE TABLE table_14594528_6 (losses VARCHAR,games VARCHAR) | SELECT losses FROM table_14594528_6 WHERE games = 19 |
What is the Latitude of the monument built in 1901? | CREATE TABLE table_name_83 (latitude VARCHAR,year_built VARCHAR) | SELECT latitude FROM table_name_83 WHERE year_built = 1901 |
What is the total amount of money spent by Lucas Mancini? | CREATE TABLE playlists (id number,name text)CREATE TABLE invoices (id number,customer_id number,invoice_date time,billing_address text,billing_city text,billing_state text,billing_country text,billing_postal_code text,total number)CREATE TABLE albums (id number,title text,artist_id number)CREATE TABLE artists (id numbe... | SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini" |
Which Yellow Cards has a Season of 1999/2000? | CREATE TABLE table_name_75 (yellow_cards INTEGER,season VARCHAR) | SELECT AVG(yellow_cards) FROM table_name_75 WHERE season = "1999/2000" |
What is the French translation for the English word 'orange'? | CREATE TABLE table_2077192_2 (french VARCHAR,english VARCHAR) | SELECT french FROM table_2077192_2 WHERE english = "orange" |
What is the lowest overall for a quarterback with fewer than 7 rounds? | CREATE TABLE table_35542 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT MIN("Overall") FROM table_35542 WHERE "Position" = 'quarterback' AND "Round" < '7' |
What is the lowest number of participants in 2013 when there were more than 5 participants in 2010, less than 4 participants in 2012 and country was germany? | CREATE TABLE table_name_34 (country VARCHAR) | SELECT MIN(2013) FROM table_name_34 WHERE 2010 > 5 AND country = "germany" AND 2012 < 4 |
FILMVID 490 has been taught by who in the past ? | CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree varchar,minor varchar,internship varchar)CREATE TABLE semester (semester_id int,semester varchar,year i... | SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester... |
Which round did Dundee United end in? | CREATE TABLE table_70025 ("Season" text,"Competition" text,"Round" text,"Club" text,"Home" text,"Away" text,"Aggregate" text) | SELECT "Round" FROM table_70025 WHERE "Club" = 'dundee united' |
What species has more than 2,030 genes? | CREATE TABLE table_54518 ("Species" text,"Strain" text,"Type" text,"Base Pairs" real,"Genes" real) | SELECT "Species" FROM table_54518 WHERE "Genes" > '2,030' |
show me flights from DENVER to BOSTON on thursday | CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE fli... | 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 = 'BOSTON' AND date_day.day_number = 24 AND date_day.month_number = 5 AND da... |
Name the least wins for 6 points | CREATE TABLE table_67186 ("Year" real,"Class" text,"Team" text,"Points" real,"Rank" text,"Wins" real) | SELECT MIN("Wins") FROM table_67186 WHERE "Points" = '6' |
Who is the driver for laps of 45 | CREATE TABLE table_56711 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Driver" FROM table_56711 WHERE "Laps" = '45' |
what is maximum age of patients whose gender is m and admission type is emergency? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id te... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "EMERGENCY" |
what is the difference between the hct of patient 030-8973 second measured on the first hospital visit compared to the first value measured on the first hospital visit? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit... |
what are the four most frequent procedures that patients were given during the same month after receiving medicine consultation in the previous year? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname... | 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 = 'medicine consultation' AND DATETIME(trea... |
Show the industries shared by companies whose headquarters are 'USA' and companies whose headquarters are 'China'. | CREATE TABLE Companies (Industry VARCHAR,Headquarters VARCHAR) | SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China" |
Name the Opponent in the final on july 4, 2005? | CREATE TABLE table_61457 ("Date" text,"Tournament" text,"Surface" text,"Partnering" text,"Opponent in the final" text,"Score" text) | SELECT "Opponent in the final" FROM table_61457 WHERE "Date" = 'july 4, 2005' |
What is the latest year in Annecy, France? | CREATE TABLE table_11664 ("Year" real,"Tournament" text,"Venue" text,"Result" text,"Extra" text) | SELECT MAX("Year") FROM table_11664 WHERE "Venue" = 'annecy, france' |
how many industrial neighborhoods exist in calgary ? | CREATE TABLE table_203_642 (id number,"name" text,"quadrant" text,"sector" text,"ward" text,"type" text,"2012\npopulation\nrank" number,"population\n(2012)" number,"population\n(2011)" number,"% change" number,"dwellings\n(2012)" number,"area\n(km2)" number,"population\ndensity" number) | SELECT COUNT(*) FROM table_203_642 WHERE "type" = 'industrial' |
What was the score on September 1, 1996? | CREATE TABLE table_11214 ("Week" text,"Date" text,"Opponent" text,"Result" text,"Kickoff [a ]" text,"Game site" text,"Attendance" text,"Record" text) | SELECT "Result" FROM table_11214 WHERE "Date" = 'september 1, 1996' |
When was Alianza's first season in first division with a promotion after 1959? | CREATE TABLE table_name_63 (first_season_in_first_division VARCHAR,first_season_after_most_recent_promotion VARCHAR,name VARCHAR) | SELECT first_season_in_first_division FROM table_name_63 WHERE first_season_after_most_recent_promotion = "1959" AND name = "alianza" |
Who used Gordini Straight-6 in 1956? | CREATE TABLE table_80084 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT "Entrant" FROM table_80084 WHERE "Engine" = 'gordini straight-6' AND "Year" = '1956' |
how many patients were born before the year 2041 and had 3761 as their procedure icd9 code? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2041" AND procedures.icd9_code = "3761" |
Who was the artist for Spoofed title Genteel Ben in an issue later than 74? | CREATE TABLE table_42688 ("Spoofed Title" text,"Writer" text,"Artist" text,"Issue" real,"Date" text) | SELECT "Artist" FROM table_42688 WHERE "Issue" > '74' AND "Spoofed Title" = 'genteel ben' |
For all employees who have the letters D or S in their first name, visualize a scatter chart about the correlation between employee_id and salary . | 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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JO... | SELECT EMPLOYEE_ID, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' |
provide the number of patients whose drug code is levo500pm? | 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 prescriptions.formulary_drug_cd = "LEVO500PM" |
Questions by month per tag. Question count for a particular tag | 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 Comments (Id number,PostId number,Score number,Text text,Creati... | SELECT TIME_TO_STR(p.CreationDate, '%Y') AS Year, TIME_TO_STR(p.CreationDate, '%m') AS Month, COUNT(*) AS questions FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId GROUP BY TIME_TO_STR(p.CreationDate, '%Y'), TIME_TO_STR(p.CreationDate, '%m') ORDER BY TIME_TO_STR(p.CreationDate,... |
Name the played with lost of 5 | CREATE TABLE table_71374 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Played" FROM table_71374 WHERE "Lost" = '5' |
What is the production code for episode number 86 in the series? | CREATE TABLE table_26544 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real) | SELECT MIN("Production code") FROM table_26544 WHERE "No. in series" = '86' |
which album had the most chart reaching singles ? | CREATE TABLE table_203_751 (id number,"year" number,"title" text,"peak chart positions\nus\nair" number,"peak chart positions\nus\nmain" number,"peak chart positions\nus\nmod" number,"album" text) | SELECT "album" FROM table_203_751 GROUP BY "album" ORDER BY COUNT(*) DESC LIMIT 1 |
What is Notes, when Date is 2007? | CREATE TABLE table_name_9 (notes VARCHAR,date VARCHAR) | SELECT notes FROM table_name_9 WHERE date = "2007" |
on what album did the single old habits die hard appear ? | CREATE TABLE table_200_22 (id number,"year" number,"single" text,"peak chart positions\nger" number,"peak chart positions\nire" number,"peak chart positions\nuk" number,"peak chart positions\nus" number,"peak chart positions\nus\nmain" number,"peak chart positions\nus\ndance" number,"certifications\n(sales thresholds)"... | SELECT "year" FROM table_200_22 WHERE "single" = '"old habits die hard"' |
tell me the length of the last stay of patient 12938 in the icu. | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)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)CREA... | SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12938) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1 |
Please use a bar chart to show the total amount of payment by each payment method code, and rank by the Payment_Method_Code in ascending. | CREATE TABLE Settlements (Settlement_ID INTEGER,Claim_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER,Customer_Policy_ID INTEGER)CREATE TABLE Customers (Customer_ID INTEGER,Customer_Details VARCHAR(255))CREATE TABLE Claims (Claim_ID INTEGER,Policy_ID INTEGER,Date_Cl... | SELECT Payment_Method_Code, SUM(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code ORDER BY Payment_Method_Code |
Would SAC 480 be easier than SAC 600 ? | CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE ta (campus_job_id int,student_id ... | SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, program_course AS PROGRAM_COURSE_0, program_course AS PROGRAM_COURSE_1 WHERE COURSE_0.department = 'SAC' AND COURSE_0.number = 600 AND COURSE_1.department = 'SAC' AND COURSE_1.number = 480 AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id AND PROGRAM_CO... |
What is 2009, when 2008 is 1R, and when Tournament is French Open? | CREATE TABLE table_41955 ("Tournament" text,"1993" text,"1994" text,"1995" text,"1996" text,"1997" text,"1998" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text) | SELECT "2009" FROM table_41955 WHERE "2008" = '1r' AND "Tournament" = 'french open' |
How many colleges have the NFL Team Buffalo Bills? | CREATE TABLE table_2508633_11 (college VARCHAR,nfl_team VARCHAR) | SELECT COUNT(college) FROM table_2508633_11 WHERE nfl_team = "Buffalo Bills" |
Return a bar chart about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road, list in desc by the Y please. | 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 ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(Team_ID) DESC |
How many people are under 40 for each gender. Plot them as bar chart. | CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER) | SELECT gender, COUNT(*) FROM Person WHERE age < 40 GROUP BY gender |
If the grand average is 12.76-202, who is the player? | CREATE TABLE table_27533947_1 (players VARCHAR,grand_average VARCHAR) | SELECT players FROM table_27533947_1 WHERE grand_average = "12.76-202" |
bin the yearid into the day of the week interval and count them for visualizing a bar chart. | CREATE TABLE manager_half (player_id TEXT,year INTEGER,team_id TEXT,league_id TEXT,inseason INTEGER,half INTEGER,g INTEGER,w INTEGER,l INTEGER,rank INTEGER)CREATE TABLE pitching (player_id TEXT,year INTEGER,stint INTEGER,team_id TEXT,league_id TEXT,w INTEGER,l INTEGER,g INTEGER,gs INTEGER,cg INTEGER,sho INTEGER,sv INTE... | SELECT yearid, COUNT(yearid) FROM hall_of_fame |
Who is the 2008 head coach of UCLA? | CREATE TABLE table_name_7 (team VARCHAR) | SELECT 2008 AS _head_coach FROM table_name_7 WHERE team = "ucla" |
What player has 477 runs? | CREATE TABLE table_21100348_11 (player VARCHAR,runs VARCHAR) | SELECT player FROM table_21100348_11 WHERE runs = 477 |
Agri culture b larger than 12.6, what is the lowest vehicles per 1000? | CREATE TABLE table_6460 ("District" text,"2010 Population (000)" real,"2008 GDP (USD bn) a" real,"2008 GDP per capita (USD) a" real,"Agri culture b" real,"Mining b" real,"Manufac turing b" real,"Services & cons truction b" real,"Exports (USD mn) 2011" text,"Median mo. salary (USD) a e" real,"Vehicles (per 1000) d" real... | SELECT MIN("Vehicles (per 1000) d") FROM table_6460 WHERE "Agri culture b" > '12.6' |
name the date where score time is w 74-63 | CREATE TABLE table_72853 ("Game" real,"Date" text,"Opponent" text,"Score/Time" text,"High points" text,"High rebounds" text,"High assists" text,"Arena/Attendance" text,"Record" text) | SELECT "Date" FROM table_72853 WHERE "Score/Time" = 'W 74-63' |
let me know the number of patients born before 1882 who had delta abnormal lab test status. | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1882" AND lab.flag = "delta" |
Top SO Users from Malaga. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Descr... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%malaga%' OR UPPER(Location) LIKE '%MALAGA%' OR Location LIKE '%Malaga%' AND Reputation >= 1000 ORDER BY Reputation DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.