instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the number of patients whose admission location is clinic referral/premature?
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 lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE"
A bar chart shows the distribution of meter_700 and meter_100 , and rank from high to low by the bars.
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,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Ev...
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_700 DESC
How many miles were driven with the average speed at 116.81?
CREATE TABLE table_2175858_1 (miles__km_ VARCHAR,average_speed__mph_ VARCHAR)
SELECT miles__km_ FROM table_2175858_1 WHERE average_speed__mph_ = "116.81"
give me the number of patients whose insurance is private and lab test name is urea nitrogen, urine?
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 text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Urea Nitrogen, Urine"
What is the shoulder measurement of the gun with a length of 57.85 (2.278)?
CREATE TABLE table_name_36 (shoulder VARCHAR,length VARCHAR)
SELECT shoulder FROM table_name_36 WHERE length = "57.85 (2.278)"
Which of the two teams has 1st leg of 2-0?
CREATE TABLE table_66942 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 2" FROM table_66942 WHERE "1st leg" = '2-0'
How many Points has Wins larger than 0?
CREATE TABLE table_49663 ("Year" real,"Class" text,"Team" text,"Points" real,"Wins" real)
SELECT COUNT("Points") FROM table_49663 WHERE "Wins" > '0'
Count the number of chip model that do not have wifi.
CREATE TABLE phone (company_name text,hardware_model_name text,accreditation_type text,accreditation_level text,date text,chip_model text,screen_mode text)CREATE TABLE chip_model (model_name text,launch_year number,ram_mib number,rom_mib number,slots text,wifi text,bluetooth text)CREATE TABLE screen_mode (graphics_mode...
SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'
find the event names that have more than 2 records.
CREATE TABLE party (party_id number,minister text,took_office text,left_office text,region_id number,party_name text)CREATE TABLE member (member_id number,member_name text,party_id text,in_office text)CREATE TABLE region (region_id number,region_name text,date text,label text,format text,catalogue text)CREATE TABLE par...
SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2
how many patients whose year of birth is less than 2097 and lab test abnormal status is abnormal?
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 demographic (subject_id text,hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2097" AND lab.flag = "abnormal"
count the number of patients whose diagnoses short title is subendo infarct, initial and drug type is main?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Subendo infarct, initial" AND prescriptions.drug_type = "MAIN"
Show the smallest enrollment of each state, and show in asc by the X please.
CREATE TABLE Tryout (pID numeric(5,0),cName varchar(20),pPos varchar(8),decision varchar(3))CREATE TABLE Player (pID numeric(5,0),pName varchar(20),yCard varchar(3),HS numeric(5,0))CREATE TABLE College (cName varchar(20),state varchar(2),enr numeric(5,0))
SELECT state, MIN(enr) FROM College GROUP BY state ORDER BY state
Who was the opponent in the championship in Johannesburg, South Africa?
CREATE TABLE table_51843 ("Outcome" text,"Date" text,"Championship" text,"Opponent in the final" text,"Score in the final" text)
SELECT "Opponent in the final" FROM table_51843 WHERE "Championship" = 'johannesburg, south africa'
what are the top four most prescribed drugs for patients who were prescribed metformin hcl 500 mg po tabs at the same time?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight nu...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'metformin hcl 500 mg po tabs') AS t1 JOIN (SELECT p...
What record was reached when the Eagles played the Phoenix Cardinals?
CREATE TABLE table_16678052_2 (record VARCHAR,opponent VARCHAR)
SELECT record FROM table_16678052_2 WHERE opponent = "Phoenix Cardinals"
count the number of patients whose admission location is transfer from hosp/extram and procedure long title is closed (needle) biopsy of tongue.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Closed [needle] biopsy of tongue"
how many times since 6 years ago has patient 50480 been to the hospital?
CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,...
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 50480 AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-6 year')
what's the economics score with education being 92.0
CREATE TABLE table_72566 ("Rank" real,"Country" text,"Overall" text,"Justice" text,"Health" text,"Education" text,"Economics" text,"Politics" text)
SELECT "Economics" FROM table_72566 WHERE "Education" = '92.0'
until 02/2105 has morphine, ondansetron or vancomycin consult to pharmacy been prescribed for patient 029-22492?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-22492')) AND medication.drugname IN ('morphine', 'ondansetron', 'vanco...
Show the average, minimum, and maximum age for different majors.
CREATE TABLE Student (major VARCHAR,age INTEGER)
SELECT major, AVG(age), MIN(age), MAX(age) FROM Student GROUP BY major
How many patients admitted before the year 2135 had urinary incontinence (unspecified)?
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 text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2135" AND diagnoses.long_title = "Urinary incontinence, unspecified"
give me the amount of output until 12/21/2105 for patient 012-29464.
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 SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-29464')) AND intakeoutput.cellpath LIKE '%ou...
What is the team 1 in the match with a team 2 of Karabakh?
CREATE TABLE table_46760 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 1" FROM table_46760 WHERE "Team 2" = 'karabakh'
Name the country for lusail national stadium
CREATE TABLE table_30441 ("Stadium" text,"Capacity" real,"City" text,"Country" text,"Tenant" text,"Opening" text)
SELECT "Country" FROM table_30441 WHERE "Stadium" = 'Lusail National Stadium'
What home team did South Melbourne play as the away team?
CREATE TABLE table_56752 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_56752 WHERE "Away team" = 'south melbourne'
Who had the highest rebounds in the game where the record was 27-54?
CREATE TABLE table_23186738_10 (high_rebounds VARCHAR,record VARCHAR)
SELECT high_rebounds FROM table_23186738_10 WHERE record = "27-54"
What is the average number of bedrooms of all apartments?
CREATE TABLE view_unit_status (apt_id number,apt_booking_id number,status_date time,available_yn others)CREATE TABLE apartment_buildings (building_id number,building_short_name text,building_full_name text,building_description text,building_address text,building_manager text,building_phone text)CREATE TABLE apartment_b...
SELECT AVG(bedroom_count) FROM apartments
What are the name and typical buying and selling prices of the products that have color described as 'yellow'?
CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selling_price text,product_description text,other_product_details text)CREATE TABLE characteristics (characteristic_id number,characteristic_type_code text,characteristic_data_type tex...
SELECT t1.product_name, t1.typical_buying_price, t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
What is the time/retired associated with a grid of 5 and under 73 laps?
CREATE TABLE table_53590 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_53590 WHERE "Laps" < '73' AND "Grid" = '5'
Which Diameter (km) has a Name of alma-merghen planitia, and a Year named smaller than 1997?
CREATE TABLE table_44983 ("Name" text,"Latitude" text,"Longitude" text,"Diameter (km)" real,"Year named" real)
SELECT MAX("Diameter (km)") FROM table_44983 WHERE "Name" = 'alma-merghen planitia' AND "Year named" < '1997'
i would like to know the flights available from BOSTON to DENVER arriving in DENVER by 800 o'clock wednesday morning
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arri...
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 (((((flight.arrival_time < flight.departure_time) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.da...
How many Silver medals did the Nation with a Rank of less than 1 receive?
CREATE TABLE table_name_37 (silver INTEGER,rank INTEGER)
SELECT AVG(silver) FROM table_name_37 WHERE rank < 1
Which Director has an Episode of 13?
CREATE TABLE table_name_17 (director VARCHAR,episode VARCHAR)
SELECT director FROM table_name_17 WHERE episode = 13
Which stage number did son bou arrive at?
CREATE TABLE table_43727 ("Stage" real,"Start" text,"Arrival" text,"Duration" text,"Difficulty" text)
SELECT COUNT("Stage") FROM table_43727 WHERE "Arrival" = 'son bou'
Show company name and main industry without a gas station.
CREATE TABLE company (company_id number,rank number,company text,headquarters text,main_industry text,sales_billion number,profits_billion number,assets_billion number,market_value number)CREATE TABLE gas_station (station_id number,open_year number,location text,manager_name text,vice_manager_name text,representative_n...
SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company)
What was the crowd when the VFL played Windy Hill?
CREATE TABLE table_name_49 (crowd INTEGER,venue VARCHAR)
SELECT SUM(crowd) FROM table_name_49 WHERE venue = "windy hill"
flights from DALLAS to HOUSTON in the morning
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE flig...
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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'HOUSTO...
Name Nationality / Opponent on 10 january 1998?
CREATE TABLE table_60773 ("Date" text,"Nationality / Opponent" text,"Ground" text,"Result" text,"Competition" text)
SELECT "Nationality / Opponent" FROM table_60773 WHERE "Date" = '10 january 1998'
Users with one or more [identification] questions.
CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text te...
SELECT DISTINCT OwnerUserId AS "user_id", OwnerUserId AS "user_link", COUNT(OwnerUserId) AS "qcount" FROM Posts INNER JOIN PostTags ON Posts.Id = PostTags.PostId WHERE PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND PostTags.TagId = @tagid GROUP BY OwnerUserId HAVING COUNT(OwnerUserId) > 0 ORDE...
tag badges for a user.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT b.Name, b.Date, b.Class FROM Badges AS b WHERE b.TagBased = 'true' AND b.UserId = '##UserId##'
A bar chart about what is the total rating of channel for each channel owner?, and rank X from high to low order.
CREATE TABLE channel (Channel_ID int,Name text,Owner text,Share_in_percent real,Rating_in_percent real)CREATE TABLE broadcast (Channel_ID int,Program_ID int,Time_of_day text)CREATE TABLE broadcast_share (Channel_ID int,Program_ID int,Date text,Share_in_percent real)CREATE TABLE program (Program_ID int,Name text,Origin ...
SELECT Owner, SUM(Rating_in_percent) FROM channel GROUP BY Owner ORDER BY Owner DESC
CLEANUP: Find new tag wikis.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)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 numb...
SELECT Tags.TagName, Posts.Body, Posts.CreationDate FROM Posts INNER JOIN Tags ON Posts.Id = Tags.WikiPostId WHERE Posts.PostTypeId IN (5) AND DATEADD(MONTH, 1, Posts.CreationDate) >= GETDATE() AND Posts.Body != '' ORDER BY Posts.CreationDate DESC
What is the record for the date of 12 december?
CREATE TABLE table_44618 ("Event" text,"Date" text,"Round" text,"Name" text,"Nationality" text,"Time" text,"Record" text)
SELECT "Record" FROM table_44618 WHERE "Date" = '12 december'
what number of patients had the drug code calc25?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE 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 prescriptions.formulary_drug_cd = "CALC25"
Use a stacked bar chart to show how many films for each title and each type The x-axis is title, I want to display from high to low by the Y.
CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)CREATE TABLE film (Film_ID int,Title text,Studio text,Director text,Gross_in_dollar int)CREATE TABLE market (Market_ID int,Country text,Number_cities int)
SELECT Title, COUNT(Title) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Type, Title ORDER BY COUNT(Title) DESC
Find question in the past month that have links to JSFiddle or CodePen but no code in the question.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREA...
SELECT CONCAT('http://stackoverflow.com/questions/', Id) AS "Link", Score FROM Posts WHERE CreationDate > DATEADD(MONTH, -1, GETDATE()) AND PostTypeId = 1 AND (Body LIKE '%jsfiddle.net%' OR Body LIKE '%codepen.io%') AND NOT (Body LIKE '% %' OR Body LIKE '%<pre>%' OR Body LIKE '%<code>%')
How many people lived in san gabriel in the year 2000?
CREATE TABLE table_2004733_2 (population__2000_ VARCHAR,barangay VARCHAR)
SELECT COUNT(population__2000_) FROM table_2004733_2 WHERE barangay = "San Gabriel"
What is the total number of draws for Wakool when there are more than 11 losses and fewer than 4 wins?
CREATE TABLE table_name_7 (draws VARCHAR,golden_rivers VARCHAR,losses VARCHAR,wins VARCHAR)
SELECT COUNT(draws) FROM table_name_7 WHERE losses > 11 AND wins < 4 AND golden_rivers = "wakool"
Is the Spring-Summer the only time that INTMED 460 is offered ?
CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_cre...
SELECT COUNT(*) > 0 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.department = 'INTMED' AND course.number = 460 AND semester.semester <> 'Spring-Summer'
Where tower height in ft (m) is 46ft (14.0m) the focal plane is ft (m).
CREATE TABLE table_27826 ("Lighthouse" text,"Location" text,"Province/City" text,"Date First Lit" text,"Tower height in ft (m)" text,"Focal plane in ft (m)" text,"Current Status" text,"Current Condition/ Description" text)
SELECT "Focal plane in ft (m)" FROM table_27826 WHERE "Tower height in ft (m)" = '46ft (14.0m)'
How many people have attended victoria park?
CREATE TABLE table_58014 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT COUNT("Crowd") FROM table_58014 WHERE "Venue" = 'victoria park'
what is gender and diagnoses icd9 code of subject id 2560?
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 text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT demographic.gender, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560"
how much patient 010-32698 weighs in 02/this year for the first time?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,he...
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-32698') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-...
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the amount of job_id , and group by attribute job_id in a bar chart, sort in asc by the X please.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID dec...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
Who was the original artist of the First solo theme?
CREATE TABLE table_26250155_1 (original_artist VARCHAR,theme VARCHAR)
SELECT original_artist FROM table_26250155_1 WHERE theme = "First Solo"
How many picks did Jay Bruchak have?
CREATE TABLE table_name_31 (pick VARCHAR,player VARCHAR)
SELECT COUNT(pick) FROM table_name_31 WHERE player = "jay bruchak"
what is drug type of drug name cyclosporine (sandimmune)?
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 prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "CycloSPORINE (Sandimmune)"
list the earliest flights from ATLANTA to DENVER on a MONDAY
CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,t...
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, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND days.day_name = 'MONDAY' AND flight.flight_days = days.days_code AND f...
let me know the number of patients less than 83 years who stayed in hospital for more than 6 days.
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 WHERE demographic.age < "83" AND demographic.days_stay > "6"
Bronze smaller than 5, and a Silver larger than 0 is which nation?
CREATE TABLE table_5990 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT "Nation" FROM table_5990 WHERE "Bronze" < '5' AND "Silver" > '0'
Top tags for a given week..
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Te...
SELECT t.TagName, YEAR(p.CreationDate) AS yr, TIME_TO_STR(p.CreationDate, '%W') AS week, COUNT(p.Id) AS k FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id GROUP BY t.TagName, YEAR(p.CreationDate), TIME_TO_STR(p.CreationDate, '%W') ORDER BY COUNT(p.Id) DESC LIMIT 100
Which Year has a Result smaller than 20.26, and a Location of eugene?
CREATE TABLE table_42962 ("Year" real,"Result" real,"World Rank" text,"Location" text,"Date" text)
SELECT SUM("Year") FROM table_42962 WHERE "Result" < '20.26' AND "Location" = 'eugene'
Show the name of each party and the corresponding number of delegates from that party.
CREATE TABLE county (county_id number,county_name text,population number,zip_code text)CREATE TABLE election (election_id number,counties_represented text,district number,delegate text,party number,first_elected number,committee text)CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_go...
SELECT T2.party, COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.party = T2.party_id GROUP BY T1.party
Which score has a Surface of hardcourt, and a Date of september 30, 1984?
CREATE TABLE table_name_39 (score VARCHAR,surface VARCHAR,date VARCHAR)
SELECT score FROM table_name_39 WHERE surface = "hardcourt" AND date = "september 30, 1984"
Who had the pole position in Milwaukee?
CREATE TABLE table_3934 ("Round" real,"Race" text,"Pole position" text,"Fastest lap" text,"Most laps led" text,"Driver" text,"Team" text,"Manufacturer" text,"Report" text)
SELECT "Pole position" FROM table_3934 WHERE "Race" = 'Milwaukee'
How many championships are there on the date January 9, 2005?
CREATE TABLE table_26202788_7 (championship VARCHAR,date VARCHAR)
SELECT COUNT(championship) FROM table_26202788_7 WHERE date = "January 9, 2005"
What is the sum of the number of regular games played by Morgan Clark with the number of road games less than 7?
CREATE TABLE table_name_17 (reg_gp INTEGER,player VARCHAR,rd__number VARCHAR)
SELECT SUM(reg_gp) FROM table_name_17 WHERE player = "morgan clark" AND rd__number < 7
What is the highest Assets (USD) Millions from Equity Bank and less than 44 branches?
CREATE TABLE table_60027 ("Rank" text,"Bank" text,"Assets (USD) Millions" real,"Market Share" text,"Number of Branches" real)
SELECT MAX("Assets (USD) Millions") FROM table_60027 WHERE "Bank" = 'equity bank' AND "Number of Branches" < '44'
show me the flights from ATLANTA to WASHINGTON on wednesday night and thursday morning
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)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 ground_service (ci...
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 ((((flight.departure_time <= 2359 AND flight.departure_time >= 1800) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year...
Which country has is Len Mattiace in T10 place?
CREATE TABLE table_76809 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text)
SELECT "Country" FROM table_76809 WHERE "Place" = 't10' AND "Player" = 'len mattiace'
Which archbishop was ordained as bishop November 30, 1925?
CREATE TABLE table_20888 ("Archbishop" text,"Born" text,"Ordained Priest" text,"Ordained Bishop" text,"Appointed Archbishop" text,"Vacated throne" text,"Died" text)
SELECT "Archbishop" FROM table_20888 WHERE "Ordained Bishop" = 'November 30, 1925'
who is the constructor when the grid is more than 23 and the driver is piercarlo ghinzani?
CREATE TABLE table_name_66 (constructor VARCHAR,grid VARCHAR,driver VARCHAR)
SELECT constructor FROM table_name_66 WHERE grid > 23 AND driver = "piercarlo ghinzani"
What was the final for rouhollah hosseini?
CREATE TABLE table_name_78 (final VARCHAR,athlete VARCHAR)
SELECT final FROM table_name_78 WHERE athlete = "rouhollah hosseini"
On what date was Hawthorn the home team?
CREATE TABLE table_53936 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_53936 WHERE "Home team" = 'hawthorn'
On which date was Essendon the home team?
CREATE TABLE table_78272 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_78272 WHERE "Home team" = 'essendon'
What location did Anke Huber win the championship?
CREATE TABLE table_name_68 (location VARCHAR,champion VARCHAR)
SELECT location FROM table_name_68 WHERE champion = "anke huber"
In what year did the #14 FitzBradshaw Racing compete?
CREATE TABLE table_22812 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text)
SELECT "Year" FROM table_22812 WHERE "Team(s)" = '#14 FitzBradshaw Racing'
How many answers I posted by Year.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT YEAR(a.CreationDate) AS "year", MONTH(a.CreationDate) AS "month", COUNT(*) AS "number_of_answers" FROM Posts AS a INNER JOIN Users ON Users.Id = a.OwnerUserId WHERE a.OwnerUserId = @UserId GROUP BY YEAR(a.CreationDate), MONTH(a.CreationDate) ORDER BY YEAR(a.CreationDate) DESC, MONTH(a.CreationDate) DESC
what is the number of patients whose religion is jehovah's witness and lab test name is lactate?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "JEHOVAH'S WITNESS" AND lab.label = "Lactate"
What is the venue where john zibnack was the runner-up?
CREATE TABLE table_name_54 (venue VARCHAR,runner_up VARCHAR)
SELECT venue FROM table_name_54 WHERE runner_up = "john zibnack"
What Date was the Game at Griffith Stadium?
CREATE TABLE table_59041 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text,"Attendance" text)
SELECT "Date" FROM table_59041 WHERE "Game site" = 'griffith stadium'
is the heart rate value of patient 3369 measured at 2101-01-27 22:30:00 greater than the value measured at 2101-01-27 22:25:00?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3369)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'he...
What is the lowest group number that has a Fraction less than 0.000748, a Half-Life of 55.72 and a Decay Constant larger than 0.012400000000000001?
CREATE TABLE table_name_99 (group INTEGER,decay_constant__s_−1__ VARCHAR,fraction VARCHAR,half_life__s_ VARCHAR)
SELECT MIN(group) FROM table_name_99 WHERE fraction < 0.000748 AND half_life__s_ = 55.72 AND decay_constant__s_−1__ > 0.012400000000000001
Which Tie number had Middlesbrough as the away team?
CREATE TABLE table_45779 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Tie no" FROM table_45779 WHERE "Away team" = 'middlesbrough'
what medication was first prescribed to patient 012-2739 via subcut since 147 months ago?
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 intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabe...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-2739')) AND medication.routeadmin = 'subcut' AND DATETIME(medic...
Highest larger than 2,169, and a Average larger than 3,502 involves which team?
CREATE TABLE table_38779 ("Team" text,"Stadium" text,"Capacity" real,"Highest" real,"Lowest" real,"Average" real)
SELECT "Team" FROM table_38779 WHERE "Highest" > '2,169' AND "Average" > '3,502'
Will I be able to take SI 638 over the Winter ?
CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREAT...
SELECT COUNT(*) > 0 FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN...
Which film, directed by Dana Dorian, was nominated?
CREATE TABLE table_name_40 (film VARCHAR,rank VARCHAR,director_s_ VARCHAR)
SELECT film FROM table_name_40 WHERE rank = "nominated" AND director_s_ = "dana dorian"
What Player is from the College of memphis?
CREATE TABLE table_name_5 (player VARCHAR,college VARCHAR)
SELECT player FROM table_name_5 WHERE college = "memphis"
Name the population for (croatian: mono tor)
CREATE TABLE table_3328 ("Settlement" text,"Cyrillic Name Other Names" text,"Type" text,"Population (2011)" real,"Largest ethnic group (2002)" text,"Dominant religion (2002)" text)
SELECT "Population (2011)" FROM table_3328 WHERE "Cyrillic Name Other Names" = 'Бачки Моноштор (Croatian: Monoštor)'
What's the smallest fall 05 number when fall 09 is less than 14 and fall 08 is more than 5?
CREATE TABLE table_name_22 (fall_05 INTEGER,fall_09 VARCHAR,fall_08 VARCHAR)
SELECT MIN(fall_05) FROM table_name_22 WHERE fall_09 < 14 AND fall_08 > 5
What is SECOND, when SIXTH is Victoria?
CREATE TABLE table_name_18 (second VARCHAR,sixth VARCHAR)
SELECT second FROM table_name_18 WHERE sixth = "victoria"
RENTAL CAR in WASHINGTON
CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,t...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'WASHINGTON' AND ground_service.city_code = city.city_code AND ground_service.transport_type = 'RENTAL CAR'
What game number is the Kansas City Kings team?
CREATE TABLE table_7976 ("Game" real,"Date" text,"Team" text,"Score" text,"Record" text,"Streak" text)
SELECT "Game" FROM table_7976 WHERE "Team" = 'kansas city kings'
what were the top four common lab tests that patients had within the same month after having a insulin - subcutaneous dose of longer-acting insulin prepara procedure until 2 years ago?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT t3.labname FROM (SELECT t2.labname, 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 = 'insulin - subcutaneous dose of longer-acting insulin...
What is the average episode number on 19 March 1993 with Jim Sweeney as performer 1?
CREATE TABLE table_36536 ("Date" text,"Episode" real,"Performer 1" text,"Performer 2" text,"Performer 3" text,"Performer 4" text)
SELECT AVG("Episode") FROM table_36536 WHERE "Performer 1" = 'jim sweeney' AND "Date" = '19 march 1993'
In what Region is Catalog number 885 380-1?
CREATE TABLE table_34440 ("Date" text,"Label" text,"Region" text,"Format" text,"Catalog" text)
SELECT "Region" FROM table_34440 WHERE "Catalog" = '885 380-1'
how many hours has elapsed since the last time that patient 033-22108 had an intake of enteral meds on the current intensive care unit visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
Give me the comparison about the sum of School_ID over the All_Home , and group by attribute All_Home, and display by the x-axis from low to high.
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 All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home
What area did Julius Boros play at?
CREATE TABLE table_71135 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Place" FROM table_71135 WHERE "Player" = 'julius boros'