instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is a name for a drug that patient 77676 was prescribed within 2 days after having been diagnosed with diff connect tis dis nos until 11/2101?
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 procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,lin...
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 77676 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'diff c...
what is the date the high assists was andre miller (7)?
CREATE TABLE table_29898 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Date" FROM table_29898 WHERE "High assists" = 'Andre Miller (7)'
what 1989 has 2002 of 4r and 2005 of 4r?
CREATE TABLE table_name_22 (Id VARCHAR)
SELECT 1989 FROM table_name_22 WHERE 2002 = "4r" AND 2005 = "4r"
Where did St Kilda play as the away team?
CREATE TABLE table_32617 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Venue" FROM table_32617 WHERE "Away team" = 'st kilda'
What was the date that the decision was Niittymaki, the attendance larger than 19,207, and the record 28 17 5?
CREATE TABLE table_77555 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Date" FROM table_77555 WHERE "Decision" = 'niittymaki' AND "Attendance" > '19,207' AND "Record" = '28–17–5'
which player is from georgia
CREATE TABLE table_15871 ("Player" text,"No." real,"Nationality" text,"Position" text,"Years in Toronto" text,"School/Club Team" text)
SELECT "Player" FROM table_15871 WHERE "School/Club Team" = 'Georgia'
Name the country for hideki noda category:articles with hcards
CREATE TABLE table_19001175_1 (country VARCHAR,name VARCHAR)
SELECT country FROM table_19001175_1 WHERE name = "Hideki Noda Category:Articles with hCards"
What are all approximate sales for the author Laura Ingalls Wilder?
CREATE TABLE table_27409 ("Book series" text,"Author" text,"Original language" text,"No. of installments" text,"First published" text,"Approximate sales" text)
SELECT "Approximate sales" FROM table_27409 WHERE "Author" = 'Laura Ingalls Wilder'
What was the result when the score was 5-1?
CREATE TABLE table_62839 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_62839 WHERE "Score" = '5-1'
What's the S dbayern in 1928?
CREATE TABLE table_name_27 (südbayern VARCHAR,year VARCHAR)
SELECT südbayern FROM table_name_27 WHERE year = 1928
count the number of patients whose year of birth is less than 2058 and drug type is additive?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2058" AND prescriptions.drug_type = "ADDITIVE"
What is the marital status of Paul Edwards?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT demographic.marital_status FROM demographic WHERE demographic.name = "Paul Edwards"
what is maximum age of patients whose marital status is widowed and days of hospital stay is 29?
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 MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.days_stay = "29"
Who has the high points for the 69 game?
CREATE TABLE table_23285805_8 (high_points VARCHAR,game VARCHAR)
SELECT high_points FROM table_23285805_8 WHERE game = 69
show me the top three most frequent diagnoses that patients were given within the same month after being diagnosed with status cardiac pacemaker the last year.
CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icust...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, 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...
how many hours have elapsed since patient 007-15837 last received an intake of intake (ml)-gastrostomy/enterostomy gastrostomy 20 fr. luq on the current icu visit?
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 lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime ti...
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 ...
When mark critz (d) 50.8% tim burns (r) 49.2% are the candidates what is the party?
CREATE TABLE table_23282 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Party" FROM table_23282 WHERE "Candidates" = 'Mark Critz (D) 50.8% Tim Burns (R) 49.2%'
Let me see 2 -credit Bioinformatics Seminar classes .
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 DISTINCT department, name, number FROM course WHERE (description LIKE '%Bioinformatics Seminar%' OR name LIKE '%Bioinformatics Seminar%') AND credits = 2
What is the political party of Jackie Goldberg?
CREATE TABLE table_59493 ("Name" text,"Residence" text,"Party" text,"Years in Assembly" text,"Years in Senate" text)
SELECT "Party" FROM table_59493 WHERE "Name" = 'jackie goldberg'
Display a bar chart for what is total number of show times per dat for each cinema?, rank by the bars from low to high.
CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_cod...
SELECT Name, SUM(T1.Show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.Cinema_ID = T2.Cinema_ID GROUP BY T1.Cinema_ID ORDER BY Name
tell me how many doses of volume (ml) milrinone patient 021-25705 had consumed on last month/29.
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE patient (uniquepid text,patienthealths...
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 = '021-25705')) AND intakeoutput.celllabel = 'volum...
What is the number of failure for the country of Russia, and a Family of r14 r-14, and a Partial failures smaller than 0?
CREATE TABLE table_name_76 (failures VARCHAR,partial_failures VARCHAR,country VARCHAR,family VARCHAR)
SELECT COUNT(failures) FROM table_name_76 WHERE country = "russia" AND family = "r14 r-14" AND partial_failures < 0
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of first_name and department_id , and I want to order X in asc order.
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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE...
SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME
How many accounts for each customer? Show a bar chart that groups by customer's first name, sort by the the total number in ascending.
CREATE TABLE Invoices (invoice_number INTEGER,order_id INTEGER,invoice_date DATETIME)CREATE TABLE Orders (order_id INTEGER,customer_id INTEGER,date_order_placed DATETIME,order_details VARCHAR(255))CREATE TABLE Accounts (account_id INTEGER,customer_id INTEGER,date_account_opened DATETIME,account_name VARCHAR(50),other_a...
SELECT customer_first_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*)
How many points for the navy team that lost over 11?
CREATE TABLE table_67323 ("Team" text,"Played" real,"Drawn" real,"Lost" real,"Points" real)
SELECT SUM("Points") FROM table_67323 WHERE "Team" = 'navy' AND "Lost" > '11'
How many games played have 4.7 as points per game?
CREATE TABLE table_73584 ("Tournament" text,"Games played" real,"Points per game" text,"Rebounds per game" text,"Assists per game" text)
SELECT "Games played" FROM table_73584 WHERE "Points per game" = '4.7'
What are the least Top-5 finish when the events are greater than 18?
CREATE TABLE table_name_82 (top_5 INTEGER,events INTEGER)
SELECT MIN(top_5) FROM table_name_82 WHERE events > 18
provide the number of patients whose admission type is elective and procedure long title is percutaneous aspiration of liver?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Percutaneous aspiration of liver"
What is the average age for a male in each job Visualize by bar chart, and rank by the y-axis in desc.
CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job ORDER BY AVG(age) DESC
What are the number of the descriptions of the service types with product price above 100?, and I want to list from low to high by the y-axis.
CREATE TABLE Bookings (Booking_ID INTEGER,Customer_ID INTEGER,Workshop_Group_ID VARCHAR(100),Status_Code CHAR(15),Store_ID INTEGER,Order_Date DATETIME,Planned_Delivery_Date DATETIME,Actual_Delivery_Date DATETIME,Other_Order_Details VARCHAR(255))CREATE TABLE Stores (Store_ID VARCHAR(100),Address_ID INTEGER,Marketing_Reg...
SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY COUNT(Service_Type_Description)
how many patients are admitted under urgent type and procedured with endoscopic insertion of stent (tube) into bile duct?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.long_title = "Endoscopic insertion of stent (tube) into bile duct"
What circuit was for the german grand prix?
CREATE TABLE table_11806 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Report" text)
SELECT "Circuit" FROM table_11806 WHERE "Race" = 'german grand prix'
Who is the spouse of the queen who is the daughter of Ferdinand I of the two sicilies?
CREATE TABLE table_56244 ("Name" text,"Father" text,"Birth" text,"Marriage" text,"Became Queen" text,"Ceased to be Queen" text,"Death" text,"Spouse" text)
SELECT "Spouse" FROM table_56244 WHERE "Father" = 'ferdinand i of the two sicilies'
How many courses for each course description? Show me a bar chart.
CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varchar(15),STU_INI...
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION
What is the smallest rating with nightly rank smaller than 7, timeslot rank smaller than 5 and eposide after episode 6?
CREATE TABLE table_name_27 (rating INTEGER,episode VARCHAR,rank__night_ VARCHAR,rank__timeslot_ VARCHAR)
SELECT MIN(rating) FROM table_name_27 WHERE rank__night_ < 7 AND rank__timeslot_ < 5 AND episode > 6
which team had the highest number of losses ?
CREATE TABLE table_203_145 (id number,"position" number,"club" text,"played" number,"points" text,"wins" number,"draws" number,"losses" number,"goals for" number,"goals against" number,"goal difference" number)
SELECT "club" FROM table_203_145 ORDER BY "losses" DESC LIMIT 1
Which group has David D'Angers as the official history?
CREATE TABLE table_name_91 (group VARCHAR,official_history VARCHAR)
SELECT group FROM table_name_91 WHERE official_history = "david d'angers"
List the number of the phone numbers of all employees, and sort in descending by the names.
CREATE TABLE Playlist (PlaylistId integer,Name varchar(120))CREATE TABLE Genre (GenreId integer,Name varchar(120))CREATE TABLE Album (AlbumId integer,Title varchar(160),ArtistId integer)CREATE TABLE Invoice (InvoiceId integer,CustomerId integer,InvoiceDate datetime,BillingAddress varchar(70),BillingCity varchar(40),Bil...
SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone ORDER BY Phone DESC
What Date has a Rank of 2?
CREATE TABLE table_name_23 (date VARCHAR,rank VARCHAR)
SELECT date FROM table_name_23 WHERE rank = 2
what's the one year survival rate of a person diagnosed with thrombocytopenia - alcohol-related?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
Show the correlation between the problem id and log id which are assigned to the staff named Rylan Homenick with a scatter chart.
CREATE TABLE Product (product_id INTEGER,product_name VARCHAR(80),product_details VARCHAR(255))CREATE TABLE Problem_Log (problem_log_id INTEGER,assigned_to_staff_id INTEGER,problem_id INTEGER,problem_category_code VARCHAR(20),problem_status_code VARCHAR(20),log_entry_date DATETIME,log_entry_description VARCHAR(255),log...
SELECT problem_id, problem_log_id FROM Staff AS T1 JOIN Problem_Log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = "Rylan" AND T1.staff_last_name = "Homenick"
What is the total number of cuts made of tournaments with 2 Events?
CREATE TABLE table_name_81 (cuts_made VARCHAR,events VARCHAR)
SELECT COUNT(cuts_made) FROM table_name_81 WHERE events = 2
when for the last time patient 015-96048 has had output y (ml)-chest tube y - a #1 right mid b #1 left mid output on the last icu visit?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname te...
SELECT 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 = '015-96048') AND NOT patient.unitdischargetime IS NULL...
what is the team nickname when joined tschl is 2010 and home arena is kettering rec center and the team website is dayton hockey?
CREATE TABLE table_10081 ("Institution" text,"Location" text,"Team Nickname" text,"Joined TSCHL" real,"Home Arena" text,"Capacity" real,"Team Website" text)
SELECT "Team Nickname" FROM table_10081 WHERE "Joined TSCHL" = '2010' AND "Home Arena" = 'kettering rec center' AND "Team Website" = 'dayton hockey'
What report has a score of 0-0 with Sydney FC?
CREATE TABLE table_name_49 (report VARCHAR,score VARCHAR,away_team VARCHAR)
SELECT report FROM table_name_49 WHERE score = "0-0" AND away_team = "sydney fc"
Which 2007 has a 2003 of 2r, and a 2004 of 1r?
CREATE TABLE table_36099 ("Tournament" text,"1998" text,"1999" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"Career SR" text,"Career Win-Loss" text)
SELECT "2007" FROM table_36099 WHERE "2003" = '2r' AND "2004" = '1r'
What is the viewers for the episode 'woman marries heart'?
CREATE TABLE table_17174 ("#" real,"Episode" text,"Air Date" text,"Timeslot" text,"Rating" text,"Share" real,"18-49" text,"Viewers" text,"Weekly Rank" text)
SELECT "Viewers" FROM table_17174 WHERE "Episode" = 'Woman Marries Heart'
What is the To par, when the Score is 68-71-69=208?
CREATE TABLE table_41294 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "To par" FROM table_41294 WHERE "Score" = '68-71-69=208'
What district is incumbent ike skelton from?
CREATE TABLE table_1341604_26 (district VARCHAR,incumbent VARCHAR)
SELECT district FROM table_1341604_26 WHERE incumbent = "Ike Skelton"
What were the highest laps when the grid was larger than 19 and the time/retired was fuel?
CREATE TABLE table_name_52 (laps INTEGER,grid VARCHAR,time_retired VARCHAR)
SELECT MAX(laps) FROM table_name_52 WHERE grid > 19 AND time_retired = "fuel"
What is the largest issue date for an album that reached position of 3?
CREATE TABLE table_61071 ("Issue Date" real,"Album Title" text,"Artist" text,"Sales" real,"Highest Position" real)
SELECT MAX("Issue Date") FROM table_61071 WHERE "Highest Position" = '3'
What are the gender and occupation of players?
CREATE TABLE player (Gender VARCHAR,Occupation VARCHAR)
SELECT Gender, Occupation FROM player
What is the lowest total points Karine Tr cy has with a less than 12 place?
CREATE TABLE table_51321 ("Draw" real,"Song" text,"Artist" text,"Jury (Points)" text,"Televotes (Points)" text,"Total Points" real,"Place" real)
SELECT MIN("Total Points") FROM table_51321 WHERE "Artist" = 'karine trécy' AND "Place" < '12'
What is the lowest Position, when Points 1 is '39', and when Goals Against is greater than 49?
CREATE TABLE table_60991 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" text)
SELECT MIN("Position") FROM table_60991 WHERE "Points 1" = '39' AND "Goals Against" > '49'
Name the maximum kerry # for where others is 47
CREATE TABLE table_21579 ("County" text,"Kerry%" text,"Kerry#" real,"Bush%" text,"Bush#" real,"Others%" text,"Others#" real)
SELECT MAX("Kerry#") FROM table_21579 WHERE "Others#" = '47'
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a scatter chart shows the correlation between salary and manager_id .
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE ...
SELECT SALARY, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
could you please give me information concerning AA a flight from WASHINGTON to PHILADELPHIA the earliest one in the morning as possible
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 food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE time_interval (per...
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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, and could you rank by the Y-axis in desc?
CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),S...
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID) DESC
Show the name of the party that has the most delegates.
CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_governor text,comptroller text,attorney_general text,us_senate text)CREATE TABLE county (county_id number,county_name text,population number,zip_code text)CREATE TABLE election (election_id number,counties_represented text,district numb...
SELECT T2.party FROM election AS T1 JOIN party AS T2 ON T1.party = T2.party_id GROUP BY T1.party ORDER BY COUNT(*) DESC LIMIT 1
What is the Frequency MHz for the station with a call sign of w224bn?
CREATE TABLE table_name_2 (frequency_mhz INTEGER,call_sign VARCHAR)
SELECT AVG(frequency_mhz) FROM table_name_2 WHERE call_sign = "w224bn"
Find the name and position of the head of the department with the least employees.
CREATE TABLE patient (ssn number,name text,address text,phone text,insuranceid number,pcp number)CREATE TABLE nurse (employeeid number,name text,position text,registered boolean,ssn number)CREATE TABLE procedures (code number,name text,cost number)CREATE TABLE on_call (nurse number,blockfloor number,blockcode number,on...
SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.employeeid GROUP BY departmentid ORDER BY COUNT(departmentid) LIMIT 1
Hidden Gems in Late Answers.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteU...
SELECT a.* FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id INNER JOIN Users AS u ON a.OwnerUserId = u.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND DATEDIFF(month, q.CreationDate, creationDate) > 6 AND DATEDIFF(day, u.CreationDate, creationDate) < 7 AND u.CreationDate > q.CreationDate AND a.Score > 10
What's the Elevator that has Elevated: 1378, September 18, an Order of Cardinal-Priest, and an Elector of Poncello Orsini?
CREATE TABLE table_name_25 (elevator VARCHAR,elector VARCHAR,elevated VARCHAR,order VARCHAR)
SELECT elevator FROM table_name_25 WHERE elevated = "1378, september 18" AND order = "cardinal-priest" AND elector = "poncello orsini"
What are the Modular Forms courses with 13 credits ?
CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_discussion varchar,has_lab varchar,has_projects varchar,has_exams varchar,num_reviews int,clarity_score i...
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Modular Forms%' OR name LIKE '%Modular Forms%') AND credits = 13
Tell me the portfolio of minister of carlo giovanardi
CREATE TABLE table_name_77 (portfolio VARCHAR,minister VARCHAR)
SELECT portfolio FROM table_name_77 WHERE minister = "carlo giovanardi"
With the pick of 1 Cecil Martin has what number as the overall?
CREATE TABLE table_46339 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT COUNT("Overall") FROM table_46339 WHERE "Pick" = '1' AND "Name" = 'cecil martin'
Questions answered by me without an accepted answer.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE Comment...
SELECT q.Id AS "post_link", a.CreationDate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE a.OwnerUserId = '##UserId##' AND q.AcceptedAnswerId IS NULL
On April 29, with a game larger than 2, what is the high points?
CREATE TABLE table_name_25 (high_points VARCHAR,game VARCHAR,date VARCHAR)
SELECT high_points FROM table_name_25 WHERE game > 2 AND date = "april 29"
Show the protein name and the institution name.
CREATE TABLE protein (common_name text,protein_name text,divergence_from_human_lineage number,accession_number text,sequence_length number,sequence_identity_to_human_protein text,institution_id text)CREATE TABLE institution (institution_id text,institution text,location text,founded number,type text,enrollment number,t...
SELECT T2.protein_name, T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id
Which duchess was born on 9 october 1574?
CREATE TABLE table_6079 ("Image" text,"Father" text,"Birth" text,"Ceased to be Duchess" text,"Death" text,"Husband" text)
SELECT "Ceased to be Duchess" FROM table_6079 WHERE "Birth" = '9 october 1574'
What engine does Garvey Team Lotus use?
CREATE TABLE table_name_50 (engine VARCHAR,entrant VARCHAR)
SELECT engine FROM table_name_50 WHERE entrant = "garvey team lotus"
What is the score of the match on September 24, 2006?
CREATE TABLE table_79661 ("Date" text,"Tournament" text,"Surface" text,"Opponent in final" text,"Score" text,"Prize Money" text)
SELECT "Score" FROM table_79661 WHERE "Date" = 'september 24, 2006'
What Chassis code has a 200d model and a Power of ps (kw; hp) @ 4200?
CREATE TABLE table_name_63 (chassis_code VARCHAR,power VARCHAR,model VARCHAR)
SELECT chassis_code FROM table_name_63 WHERE power = "ps (kw; hp) @ 4200" AND model = "200d"
Draw a bar chart about the distribution of date_address_to and the amount of date_address_to bin date_address_to by weekday.
CREATE TABLE Students_in_Detention (student_id INTEGER,detention_id INTEGER,incident_id INTEGER)CREATE TABLE Teachers (teacher_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(80),last_name VARCHAR(80),gender VARCHAR(1),cell_mobile_number VARCHAR(40),email_address VARCHAR(40),other_details VARCH...
SELECT date_address_to, COUNT(date_address_to) FROM Student_Addresses ORDER BY monthly_rental DESC
What stations had 183000 users in 2006-2007?
CREATE TABLE table_1232 ("Station" text,"Year opened" text,"Metropolitan borough [c ]" text,"Zone" real,"Servedby Route maps:- [ dead link ] [ dead link ]" text,"Station users 2006\u201307" real,"Station users 2007\u201308" real)
SELECT "Station" FROM table_1232 WHERE "Station users 2006\u201307" = '183000'
How many upvotes, downvotes, net votes and total votes do I have for each tag?.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,R...
SELECT TagName, COUNT(CASE WHEN VoteTypeId = 2 THEN 1 END) AS UpVotes, COUNT(CASE WHEN VoteTypeId = 3 THEN 1 END) AS DownVotes, SUM(CASE WHEN VoteTypeId = 2 THEN 1 WHEN VoteTypeId = 3 THEN -1 END) AS NetVotes, COUNT(*) AS TotalVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Par...
What are the descriptions of the service types with product price above 100?
CREATE TABLE performers_in_bookings (order_id number,performer_id number)CREATE TABLE bookings_services (order_id number,product_id number)CREATE TABLE order_items (order_item_id number,order_id number,product_id number,order_quantity text,other_item_details text)CREATE TABLE ref_service_types (service_type_code text,p...
SELECT T1.service_type_description FROM ref_service_types AS T1 JOIN services AS T2 ON T1.service_type_code = T2.service_type_code WHERE T2.product_price > 100
What is the total on average for teams with 3 tournaments?
CREATE TABLE table_51931 ("Team" text,"Seasons" text,"Regular season" text,"Tournament" real,"Total" real)
SELECT AVG("Total") FROM table_51931 WHERE "Tournament" = '3'
What are the ties for division of bafl division two south?
CREATE TABLE table_name_8 (ties VARCHAR,division VARCHAR)
SELECT ties FROM table_name_8 WHERE division = "bafl division two south"
how many times has Aaron Ogden (f), been a successor and has had a formal installation?
CREATE TABLE table_224840_3 (date_of_successors_formal_installation VARCHAR,successor VARCHAR)
SELECT COUNT(date_of_successors_formal_installation) FROM table_224840_3 WHERE successor = "Aaron Ogden (F)"
have there been any organism found during the first aspirate microbiology test of patient 4718 until 3 years ago?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4718) AND microbiologyevents.spec_type_desc = 'aspirate' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIM...
In the game where the crowd was 11,327 and the hoem team scored 13.17 (95) How much did the away team score?
CREATE TABLE table_11517 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_11517 WHERE "Crowd" > '11,327' AND "Home team score" = '13.17 (95)'
Name the high rebounds for score of 64-74
CREATE TABLE table_17103729_8 (high_rebounds VARCHAR,score VARCHAR)
SELECT COUNT(high_rebounds) FROM table_17103729_8 WHERE score = "64-74"
how many total points were scored in the interview round between all states ?
CREATE TABLE table_203_523 (id number,"state" text,"swimsuit" number,"interview" number,"evening gown" number,"average" number,"finalists" number)
SELECT SUM("interview") FROM table_203_523
what was the top five most common specimen tests that followed within 2 months for those who had been diagnosed with mitral/aortic val insuff this year?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE inputevents_...
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 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_...
what is the number of patients whose gender is m and diagnoses long title is hip joint replacement?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Hip joint replacement"
What sum of Losses has Year greater than 1972, and Competition of nswrfl, and Draws 0, and Wins 16?
CREATE TABLE table_name_18 (loses INTEGER,wins VARCHAR,draws VARCHAR,year VARCHAR,competition VARCHAR)
SELECT SUM(loses) FROM table_name_18 WHERE year > 1972 AND competition = "nswrfl" AND draws = 0 AND wins = 16
count the number of patients whose drug type is base and lab test name is calculated thyroxine (t4) index?.
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "BASE" AND lab.label = "Calculated Thyroxine (T4) Index"
what is the total number of miss northern irelands that were from belfast ?
CREATE TABLE table_203_727 (id number,"year" number,"miss northern ireland" text,"hometown" text,"placement at miss world" text,"notes" text)
SELECT COUNT("miss northern ireland") FROM table_203_727 WHERE "hometown" = 'belfast'
what was the name of the organism found in patient 24894's first blood culture (post-mortem) test, which took place in their last hospital encounter?
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,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,sta...
SELECT microbiologyevents.org_name FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24894 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND microbiologyevents.spec_type_desc = 'blood culture (post-mort...
what album had the singles i want you to know and again on them ?
CREATE TABLE table_204_689 (id number,"year" number,"title" text,"album" text,"uk" number,"b-sides" text)
SELECT "album" FROM table_204_689 WHERE "title" = '"i want you to know"'
who is the last wrestler to hold the title ?
CREATE TABLE table_204_684 (id number,"wrestler:" text,"times:" number,"date:" text,"location:" text,"notes:" text)
SELECT "wrestler:" FROM table_204_684 ORDER BY "date:" DESC LIMIT 1
Who is teaching ULCS classes next Winter ?
CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE student (student_id int,lastname va...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
For the 1948-49 season, what was the At Home record?
CREATE TABLE table_58955 ("Season" text,"League" text,"Teams" text,"Home" text,"Away" text)
SELECT "Home" FROM table_58955 WHERE "Season" = '1948-49'
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of email and employee_id , display in asc by the y-axis.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decima...
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID
What game has a platform(s) of playstation 3, when the genre is platform game?
CREATE TABLE table_name_33 (game VARCHAR,platform_s_ VARCHAR,genre VARCHAR)
SELECT game FROM table_name_33 WHERE platform_s_ = "playstation 3" AND genre = "platform game"
What is the average grid for the competitiors who had laps smaller than 3?
CREATE TABLE table_78506 ("Rider" text,"Manufacturer" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT AVG("Grid") FROM table_78506 WHERE "Laps" < '3'
What is the total number of years wehre anna thompson had a 3rd place result at edinburgh, scotland?
CREATE TABLE table_name_28 (year VARCHAR,result VARCHAR,venue VARCHAR)
SELECT COUNT(year) FROM table_name_28 WHERE result = "3rd" AND venue = "edinburgh, scotland"
when did patient 3712 receive control of epistaxis nos last time?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime 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 prescriptions (row_id number,subject_id number,hadm_id number,st...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'control of epistaxis nos') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3712) ORDE...
What was the date of the game in which the series was 1-4?
CREATE TABLE table_69739 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Series" text)
SELECT "Date" FROM table_69739 WHERE "Series" = '1-4'