instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
count the number of patients whose days of hospital stay is greater than 1 and drug name is aspirin ec? | 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.days_stay > "1" AND prescriptions.drug = "Aspirin EC" |
What is the name of the episode that had 8.51 million viewers? | CREATE TABLE table_28326 ("Episode #" real,"Series #" real,"Title" text,"Director" text,"Writer" text,"Original airdate" text,"Viewers (in millions)" text) | SELECT "Title" FROM table_28326 WHERE "Viewers (in millions)" = '8.51' |
Which method had a 3 rounds, result in a loss and the Juiz de Fora - fight 1 event? | CREATE TABLE table_name_86 (method VARCHAR,event VARCHAR,round VARCHAR,res VARCHAR) | SELECT method FROM table_name_86 WHERE round = "3" AND res = "loss" AND event = "juiz de fora - fight 1" |
How much Elevation (m) has a Prominence (m) larger than 1,754? | CREATE TABLE table_name_45 (elevation__m_ INTEGER,prominence__m_ INTEGER) | SELECT SUM(elevation__m_) FROM table_name_45 WHERE prominence__m_ > 1 OFFSET 754 |
Who had the most assists and how many did they have on October 7? | CREATE TABLE table_74177 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High assists" FROM table_74177 WHERE "Date" = 'October 7' |
What was the partner count when the opponents in the final was forget leconte? | CREATE TABLE table_25155 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT COUNT("Partner") FROM table_25155 WHERE "Opponents in the final" = 'Forget Leconte' |
Upvoted questions closed as duplicate of downvoted one. | 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 s.Id AS "post_link", s.Score, MAX(t.Score) AS tScore FROM Posts AS t INNER JOIN PostLinks AS l ON t.Id = l.RelatedPostId INNER JOIN Posts AS s ON s.Id = l.PostId WHERE s.Score >= '##minscore:int?20##' AND l.LinkTypeId = 3 GROUP BY s.Id, s.Score ORDER BY MAX(t.Score) LIMIT 200 |
When it is October 25, 1981 who is the opponent? | CREATE TABLE table_72614 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" real) | SELECT "Opponent" FROM table_72614 WHERE "Date" = 'October 25, 1981' |
Who was the originally artist when Jasmine Murray was selected? | CREATE TABLE table_21501564_1 (original_artist VARCHAR,result VARCHAR) | SELECT original_artist FROM table_21501564_1 WHERE result = "Selected" |
How many catholic religious background patients had a wbc pleural lab test? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "WBC, Pleural" |
Name the vote for 9th voted out day 22 | CREATE TABLE table_26700 ("Episode" real,"Airdate" text,"Reward" text,"Immunity" text,"Eliminated" text,"Vote" text,"Finish" text) | SELECT "Vote" FROM table_26700 WHERE "Finish" = '9th Voted Out Day 22' |
What are the names of counties that do not contain any cities? | CREATE TABLE county_public_safety (county_id number,name text,population number,police_officers number,residents_per_officer number,case_burden number,crime_rate number,police_force text,location text)CREATE TABLE city (city_id number,county_id number,name text,white number,black number,amerindian number,asian number,m... | SELECT name FROM county_public_safety WHERE NOT county_id IN (SELECT county_id FROM city) |
Which tennis team is from the United States? | CREATE TABLE table_name_55 (team VARCHAR,sport VARCHAR,nation_of_citizenship VARCHAR) | SELECT team FROM table_name_55 WHERE sport = "tennis" AND nation_of_citizenship = "united states" |
Top 100 Accepted Answers Without Up-Votes. | CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT question_id = q.Id, question_url = 'https://stackoverflow.com/q/' + CAST(q.Id AS TEXT(255)), q.ClosedDate, accepted_answer_id = a.Id, accepted_answer_url = 'https://stackoverflow.com/a/' + CAST(a.Id AS TEXT(255)), answer_score = a.Score FROM dbo.Posts AS q INNER JOIN dbo.Posts AS a ON a.Id = q.AcceptedAnswerId W... |
Name the type for headquarters principal activites. | CREATE TABLE table_name_53 (type VARCHAR,principal_activities VARCHAR) | SELECT type FROM table_name_53 WHERE principal_activities = "headquarters" |
when did patient 018-99743 visit the hospital via emergency department for the last time since 6 years ago? | 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 allergy (allergyid number,patientunitstayid number,drugname text,allergyna... | SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '018-99743' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-6 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
How many episodes had 11.86 million US viewers? | CREATE TABLE table_30413 ("No. in Series" real,"No. in Season" real,"Title" text,"Directed by" text,"Written by" text,"U.S. viewers (millions)" text,"Original air date" text) | SELECT COUNT("No. in Series") FROM table_30413 WHERE "U.S. viewers (millions)" = '11.86' |
What was the loss of the game against the Angels with a 26-30 record? | CREATE TABLE table_name_9 (loss VARCHAR,opponent VARCHAR,record VARCHAR) | SELECT loss FROM table_name_9 WHERE opponent = "angels" AND record = "26-30" |
find the cheapest one way fare from PITTSBURGH to SAN FRANCISCO | CREATE TABLE code_description (code varchar,description text)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)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 te... | SELECT DISTINCT fare.fare_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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c... |
Visualize a bar chart for what are the first names and ids for customers who have two or more accounts?, and order from high to low by the bars. | CREATE TABLE Invoice_Line_Items (order_item_id INTEGER,invoice_number INTEGER,product_id INTEGER,product_title VARCHAR(80),product_quantity VARCHAR(50),product_price DECIMAL(19,4),derived_product_cost DECIMAL(19,4),derived_vat_payable DECIMAL(19,4),derived_total_cost DECIMAL(19,4))CREATE TABLE Accounts (account_id INTE... | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.customer_first_name DESC |
Which School has an IHSAA Class of aaa, and a Mascot of saints? | CREATE TABLE table_name_76 (school VARCHAR,ihsaa_class VARCHAR,mascot VARCHAR) | SELECT school FROM table_name_76 WHERE ihsaa_class = "aaa" AND mascot = "saints" |
What was the Outcome in 1983 of the WD Event? | CREATE TABLE table_name_11 (outcome VARCHAR,event VARCHAR,year VARCHAR) | SELECT outcome FROM table_name_11 WHERE event = "wd" AND year = "1983" |
What are the average star ratings of each movie title? Could you return me a bar chart?, rank in desc by the Y please. | CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)CREATE TABLE Movie (mID int,title text,year int,director text) | SELECT title, AVG(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY AVG(stars) DESC |
Who was No. 3 when No. 5 James and No. 6 Mason? | CREATE TABLE table_9100 ("Region (year)" text,"No. 1" text,"No. 2" text,"No. 3" text,"No. 4" text,"No. 5" text,"No. 6" text,"No. 7" text,"No. 8" text,"No. 9" text,"No. 10" text) | SELECT "No. 3" FROM table_9100 WHERE "No. 5" = 'james' AND "No. 6" = 'mason' |
How tall is Daniel Orton? | CREATE TABLE table_name_93 (height VARCHAR,player VARCHAR) | SELECT height FROM table_name_93 WHERE player = "daniel orton" |
what is the ingesting method of vitamins/minerals po tabs? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number... | SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'vitamins/minerals po tabs' |
What driver has grid 2 and over 72 laps? | CREATE TABLE table_55538 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Driver" FROM table_55538 WHERE "Laps" > '72' AND "Grid" = '2' |
total number of medals earned by the 8th place finishers | CREATE TABLE table_204_232 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT SUM("total") FROM table_204_232 WHERE "rank" = 8 |
what is the earliest flight you have leaving BOSTON heading to PHILADELPHIA | CREATE TABLE flight_fare (flight_id int,fare_id int)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,round_trip_required varchar)CREATE TABLE compartment_class (compartment varchar,class_type va... | 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILAD... |
how many players were playing in 1990 ? | CREATE TABLE table_203_753 (id number,"rank" number,"name" text,"caps" number,"goals" number,"years" text) | SELECT COUNT("name") FROM table_203_753 WHERE "years" <= 1990 AND "years" >= 1990 |
kenneth mcalpine drove from which entrant? | CREATE TABLE table_name_23 (entrant VARCHAR,driver VARCHAR) | SELECT entrant FROM table_name_23 WHERE driver = "kenneth mcalpine" |
What is the status of the pterosaur named Cathayopterus? | CREATE TABLE table_name_40 (status VARCHAR,name VARCHAR) | SELECT status FROM table_name_40 WHERE name = "cathayopterus" |
What is the Quantity of Type 2-4-2t? | CREATE TABLE table_name_76 (quantity INTEGER,type VARCHAR) | SELECT SUM(quantity) FROM table_name_76 WHERE type = "2-4-2t" |
what is the number of patients whose age is less than 85 and lab test name is epithelial cells? | 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 lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "85" AND lab.label = "Epithelial Cells" |
What is the party affiliation for Senator David Goodman? | CREATE TABLE table_26129220_2 (party VARCHAR,senator VARCHAR) | SELECT party FROM table_26129220_2 WHERE senator = "David Goodman" |
What is the result at match reports? | CREATE TABLE table_66556 ("Date" text,"Location" text,"Lineup" text,"Assist/pass" text,"Score" text,"Result" text,"Competition" text) | SELECT "Result" FROM table_66556 WHERE "Location" = 'match reports' |
Finding Posts tagged only homework, which are not closed. | CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT Posts.Id, Posts.Id AS "post_link" FROM Posts WHERE Tags = '<homework>' AND ClosedDate IS NULL ORDER BY Posts.LastEditDate |
Show me manager_id by last name in a histogram, I want to display names in asc order please. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))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 regions (REGION_ID decimal(5,0),R... | SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY LAST_NAME |
Which venues were closed because they were replaced? | CREATE TABLE table_name_5 (location VARCHAR,reason VARCHAR) | SELECT location FROM table_name_5 WHERE reason = "replaced" |
What is the Place of the half marathon Event? | CREATE TABLE table_79202 ("Country" text,"Event" text,"Time" text,"Date" text,"Place" text) | SELECT "Place" FROM table_79202 WHERE "Event" = 'half marathon' |
What is the tournament of aug 29? | CREATE TABLE table_11621747_1 (tournament VARCHAR,date VARCHAR) | SELECT tournament FROM table_11621747_1 WHERE date = "Aug 29" |
What was the away team's score at windy hill? | CREATE TABLE table_56071 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team score" FROM table_56071 WHERE "Venue" = 'windy hill' |
how many of the unmarried patients had icd9 code 4610? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.icd9_code = "4610" |
what number of patients admitted before the year 2200 had procedure under procedure icd9 code 3612? | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2200" AND procedures.icd9_code = "3612" |
Which English has Plautdietsch of aupel? | CREATE TABLE table_name_64 (english VARCHAR,plautdietsch VARCHAR) | SELECT english FROM table_name_64 WHERE plautdietsch = "aupel" |
What is the population of each community with city status? | CREATE TABLE table_21379 ("Official Name" text,"Status" text,"Area km 2" text,"Population" real,"Census Ranking" text) | SELECT "Population" FROM table_21379 WHERE "Status" = 'City' |
what is the pennant when the builder is yarrow, scotstoun? | CREATE TABLE table_52767 ("Name" text,"Pennant" text,"Builder" text,"Laid Down" text,"Launched" text,"Commissioned" text) | SELECT "Pennant" FROM table_52767 WHERE "Builder" = 'yarrow, scotstoun' |
what is average age of patients whose age is greater than or equal to 74 and admission year is greater than or equal to 2105? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.age >= "74" AND demographic.admityear >= "2105" |
What was the record on April 8? | CREATE TABLE table_name_53 (record VARCHAR,date VARCHAR) | SELECT record FROM table_name_53 WHERE date = "april 8" |
Which Game is the average one that has a February larger than 20, and a Record of 41 17 4, and Points smaller than 86? | CREATE TABLE table_name_23 (game INTEGER,points VARCHAR,february VARCHAR,record VARCHAR) | SELECT AVG(game) FROM table_name_23 WHERE february > 20 AND record = "41–17–4" AND points < 86 |
Which 2009 has a 2008 of wta premier mandatory tournaments? | CREATE TABLE table_name_64 (Id VARCHAR) | SELECT 2009 FROM table_name_64 WHERE 2008 = "wta premier mandatory tournaments" |
what was patient 005-77687's systemicmean average on last month/27? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE diagnosis (diagnosi... | SELECT AVG(vitalperiodic.systemicmean) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-77687')) AND NOT vitalperiodic.systemicmean I... |
What is the Transfer fee, when the Transfer window is 'winter', and when the item 'Moving to' is Northwich Victoria? | CREATE TABLE table_name_94 (transfer_fee VARCHAR,transfer_window VARCHAR,moving_to VARCHAR) | SELECT transfer_fee FROM table_name_94 WHERE transfer_window = "winter" AND moving_to = "northwich victoria" |
When the tournament winner was virginia tech, who won player of the year? | CREATE TABLE table_2434 ("Conference" text,"Regular Season Winner" text,"Conference Player of the Year" text,"Conference Tournament" text,"Tournament Venue (City)" text,"Tournament Winner" text) | SELECT "Conference Player of the Year" FROM table_2434 WHERE "Tournament Winner" = 'Virginia Tech' |
when did patient 031-24513 receive for the first time a sputum, tracheal specimen microbiology test? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,... | SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-24513')) AND microlab.culturesite = 'sputum, tracheal specime... |
how many games did they win by at least 5 points ? | CREATE TABLE table_204_418 (id number,"date" text,"opponent" text,"score" text,"overall record" text,"scba record" text) | SELECT COUNT(*) FROM table_204_418 WHERE "score" - "score" >= 5 |
what are the five most frequent medicines prescribed within the same month to the patients aged 60 or above after being diagnosed with bph w/o urinary obs/luts? | 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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE transfers (... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products? | CREATE TABLE order_items (order_item_id number,order_id number,product_id number)CREATE TABLE department_store_chain (dept_store_chain_id number,dept_store_chain_name text)CREATE TABLE departments (department_id number,dept_store_id number,department_name text)CREATE TABLE customers (customer_id number,payment_method_c... | SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM products) |
Find the name and email of the users who have more than 1000 followers. | CREATE TABLE user_profiles (name VARCHAR,email VARCHAR,followers INTEGER) | SELECT name, email FROM user_profiles WHERE followers > 1000 |
What is the average number of points of the team with more than 18 played? | CREATE TABLE table_33989 ("Position" real,"Team" text,"Played" real,"Wins" real,"Draws" real,"Losses" real,"Scored" real,"Conceded" real,"Points" real) | SELECT AVG("Points") FROM table_33989 WHERE "Played" > '18' |
how many hours has elapsed since patient 18866 last received a laboratory test of alkaline phosphatase on their current hospital encounter? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'alkaline phosphatase') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18866 A... |
What is Poles, when Races is less than 16? | CREATE TABLE table_name_99 (poles VARCHAR,races INTEGER) | SELECT poles FROM table_name_99 WHERE races < 16 |
What was the maximum burglary statistics if the property crimes is 168630? | CREATE TABLE table_28283 ("Year" real,"Population" real,"Total" real,"Violent" real,"Property Crimes" real,"Forcible rape" real,"Robbery" real,"Aggravated assault" real,"Burglary" real,"Larceny Theft" real,"Vehicle Theft" real) | SELECT MAX("Burglary") FROM table_28283 WHERE "Property Crimes" = '168630' |
Show all sport name and the number of students Show bar chart, could you sort by the Y-axis in ascending please? | CREATE TABLE SportsInfo (StuID INTEGER,SportName VARCHAR(32),HoursPerWeek INTEGER,GamesPlayed INTEGER,OnScholarship VARCHAR(1))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Plays_Games (StuID INTEGER,Gam... | SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName ORDER BY COUNT(*) |
according to the table , which destination was the last to become available ? | CREATE TABLE table_203_323 (id number,"city" text,"country" text,"airport" text,"begin" number,"end" number) | SELECT "city" FROM table_203_323 ORDER BY "begin" DESC LIMIT 1 |
laboratory findings of fasting triglycerides greater than or equal to 200 mg / dl | CREATE TABLE table_train_79 ("id" int,"fasting_triglycerides" int,"fasting_total_cholesterol" int,"fasting_glucose" int,"age" float,"NOUSE" float) | SELECT * FROM table_train_79 WHERE fasting_triglycerides >= 200 |
Who was the incumbent when Arthur Osborne won the election? | CREATE TABLE table_15144 ("Electorate" text,"Incumbent" text,"Winner" text,"Majority" real,"Runner up" text) | SELECT "Incumbent" FROM table_15144 WHERE "Winner" = 'arthur osborne' |
What was the Result of the game on December 14, 1986 after Week 11? | CREATE TABLE table_48585 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Result" FROM table_48585 WHERE "Week" > '11' AND "Date" = 'december 14, 1986' |
how many democrats were re elected ? | CREATE TABLE table_203_615 (id number,"district" text,"incumbent" text,"party" text,"first\nelected" number,"result" text,"candidates" text) | SELECT COUNT(*) FROM table_203_615 WHERE "party" = 'democratic' AND "result" = 're-elected' |
A bar chart showing the number of debates in each venue for those on the affirmative side, and show bar in descending order please. | 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)CREATE TABLE debate_people (Debate_ID int,Affirmative int,Negative int,If_Affirmative_Win bool) | SELECT Venue, COUNT(Venue) 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 Venue ORDER BY Venue DESC |
list the five most frequent drugs that were prescribed to patients during the same hospital encounter after having been prescribed with fenofibrate micronized during a year before? | CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)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,intim... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'fenofibrate micronized' AND DATETIME(prescrip... |
What Opponent has a Site of war memorial stadium little rock, ar, and a Result of l6 7? | CREATE TABLE table_61509 ("Date" text,"Opponent" text,"Site" text,"Result" text,"Attendance" text) | SELECT "Opponent" FROM table_61509 WHERE "Site" = 'war memorial stadium • little rock, ar' AND "Result" = 'l6–7' |
what was the score in 1990 | CREATE TABLE table_5468 ("Year" real,"Champion" text,"Score" text,"Opponent" text,"State Champion Head coach" text) | SELECT "Score" FROM table_5468 WHERE "Year" = '1990' |
What number episode in the season was watched by 0.49 million U.S. viewers? | CREATE TABLE table_3675 ("No." real,"#" real,"Title" text,"Directed by" text,"Story by" text,"Teleplay by" text,"Original air date" text,"U.S. viewers (millions)" text) | SELECT MAX("#") FROM table_3675 WHERE "U.S. viewers (millions)" = '0.49' |
requirement for immediate surgery | CREATE TABLE table_train_9 ("id" int,"pregnancy_or_lactation" bool,"intention_to_arterial_catheter" bool,"intention_to_central_venous_catheter" bool,"surgery" bool,"hypotension" bool,"chest_trauma" bool,"burn_injury" int,"impossible_transthoracic_echocardiogram_tte" bool,"NOUSE" float) | SELECT * FROM table_train_9 WHERE surgery = 1 |
The song '2 Be Together' had what jury? | CREATE TABLE table_79335 ("Draw" real,"Singer" text,"Song" text,"Televoting (votes)" text,"Jury" text,"Place" text) | SELECT "Jury" FROM table_79335 WHERE "Song" = '2 be together' |
What is Notes, when Silver is 'Jarkko Huovila'? | CREATE TABLE table_12385 ("Year" real,"Gold" text,"Silver" text,"Bronze" text,"Notes" text) | SELECT "Notes" FROM table_12385 WHERE "Silver" = 'jarkko huovila' |
number of official middle earth video games before the year 2000 . | CREATE TABLE table_204_398 (id number,"title" text,"year" number,"publisher" text,"developer" text,"platforms" text) | SELECT COUNT("title") FROM table_204_398 WHERE "year" < 2000 |
has d5/.45ns been given on this month/28 to patient 5828? | CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE icustays (row_id number,subj... | SELECT COUNT(*) > 0 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 = 5828)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5/.45ns'... |
what is the price of a drug named buminate? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemsta... | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'buminate') |
Who were the director/s of episodes written by Mike Daniels? | CREATE TABLE table_22227 ("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 "Directed by" FROM table_22227 WHERE "Written by" = 'Mike Daniels' |
what is the daily average of the weight of patient 016-38131 this month? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text... | SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of mon... |
Create a bar chart showing how many class across class | CREATE TABLE track (Track_ID int,Name text,Location text,Seating real,Year_Opened real)CREATE TABLE race (Race_ID int,Name text,Class text,Date text,Track_ID text) | SELECT Class, COUNT(Class) FROM race GROUP BY Class |
How many courses have more than one prerequisite for each department? Visualize with a bar chart, I want to rank by the dept_name in ascending. | CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))... | SELECT dept_name, COUNT(dept_name) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY dept_name ORDER BY dept_name |
For those records from the products and each product's manufacturer, show me about the distribution of founder and the amount of founder , and group by attribute founder in a bar chart. | 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 Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder |
Draw a scatter chart about the correlation between author_id and author_tutor_ATB . | CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))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 Courses (course_id ... | SELECT author_id, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name |
What were the goals in the game with the 26-28 final score? | CREATE TABLE table_name_5 (goals VARCHAR,score VARCHAR) | SELECT goals FROM table_name_5 WHERE score = "26-28" |
among patients who had a hospital stay for 8 days, how many of them were aged 55 or below? | 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 AVG(demographic.age) FROM demographic WHERE demographic.age >= "55" AND demographic.days_stay = "8" |
What is the defending forces when Al-Murassas shows for name? | CREATE TABLE table_46544 ("Name" text,"Date" text,"Defending forces" text,"Brigade" text,"Population" text) | SELECT "Defending forces" FROM table_46544 WHERE "Name" = 'al-murassas' |
Name the total number for mens single for 2002/2003 | CREATE TABLE table_17527 ("Season" text,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text) | SELECT COUNT("Mens singles") FROM table_17527 WHERE "Season" = '2002/2003' |
provide the number of patients whose gender is m and age is less than 62? | 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 WHERE demographic.gender = "M" AND demographic.age < "62" |
What is listed for Played that has Points against of 263? | CREATE TABLE table_6256 ("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_6256 WHERE "Points against" = '263' |
What was the score in the September 26 game? | CREATE TABLE table_name_76 (score VARCHAR,date VARCHAR) | SELECT score FROM table_name_76 WHERE date = "september 26" |
Name the pole positon for korean grand prix | CREATE TABLE table_70212 ("Grand Prix" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Winning constructor" text,"Report" text) | SELECT "Pole position" FROM table_70212 WHERE "Grand Prix" = 'korean grand prix' |
What prefix has Bromo as the group? | CREATE TABLE table_52663 ("Chemical class" text,"Group" text,"Formula" text,"Prefix" text,"Suffix" text,"Example" text) | SELECT "Prefix" FROM table_52663 WHERE "Group" = 'bromo' |
what is the last piece of filmography that he has worked on to date ? | CREATE TABLE table_203_710 (id number,"genre" text,"year" number,"title" text,"episode" text,"role" text,"notes" text) | SELECT "title" FROM table_203_710 ORDER BY "year" DESC LIMIT 1 |
What is the average relative permeability with a resistivity smaller than 1.12 and a surface resistance relative to copper smaller than 1? | CREATE TABLE table_68993 ("Material" text,"Resistivity (10 \u22126 ohm-inches)" real,"Relative permeability" real,"Skin depth,inches" real,"Surface resistance,Relative to copper" real) | SELECT AVG("Relative permeability") FROM table_68993 WHERE "Resistivity (10 \u22126 ohm-inches)" < '1.12' AND "Surface resistance, Relative to copper" < '1' |
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the average of price , and group by attribute name, and display x-axis from low to high order. | 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 T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name |
Distribution of voting activity in time for different vintages of questions and answers. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Users (Id number,Reputation number,CreationDate ... | WITH a AS (SELECT p.Id, COUNT(p.Id) AS nId, TIME_TO_STR(p.CreationDate, '%Y') AS PostYr, TIME_TO_STR(v.CreationDate, '%Y') + 1.00 * TIME_TO_STR(v.CreationDate, '%-M') / 12 AS VoteMonth FROM Posts AS p JOIN Votes AS v ON p.Id = v.PostId WHERE p.PostTypeId IN (1) AND v.VoteTypeId IN (2, 3) GROUP BY p.Id, TIME_TO_STR(p.Cr... |
How many people attended the game on May 31? | CREATE TABLE table_name_25 (attendance INTEGER,date VARCHAR) | SELECT SUM(attendance) FROM table_name_25 WHERE date = "may 31" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.