instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
what are the top three most frequently used specimen tests given to patients in the same hospital visit after being diagnosed with poison-medicinal agt nos? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TAB... | SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnos... |
what are the five most frequently prescribed drugs since 5 years ago for patients prescribed with atropine 0.1 mg/ml inj syringe at the same time? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text... | 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 = 'atropine 0.1 mg/ml inj syringe' AND DATETIME(medica... |
When was the date of death for the person married to Charles II? | CREATE TABLE table_name_86 (death VARCHAR,spouse VARCHAR) | SELECT death FROM table_name_86 WHERE spouse = "charles ii" |
count the number of patients whose gender is f and procedure icd9 code is 4610? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.icd9_code = "4610" |
How many points did Carlin have when they had 3 wins? | CREATE TABLE table_name_90 (points VARCHAR,wins VARCHAR,team VARCHAR) | SELECT points FROM table_name_90 WHERE wins = "3" AND team = "carlin" |
In the final, who are the opponents of partner Simon Aspelin? | CREATE TABLE table_35942 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT "Opponents in the final" FROM table_35942 WHERE "Partner" = 'simon aspelin' |
how much does the arterial bp [systolic] of patient 8116 vary second measured on the current intensive care unit visit compared to the first value measured on the current intensive care unit visit? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,... | 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 = 8116) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_it... |
Name the representative for party of whig | CREATE TABLE table_69618 ("Representative" text,"Years" text,"State" text,"Party" text,"Lifespan" text) | SELECT "Representative" FROM table_69618 WHERE "Party" = 'whig' |
What is the status of the district where the result is 63% 37%? | CREATE TABLE table_16185956_1 (status VARCHAR,results VARCHAR) | SELECT status FROM table_16185956_1 WHERE results = "63% 37%" |
What is the Kashmiri word for the Indonesian word senin? | CREATE TABLE table_name_90 (kashmiri VARCHAR,indonesian VARCHAR) | SELECT kashmiri FROM table_name_90 WHERE indonesian = "senin" |
how many female patients followed the procedure ven cath renal dialysis? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.short_title = "Ven cath renal dialysis" |
Which City of license has a Call sign of k241an? | CREATE TABLE table_name_68 (city_of_license VARCHAR,call_sign VARCHAR) | SELECT city_of_license FROM table_name_68 WHERE call_sign = "k241an" |
Where is the orchestra when the year of recording is 1934? | CREATE TABLE table_73366 ("Piano" text,"Conductor" text,"Orchestra" text,"Record Company" text,"Year of Recording" real,"Format" text) | SELECT "Orchestra" FROM table_73366 WHERE "Year of Recording" = '1934' |
How many number of site have May 1, 2004 as the date? | CREATE TABLE table_22098274_1 (site VARCHAR,date VARCHAR) | SELECT COUNT(site) FROM table_22098274_1 WHERE date = "May 1, 2004" |
how many times has patient 015-56390 recieved a enteral tube intake: nasoduodenal nostril, r 10f intake in 12/last year? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patient... | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56390')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.ce... |
What is Current Rank, when Ring Name is Kimurayama Mamoru? | CREATE TABLE table_40076 ("Ring name" text,"Current rank" text,"Debut" text,"Stable" text,"Birthplace" text) | SELECT "Current rank" FROM table_40076 WHERE "Ring name" = 'kimurayama mamoru' |
What was the nationality of the skater with 108.8 points? | CREATE TABLE table_name_52 (nation VARCHAR,points VARCHAR) | SELECT nation FROM table_name_52 WHERE points = 108.8 |
what are the top four most frequently diagnosed diagnoses among the patients in the 20s since 1 year ago? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text... | SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 yea... |
What is the total number of To Par, when Score is '70-75-76=221'? | CREATE TABLE table_45574 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" real) | SELECT COUNT("To par") FROM table_45574 WHERE "Score" = '70-75-76=221' |
For CS , are there any upper elective courses offered ? | CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE ar... | SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id |
Number of unanswered question (zero answers) per month. | CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostI... | SELECT LAST_DATE_OF_MONTH(q.CreationDate), COUNT(q.Id) AS Count FROM Posts AS q WHERE (q.PostTypeId = 1) AND (q.AnswerCount = 0) GROUP BY LAST_DATE_OF_MONTH(q.CreationDate) ORDER BY LAST_DATE_OF_MONTH(q.CreationDate) |
flights from KANSAS CITY to CLEVELAND on wednesday before 1700 | 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 time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE class_of_service (boo... | 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 ((date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time... |
What is the total number of 2012 Employees (Total) when 2007 Employees (Total) is 8,985, and rank (2010) is smaller than 9? | CREATE TABLE table_63078 ("Rank (2012)" real,"Rank (2010)" real,"Employer" text,"Industry" text,"2012 Employees (Total)" real,"2010 Employees (Total)" real,"2007 Employees (Total)" text,"Head office" text) | SELECT COUNT("2012 Employees (Total)") FROM table_63078 WHERE "2007 Employees (Total)" = '8,985' AND "Rank (2010)" < '9' |
With a rank of 2 what is the second quarter? | CREATE TABLE table_36998 ("Rank" real,"First quarter" text,"Second quarter" text,"Third quarter" text,"Fourth quarter" text) | SELECT "Second quarter" FROM table_36998 WHERE "Rank" = '2' |
What party did hilda solis represent? | CREATE TABLE table_22126 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text,"Candidates" text) | SELECT "Party" FROM table_22126 WHERE "Incumbent" = 'Hilda Solis' |
what was the last height of patient 005-73237 in the last month. | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean num... | SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', ... |
how old was patient 035-18528's age during the first hospital visit? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,ob... | SELECT patient.age FROM patient WHERE patient.uniquepid = '035-18528' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1 |
What is the score for Greg Norman | CREATE TABLE table_12721 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "Score" FROM table_12721 WHERE "Player" = 'greg norman' |
What is the Artist with a Date that is june 1979? | CREATE TABLE table_40579 ("Spoofed Title" text,"Actual Title" text,"Writer" text,"Artist" text,"Issue" real,"Date" text) | SELECT "Artist" FROM table_40579 WHERE "Date" = 'june 1979' |
how many married patients have lab test item id 51214? | 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.marital_status = "MARRIED" AND lab.itemid = "51214" |
Name the total number of series for march 19, 2000 | CREATE TABLE table_22590 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text) | SELECT COUNT("No. in series") FROM table_22590 WHERE "Original air date" = 'March 19, 2000' |
What is the line of the station in Toolamba that is currently demolished and closed in the late 1970s? | CREATE TABLE table_14710 ("Name" text,"Line" text,"Location" text,"Closed" text,"Current Status" text) | SELECT "Line" FROM table_14710 WHERE "Current Status" = 'demolished' AND "Closed" = 'late 1970s' AND "Location" = 'toolamba' |
What is every value on Thursday August 25 for rank 3? | CREATE TABLE table_30058355_3 (thurs_25_aug VARCHAR,rank VARCHAR) | SELECT thurs_25_aug FROM table_30058355_3 WHERE rank = 3 |
what diagnosis did patient 025-53910 receive last? | 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 diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-53910')) ORDER BY diagnosis.diagnosistime DESC LIMIT 1 |
What is the location for the club trophy? | CREATE TABLE table_name_69 (location VARCHAR,type VARCHAR) | SELECT location FROM table_name_69 WHERE type = "club trophy" |
How many values of total top 3 placements does Taiwan have? | CREATE TABLE table_2876467_3 (total_top_3_placements VARCHAR,region_represented VARCHAR) | SELECT COUNT(total_top_3_placements) FROM table_2876467_3 WHERE region_represented = "Taiwan" |
What are the names of the airports in the city of Goroka? | CREATE TABLE airlines (alid number,name text,iata text,icao text,callsign text,country text,active text)CREATE TABLE airports (apid number,name text,city text,country text,x number,y number,elevation number,iata text,icao text)CREATE TABLE routes (rid number,dst_apid number,dst_ap text,src_apid number,src_ap text,alid ... | SELECT name FROM airports WHERE city = 'Goroka' |
Questions by date - backwards. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE CloseRea... | SELECT Id, Score, ViewCount, Title, Tags, LastActivityDate, CreationDate FROM Posts WHERE PostTypeId = 1 ORDER BY CreationDate LIMIT 50 |
What is the Date for the game at michie stadium west point, ny? | CREATE TABLE table_name_80 (date VARCHAR,location VARCHAR) | SELECT date FROM table_name_80 WHERE location = "michie stadium • west point, ny" |
Can you tell me the highest Against that has the Losses larger than 9, and the Byes of 2, and the Draws larger than 0? | CREATE TABLE table_name_56 (against INTEGER,draws VARCHAR,losses VARCHAR,byes VARCHAR) | SELECT MAX(against) FROM table_name_56 WHERE losses > 9 AND byes = 2 AND draws > 0 |
When is a Type of tko, and an Opponent of jesse brinkley | CREATE TABLE table_name_53 (date VARCHAR,type VARCHAR,opponent VARCHAR) | SELECT date FROM table_name_53 WHERE type = "tko" AND opponent = "jesse brinkley" |
What was Shaun Murphy's outcome in the Premier League Snooker championship held before 2010? | CREATE TABLE table_name_1 (outcome VARCHAR,championship VARCHAR,year VARCHAR) | SELECT outcome FROM table_name_1 WHERE championship = "premier league snooker" AND year < 2010 |
Which commission was launched 28 june 1934, and has a Pennant number of h.78? | CREATE TABLE table_name_40 (commissioned VARCHAR,launched VARCHAR,pennant_number VARCHAR) | SELECT commissioned FROM table_name_40 WHERE launched = "28 june 1934" AND pennant_number = "h.78" |
Which Total Pts have a 2001 02 Pts smaller than 38? | CREATE TABLE table_78639 ("Team" text,"2003\u201304 Pts" text,"2004\u201305 Pts" text,"2001\u201302 Pts" real,"Total Pts" real,"Total Pld" real) | SELECT MIN("Total Pts") FROM table_78639 WHERE "2001\u201302 Pts" < '38' |
give me the difference between the total of the input and the output of patient 26057 on 12/27/this year. | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE transfers (row_id number... | SELECT (SELECT SUM(inputevents_cv.amount) 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 = 26057)) AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT... |
Find the dates on which more than one revisions were made, and the bin the date of latest revision into weekday interval and count them as a line chart. | CREATE TABLE Catalog_Structure (catalog_level_number INTEGER,catalog_id INTEGER,catalog_level_name VARCHAR(50))CREATE TABLE Catalogs (catalog_id INTEGER,catalog_name VARCHAR(50),catalog_publisher VARCHAR(80),date_of_publication DATETIME,date_of_latest_revision DATETIME)CREATE TABLE Catalog_Contents_Additional_Attribute... | SELECT date_of_latest_revision, COUNT(date_of_latest_revision) FROM Catalogs |
What is the acronym for the name Malay of Kolej Komuniti Sungai Petani? | CREATE TABLE table_61910 ("Name in English" text,"Name in Malay" text,"Acronym" text,"Foundation" text,"Location" text) | SELECT "Acronym" FROM table_61910 WHERE "Name in Malay" = 'kolej komuniti sungai petani' |
What year has earnings of $557,158? | CREATE TABLE table_35365 ("Year" real,"Wins" real,"Earnings ($)" text,"Rank" real,"Scoring average" real) | SELECT MAX("Year") FROM table_35365 WHERE "Earnings ($)" = '557,158' |
what's the points against with won being 11 | CREATE TABLE table_14058433_4 (points_against VARCHAR,won VARCHAR) | SELECT points_against FROM table_14058433_4 WHERE won = "11" |
What was the team score when Tim Duncan (12) got the high rebounds? | CREATE TABLE table_29788 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_29788 WHERE "High rebounds" = 'Tim Duncan (12)' |
what was the name of the drug that patient 433 had been prescribed two or more times? | 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 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 TABL... | SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 433) GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 >= 2 |
did patient 027-151154 receive angiogram - with coiling at other hospitals? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text... | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '027-151154' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '027-151154' AND patient.hospitaldischargetime IS NULL)) AND ... |
Which Constellation has an Apparent magnitude larger that 7.7, and an NGC number of 7777 | CREATE TABLE table_name_60 (constellation VARCHAR,apparent_magnitude VARCHAR,ngc_number VARCHAR) | SELECT constellation FROM table_name_60 WHERE apparent_magnitude > 7.7 AND ngc_number = 7777 |
until 95 months ago, had entacapone ever been prescribed to patient 7241? | CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,chart... | SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7241) AND prescriptions.drug = 'entacapone' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-95 month') |
what was last value of heart rate of patient 14467 today? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 outputevent... | 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 = 14467)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rat... |
What is the place of the Pinyin transcription Xi Wangri? | CREATE TABLE table_1805919_1 (standard_order INTEGER,transcription__based_on_pinyin_ VARCHAR) | SELECT MAX(standard_order) FROM table_1805919_1 WHERE transcription__based_on_pinyin_ = "Xi Wangri" |
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of salary bin hire_date by weekday. | 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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
Count the number of patients on a main drug type prescription with diagnoses icd9 code 41512. | 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 procedures (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.icd9_code = "41512" AND prescriptions.drug_type = "MAIN" |
Name the least game for score of l 93 109 (ot) | CREATE TABLE table_23186738_9 (game INTEGER,score VARCHAR) | SELECT MIN(game) FROM table_23186738_9 WHERE score = "L 93–109 (OT)" |
Top 10 Users from India by Reputation. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%india%' OR UPPER(Location) LIKE '%IND' ORDER BY Reputation DESC LIMIT 100 |
Show me about the distribution of meter_300 and meter_100 in a bar chart, and I want to show Y from low to high order. | CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Openin... | SELECT meter_300, meter_100 FROM swimmer ORDER BY meter_100 |
How many completion students in each day? Return a bar chart binning date of completion by weekday, and I want to sort y-axis in asc order. | CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment DATETIME,date_of_completion DATETIME)CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATE... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_completion) |
had patient 016-9636 excreted output amt-chest tube a in 12/this year? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE allergy (allergyid number,patientunitst... | SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput... |
Count the names of all the products in the store and return me a bar chart, could you order Name in asc 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 Name, COUNT(Name) FROM Products GROUP BY Name ORDER BY Name |
who was the pitcher in seasons 1982, 1984, 1985, 1987, 1988, 1989 | CREATE TABLE table_19864214_3 (pitcher VARCHAR,seasons VARCHAR) | SELECT pitcher FROM table_19864214_3 WHERE seasons = "1982, 1984, 1985, 1987, 1988, 1989" |
List first name and last name of customers that have more than 2 payments. | CREATE TABLE Customers (first_name VARCHAR,last_name VARCHAR,customer_id VARCHAR)CREATE TABLE Customer_Payments (customer_id VARCHAR) | SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2 |
what was the number of patients that were tested since 5 years ago for sputum, tracheal specimen microbiology? | 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 COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-5 year')) |
What is the player listed when the score is 68-70-68-69=275 | CREATE TABLE table_28498999_5 (player VARCHAR,score VARCHAR) | SELECT player FROM table_28498999_5 WHERE score = 68 - 70 - 68 - 69 = 275 |
what's the name of the specimen test that was first given to patient 40967 during the last hospital encounter? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_diagnoses (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 labevents (row_id number,... | SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 40967 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY microbiologyevents.charttime LIMIT 1 |
What is the Loan Club from Eng that ended on 22 February? | CREATE TABLE table_name_57 (loan_club VARCHAR,country VARCHAR,ended VARCHAR) | SELECT loan_club FROM table_name_57 WHERE country = "eng" AND ended = "22 february" |
What is the maximum renewable energy (gw h) for the state of Delaware? | CREATE TABLE table_25244412_1 (renewable_electricity__gw INTEGER,state VARCHAR) | SELECT MAX(renewable_electricity__gw) AS •h_ FROM table_25244412_1 WHERE state = "Delaware" |
How many competitions in each competition type? And split them by country, show in desc by the x-axis. | CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE competition (Competition_ID int,Year real,Competition_ty... | SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY Country DESC |
Which game had a result of 126-95? | CREATE TABLE table_75338 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text) | SELECT "Game" FROM table_75338 WHERE "Result" = '126-95' |
All posts of a user. | 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 OwnerUserId AS "user_link", u.DisplayName, p.Id AS "post_link", ParentId AS "post_link", Title FROM Posts AS p LEFT OUTER JOIN Users AS u ON u.Id = OwnerUserId WHERE OwnerUserId = 65889 |
In which club is Ledley King a captain? | CREATE TABLE table_name_3 (club VARCHAR,captain VARCHAR) | SELECT club FROM table_name_3 WHERE captain = "ledley king" |
Which team had 21 points? | CREATE TABLE table_20007 ("Position" real,"Team" text,"Points" real,"Played" real,"Won" real,"Drawn" real,"Lost" real,"For" real,"Against" real,"Difference" text) | SELECT "Team" FROM table_20007 WHERE "Points" = '21' |
With Round 3 and Pick # over 10, what is the higher Overall number? | CREATE TABLE table_name_38 (overall INTEGER,round VARCHAR,pick__number VARCHAR) | SELECT MAX(overall) FROM table_name_38 WHERE round = 3 AND pick__number > 10 |
Who is the tournament winner in the Atlantic Coast Conference? | CREATE TABLE table_22779004_1 (tournament_winner VARCHAR,conference VARCHAR) | SELECT tournament_winner FROM table_22779004_1 WHERE conference = "Atlantic Coast conference" |
what is the latest FIRST class flight of the day leaving DALLAS for SAN FRANCISCO | 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 dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,ser... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare_basis.class_type = 'FIRST' AND fa... |
has patient 030-8973 had any enteral osmolte 1.5 intake since 66 months ago. | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,cellla... | SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput... |
which district has the greatest total number of electorates ? | CREATE TABLE table_204_255 (id number,"constituency number" number,"name" text,"reserved for (sc/st/none)" text,"district" text,"number of electorates (2009)" number) | SELECT "district" FROM table_204_255 GROUP BY "district" ORDER BY SUM("number of electorates (2009)") DESC LIMIT 1 |
What is the title and source for the game developed by Hydravision Entertainment? | CREATE TABLE table_3580 ("Title and source" text,"Developer" text,"Publisher" text,"First released" text,"Japan" text,"Europe" text,"North America" text,"Exclusive" text,"Move-only" text) | SELECT "Title and source" FROM table_3580 WHERE "Developer" = 'Hydravision Entertainment' |
give me the number of patients whose year of death is less than or equal to 2158 and procedure icd9 code is 3615? | 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 demographic.dod_year <= "2158.0" AND procedures.icd9_code = "3615" |
Which college has fewer than 2 rounds? | CREATE TABLE table_35540 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT "College" FROM table_35540 WHERE "Round" < '2' |
What was the score for a game with the odds of p + 2 after 1847? | CREATE TABLE table_name_36 (score VARCHAR,odds VARCHAR,date VARCHAR) | SELECT score FROM table_name_36 WHERE odds = "p + 2" AND date > 1847 |
What is the district with the result mac collins (r) unopposed? | CREATE TABLE table_27021001_1 (district VARCHAR,result VARCHAR) | SELECT district FROM table_27021001_1 WHERE result = "Mac Collins (R) unopposed" |
what are the four most commonly prescribed drugs for patients who are prescribed cefepime at the same time? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE admissions (row_id number,subject_id number,... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'cefepime') AS t1 JOIN (SELECT admissions.subject_id, prescription... |
Name the least world rank for south american rank 3 | CREATE TABLE table_2249087_1 (world_rank INTEGER,south_american_rank VARCHAR) | SELECT MIN(world_rank) FROM table_2249087_1 WHERE south_american_rank = 3 |
what is the color quality when the proxy is x, the encryption is x, the webclient is x and authentication is ? | CREATE TABLE table_65068 ("Project" text,"License" text,"Date" text,"Protocol" text,"Technology" text,"Server" text,"Client" text,"Web Client" text,"Multiple Sessions" text,"Encryption" text,"Authentication" text,"Data Compression" text,"Image Quality" text,"Color Quality" text,"File Transfer" text,"Clipboard Transfer"... | SELECT "Color Quality" FROM table_65068 WHERE "Proxy" = 'x' AND "Encryption" = 'x' AND "Web Client" = 'x' AND "Authentication" = '✓' |
Which Advanced Portuguese courses have 8 credits , can you show me ? | 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 semester (semester_id int,semester varchar,year int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit i... | SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Advanced Portuguese%' OR name LIKE '%Advanced Portuguese%') AND credits = 8 |
select Title, Posts.Id, PostLinks.RelatedPostId, PostLinks.PostId from Posts inner join PostLinks O. | CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,Own... | SELECT Title, Posts.Id, PostLinks.RelatedPostId, PostLinks.PostId FROM Posts INNER JOIN PostLinks ON PostLinks.LinkTypeId = 3 AND (Posts.Id = PostLinks.PostId OR Posts.Id = PostLinks.RelatedPostId) |
How many faculty members did the university that conferred the most degrees in 2002 have? | CREATE TABLE discipline_enrollments (campus number,discipline number,year number,undergraduate number,graduate number)CREATE TABLE csu_fees (campus number,year number,campusfee number)CREATE TABLE enrollments (campus number,year number,totalenrollment_ay number,fte_ay number)CREATE TABLE degrees (year number,campus num... | SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1 |
which was the first state to be formed ? | CREATE TABLE table_203_190 (id number,"name" text,"type" text,"circle" text,"bench" text,"formed" number,"notes" text) | SELECT "name" FROM table_203_190 ORDER BY "formed" LIMIT 1 |
what was the number of winners from spain ? | CREATE TABLE table_203_600 (id number,"rank" text,"country" text,"winners" number,"runners-up" number,"finals total" number) | SELECT "winners" FROM table_203_600 WHERE "country" = 'spain' |
how many patients were diagnosed as having transaminase elevation within 2 months after being diagnosed with hypoglycemia? | 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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'transaminase elevation') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN p... |
Calculate the total number of patients admitted before the year 2174 | 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.admityear < "2174" |
What is the for the f136fb engine? | CREATE TABLE table_14101 ("Engine" text,"Displacement" text,"Years" text,"Usage" text,"Power" text) | SELECT "Usage" FROM table_14101 WHERE "Engine" = 'f136fb' |
When middle assyrian empire is the ubaid period in mesopotamia what is the copper age? | CREATE TABLE table_23537091_1 (copper_age VARCHAR,ubaid_period_in_mesopotamia VARCHAR) | SELECT copper_age FROM table_23537091_1 WHERE ubaid_period_in_mesopotamia = "Middle Assyrian Empire" |
Top 100K users by hit rate (accepted answer percentage rate). 100 users having the highest accepted answer percentage rate (among users with >100 answers) | 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 u.Id AS "user_link", COUNT(a.Id), (CAST(SUM(CASE WHEN a.Id = q.AcceptedAnswerId THEN 1 ELSE 0 END) AS FLOAT) / COUNT(a.Id)) * 100 AS HitRate FROM Users AS u JOIN Posts AS a ON a.OwnerUserId = u.Id AND a.PostTypeId = 2 JOIN Posts AS q ON a.ParentId = q.Id GROUP BY u.Id HAVING COUNT(a.Id) > 25 ORDER BY HitRate DES... |
How many Against have a Team of hespanha, and Points smaller than 30? | CREATE TABLE table_40250 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text) | SELECT COUNT("Against") FROM table_40250 WHERE "Team" = 'hespanha' AND "Points" < '30' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.