instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
when is the first time that patient 013-23115 received a nitroglycerin - sublingual since 1 year ago?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight...
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-23115')) AND treatment.treatmentname = 'nitroglycerin - subli...
Average Post Score by Day of the Week.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCou...
SELECT AVG(1.00 * Score) AS AvgScore, TIME_TO_STR(CreationDate, '%A') AS DayOfWeek FROM Posts GROUP BY TIME_TO_STR(CreationDate, '%A') ORDER BY SUM(Score) DESC
for patients that were prescribed with lithium carbonate sr (lithobid), what are the four most commonly ordered drugs at the same time, until 1 year ago?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)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 cost (row_id number,subject_id number,hadm_id number,event_type text,eve...
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 = 'lithium carbonate sr (lithobid)' AND DATETIME(prescriptions.start...
provide the number of patients who were admitted before the year 2123 with a hematology lab test category.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2123" AND lab."CATEGORY" = "Hematology"
What are the first names and last names of the students that minor in the department with DNO 140.
CREATE TABLE STUDENT (Fname VARCHAR,Lname VARCHAR,StuID VARCHAR)CREATE TABLE MINOR_IN (StuID VARCHAR,DNO VARCHAR)
SELECT T2.Fname, T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140
count the number of patients whose days of hospital stay is greater than 10 and lab test fluid is other body fluid?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "10" AND lab.fluid = "Other Body Fluid"
What record has montreal, qc as the location, with boston bruins as the visitor?
CREATE TABLE table_8355 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Location" text,"In goal" text,"Record" text)
SELECT "Record" FROM table_8355 WHERE "Location" = 'montreal, qc' AND "Visitor" = 'boston bruins'
what was the marital status of patient 73713 during the current hospital encounter?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate t...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 73713 AND admissions.dischtime IS NULL
What was the score of the away team at Junction Oval venue?
CREATE TABLE table_name_8 (away_team VARCHAR,venue VARCHAR)
SELECT away_team AS score FROM table_name_8 WHERE venue = "junction oval"
Name the score for fiji
CREATE TABLE table_80186 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Score" FROM table_80186 WHERE "Country" = 'fiji'
Please give me a bar chart to show the total number of singers who sang the top 3 most highly rated songs from different countries.
CREATE TABLE genre (g_name varchar2(20),rating varchar2(10),most_popular_in varchar2(50))CREATE TABLE song (song_name varchar2(50),artist_name varchar2(50),country varchar2(20),f_id number(10),genre_is varchar2(20),rating number(10),languages varchar2(20),releasedate Date,resolution number(10))CREATE TABLE files (f_id ...
SELECT T1.country, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T1.country ORDER BY T2.rating DESC LIMIT 3
what is the number of patients who had a delayed clos abd wound procedure in 2103?
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 outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE prescriptions (r...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'delayed clos abd wound') AND STRFTIME('%y', procedur...
Show the number of apartment bookings in each year and bin booking end date by year with a bar chart, and could you list in desc by the how many booking end date?
CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name CHAR(15),building_full_name VARCHAR(80),building_description VARCHAR(255),build...
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings ORDER BY COUNT(booking_end_date) DESC
what is the total when the rank is total and the silver is less than 10?
CREATE TABLE table_name_35 (total INTEGER,rank VARCHAR,silver VARCHAR)
SELECT SUM(total) FROM table_name_35 WHERE rank = total AND silver < 10
In which year did the least people enter hall of fame?
CREATE TABLE player_award (player_id text,award_id text,year number,league_id text,tie text,notes text)CREATE TABLE batting (player_id text,year number,stint number,team_id text,league_id text,g number,ab number,r number,h number,double number,triple number,hr number,rbi number,sb number,cs number,bb number,so number,i...
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) LIMIT 1
what's the maximum cost of a hospital that includes a drug called alteplase (catheter clearance) until 1 year ago?
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 d_labitems (row_id number,itemid number,label text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,chartt...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'alteplase (catheter clearance)') AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY cost.hadm_id) AS t1
Visualize a scatter chart about the correlation between Team_ID and ACC_Percent , and group by attribute ACC_Home.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Home
All my answers for a given year. All my answers on the site
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 a.Id AS "post_link", CASE WHEN q.AcceptedAnswerId = a.Id THEN 'Accepted' END AS Accepted, CASE WHEN q.OwnerUserId = a.OwnerUserId THEN 'Self' END AS Self, a.Score, a.CreationDate, CASE WHEN NOT q.CommunityOwnedDate IS NULL THEN 'Q' WHEN NOT a.CommunityOwnedDate IS NULL THEN 'A' END AS CW FROM Posts AS q INNER JO...
Is the Washington Corrections Center for Women (WCCW) a major facility?
CREATE TABLE table_27566 ("Facility" text,"Location" text,"Year Opened" text,"Major Facility" text,"Population Gender" text,"Capacity" real,"Custody Level(s)" text)
SELECT "Major Facility" FROM table_27566 WHERE "Facility" = 'Washington Corrections Center for Women (WCCW)'
What is the lowest overall amount of wins?
CREATE TABLE table_26815674_1 (wins INTEGER)
SELECT MIN(wins) FROM table_26815674_1
where did obama get 39.8%
CREATE TABLE table_23696 ("County" text,"McCain #" real,"McCain %" text,"Obama #" real,"Obama %" text)
SELECT "County" FROM table_23696 WHERE "Obama %" = '39.8%'
When has a Source of rasmussen reports?
CREATE TABLE table_name_39 (date VARCHAR,source VARCHAR)
SELECT date FROM table_name_39 WHERE source = "rasmussen reports"
What is the origin of the one whose final destination is Brandholmen?
CREATE TABLE table_name_15 (origin VARCHAR,final_destination VARCHAR)
SELECT origin FROM table_name_15 WHERE final_destination = "brandholmen"
Find the total credits of all classes offered by each department. Show a pie chart.
CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)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...
SELECT DEPT_CODE, SUM(T1.CRS_CREDIT) FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE
what is drug type and drug route of drug code isos10?
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, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "ISOS10"
For all employees who have the letters D or S in their first name, return a scatter chart about the correlation between commission_pct and manager_id .
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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),DEPARTME...
SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
Which Touchdowns is the lowest one that has Extra points smaller than 14, and a Player of white, and Points smaller than 5?
CREATE TABLE table_name_98 (touchdowns INTEGER,points VARCHAR,extra_points VARCHAR,player VARCHAR)
SELECT MIN(touchdowns) FROM table_name_98 WHERE extra_points < 14 AND player = "white" AND points < 5
What year is Zhong from?
CREATE TABLE table_45583 ("State" text,"Type" text,"Name" text,"Title" text,"Royal house" text,"From" text)
SELECT "From" FROM table_45583 WHERE "Name" = 'zhong'
how did patient 006-125738 last come into the hospital until 2104?
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 patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '006-125738' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104' ORDER BY patient.hospitaladmittime DESC LIMIT 1
what was the first urine output time for patient 022-199074 on this month/31?
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 lab (labid number,patientunitstayid number,labname text,labresult number,l...
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 = '022-199074')) AND intakeoutput.cellpath LIKE '%output...
What is the country where there are 8 children per donor and no data for donor payments?
CREATE TABLE table_16175217_1 (country VARCHAR,children_per_donor VARCHAR,donor_payment VARCHAR)
SELECT country FROM table_16175217_1 WHERE children_per_donor = "8 children" AND donor_payment = "no data"
triglycerides greater than or equal to 500 mg / dl
CREATE TABLE table_dev_9 ("id" int,"heart_disease" bool,"hba1c" float,"coronary_artery_disease_cad" bool,"triglyceride_tg" float,"hypertension" bool,"NOUSE" float)
SELECT * FROM table_dev_9 WHERE triglyceride_tg >= 500
What's the title of the episode originally aired on September 23, 2008?
CREATE TABLE table_22971 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. viewers (millions)" text)
SELECT "Title" FROM table_22971 WHERE "Original air date" = 'September 23, 2008'
What is the Time of the Athlete with a Rank of 6?
CREATE TABLE table_14019 ("Rank" real,"Athletes" text,"Country" text,"Time" text,"Notes" text)
SELECT "Time" FROM table_14019 WHERE "Rank" = '6'
Was there PPV when the service was SCT?
CREATE TABLE table_15887683_19 (ppv VARCHAR,television_service VARCHAR)
SELECT ppv FROM table_15887683_19 WHERE television_service = "SCT"
what are the methods of consumption of piperacillin-tazobactam 3.375 g mini-bag plus?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayi...
SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'piperacillin-tazobactam 3.375 g mini-bag plus'
Who was playing when the score was 5 7, 6 7 (4 7)?
CREATE TABLE table_2186447_1 (opponents VARCHAR,score VARCHAR)
SELECT opponents FROM table_2186447_1 WHERE score = "5–7, 6–7 (4–7)"
how many patients diagnosed under icd9 code 25541 were divorced?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.icd9_code = "25541"
What is Athletes, when Run 2 is 1:24.77?
CREATE TABLE table_name_86 (athletes VARCHAR,run_2 VARCHAR)
SELECT athletes FROM table_name_86 WHERE run_2 = "1:24.77"
For those products with a price between 60 and 120, find name and code , and visualize them by a bar chart, list from high to low by the names.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name DESC
oren etzioni 's papers
CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE cite (citingpaperid int,citedpaperid int)CREATE TABLE writes (paperid int,autho...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'oren etzioni' AND writes.authorid = author.authorid
What is Years, when Win-Loss is 11-60?
CREATE TABLE table_44566 ("Coach" text,"Years" text,"Win-Loss" text,"Win %" text,"Conference Titles" text)
SELECT "Years" FROM table_44566 WHERE "Win-Loss" = '11-60'
what was the first value of the potassium lab test for patient 022-78464 on their last hospital visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE lab (labid number,patientunitstayid number,lab...
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-78464' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmit...
Find the names of schools that have some students playing in goalie and mid positions.
CREATE TABLE tryout (cName VARCHAR,pPos VARCHAR)
SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid'
How much Conceded has Wins smaller than 3, and Points larger than 11?
CREATE TABLE table_66361 ("Position" real,"Team" text,"Played" real,"Wins" real,"Draws" real,"Losses" real,"Scored" real,"Conceded" real,"Points" real)
SELECT COUNT("Conceded") FROM table_66361 WHERE "Wins" < '3' AND "Points" > '11'
Who had the highest points of the game on March 24?
CREATE TABLE table_name_39 (high_points VARCHAR,date VARCHAR)
SELECT high_points FROM table_name_39 WHERE date = "march 24"
what is the average age of patients whose language is cape and primary disease is coronary artery disease?
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 AVG(demographic.age) FROM demographic WHERE demographic.language = "CAPE" AND demographic.diagnosis = "CORONARY ARTERY DISEASE"
Which gene has 4,895,836 base pairs?
CREATE TABLE table_name_94 (genes VARCHAR,base_pairs VARCHAR)
SELECT genes FROM table_name_94 WHERE base_pairs = "4,895,836"
Which Position has a Round of 4, and a School/Club Team of concordia?
CREATE TABLE table_name_34 (position VARCHAR,round VARCHAR,school_club_team VARCHAR)
SELECT position FROM table_name_34 WHERE round = 4 AND school_club_team = "concordia"
When was the game at Collingwood?
CREATE TABLE table_11423 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_11423 WHERE "Away team" = 'collingwood'
please show me fares from DENVER to SAN FRANCISCO
CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE restriction (res...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_...
Return the average price for each product type Visualize by bar chart, and list by the Y-axis in asc.
CREATE TABLE Product_Suppliers (product_id INTEGER,supplier_id INTEGER,date_supplied_from DATETIME,date_supplied_to DATETIME,total_amount_purchased VARCHAR(80),total_value_purchased DECIMAL(19,4))CREATE TABLE Customer_Addresses (customer_id INTEGER,address_id INTEGER,date_from DATETIME,date_to DATETIME)CREATE TABLE Sup...
SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code ORDER BY AVG(product_price)
Draw a bar chart for how many captains with younger than 50 are in each rank?, show by the Y-axis in asc.
CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text)CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text)
SELECT Rank, COUNT(*) FROM captain WHERE age < 50 GROUP BY Rank ORDER BY COUNT(*)
What is the score for the November 3 game?
CREATE TABLE table_36878 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text,"Attendance" real)
SELECT "Score" FROM table_36878 WHERE "Date" = 'november 3'
How many students are attending English courses?
CREATE TABLE candidates (candidate_id number,candidate_details text)CREATE TABLE student_course_attendance (student_id number,course_id number,date_of_attendance time)CREATE TABLE student_course_registrations (student_id number,course_id number,registration_date time)CREATE TABLE people_addresses (person_address_id num...
SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English"
Plot date to by the number of date to as a trend line
CREATE TABLE Document_Types (document_type_code VARCHAR(10),document_description VARCHAR(255))CREATE TABLE Projects (project_id INTEGER,organisation_id INTEGER,project_details VARCHAR(255))CREATE TABLE Organisations (organisation_id INTEGER,organisation_type VARCHAR(10),organisation_details VARCHAR(255))CREATE TABLE Do...
SELECT date_to, COUNT(date_to) FROM Project_Staff
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 bar chart shows the distribution of hire_date and the average of department_id bin hire_date by time, and could you rank from high to low by the total number?
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STAT...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC
What is the average number of floors for buildings in mecca ranked above 12?
CREATE TABLE table_name_40 (floors INTEGER,city VARCHAR,rank VARCHAR)
SELECT AVG(floors) FROM table_name_40 WHERE city = "mecca" AND rank < 12
give me the number of patients whose primary disease is colangitis and age is less than 85?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COLANGITIS" AND demographic.age < "85"
What is the frequency for the 10kw station with DXEZ as its callsign?
CREATE TABLE table_40153 ("Branding" text,"Callsign" text,"Frequency" text,"Power (kW)" text,"Coverage" text)
SELECT "Frequency" FROM table_40153 WHERE "Power (kW)" = '10kw' AND "Callsign" = 'dxez'
For those records from the products and each product's manufacturer, give me the comparison about the average of code over the name , and group by attribute name by a bar chart, and display from high to low by the names.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
What is the total S D with a 3298 (1986) [3 H] nizoxetine and an N D greater than 37.01?
CREATE TABLE table_65226 ("[ 3 H]CFT" real,"[ 3 H]Nisoxetine" text,"[ 3 H]Paroxetine" text,"N \u00f7 D" real,"S \u00f7 D" real)
SELECT COUNT("S \u00f7 D") FROM table_65226 WHERE "[ 3 H]Nisoxetine" = '3298 (1986)' AND "N \u00f7 D" > '37.01'
Which round did jonathan bomarito win?
CREATE TABLE table_name_23 (round VARCHAR,winning_driver VARCHAR)
SELECT round FROM table_name_23 WHERE winning_driver = "jonathan bomarito"
What is the callsign that has a station type of relay and a channel number of TV-2?
CREATE TABLE table_24673888_1 (callsign VARCHAR,station_type VARCHAR,ch__number VARCHAR)
SELECT callsign FROM table_24673888_1 WHERE station_type = "Relay" AND ch__number = "TV-2"
Who was the player with a score of 70-69=139?
CREATE TABLE table_48688 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Player" FROM table_48688 WHERE "Score" = '70-69=139'
How many T-260 EU aircrafts are currently in service?
CREATE TABLE table_name_64 (in_service VARCHAR,versions VARCHAR)
SELECT in_service FROM table_name_64 WHERE versions = "t-260 eu"
who is the miss earth venezuela when the 2nd runner-up is mar a escalante?
CREATE TABLE table_9721 ("Year" real,"Miss Earth Venezuela" text,"1st Runner Up" text,"2nd Runner Up" text,"3rd Runner Up" text,"4th Runner Up" text)
SELECT "Miss Earth Venezuela" FROM table_9721 WHERE "2nd Runner Up" = 'maría escalante'
provide the number of patients whose procedure icd9 code is 8848?
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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "8848"
Where was the Ivy League conference tournament?
CREATE TABLE table_21091982_3 (tournament_venue__city_ VARCHAR,conference VARCHAR)
SELECT tournament_venue__city_ FROM table_21091982_3 WHERE conference = "Ivy League"
Name the country for athens
CREATE TABLE table_28281704_1 (country VARCHAR,city VARCHAR)
SELECT COUNT(country) FROM table_28281704_1 WHERE city = "Athens"
Show me team_id by all road in a histogram, and I want to list from high to low by the Team_ID.
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_Road, Team_ID FROM basketball_match ORDER BY Team_ID DESC
what is the flight number of the earliest flight between BOSTON and WASHINGTON
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE month (month_number ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHIN...
What are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?, rank y-axis in ascending order.
CREATE TABLE Ref_Characteristic_Types (characteristic_type_code VARCHAR(15),characteristic_type_description VARCHAR(80))CREATE TABLE Ref_Product_Categories (product_category_code VARCHAR(15),product_category_description VARCHAR(80),unit_of_measure VARCHAR(20))CREATE TABLE Characteristics (characteristic_id INTEGER,char...
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description)
what are the three most frequently ordered specimen tests for patients who have been diagnosed with cholelith w cholecys nec before within 2 months, until 2104?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id numbe...
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_...
How many times is a to par listed when the player is phil mickelson?
CREATE TABLE table_28498999_5 (to_par VARCHAR,player VARCHAR)
SELECT COUNT(to_par) FROM table_28498999_5 WHERE player = "Phil Mickelson"
What are the names of the services that have never been used?
CREATE TABLE organization_contact_individuals (individual_id number,organization_id number,date_contact_from time,date_contact_to time)CREATE TABLE party_addresses (party_id number,address_id number,date_address_from time,address_type_code text,date_address_to time)CREATE TABLE parties (party_id number,payment_method_c...
SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id
how many 1 ml vial : hydralazine hcl 20 mg/ml ij soln prescriptions was there until 4 years ago?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT COUNT(*) FROM medication WHERE medication.drugname = '1 ml vial : hydralazine hcl 20 mg/ml ij soln' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-4 year')
What is the lowest total from slovenia with a Gold smaller than 0?
CREATE TABLE table_51457 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Total") FROM table_51457 WHERE "Nation" = 'slovenia' AND "Gold" < '0'
What number is Fall 06 from the state with 79 or less in Fall 08, 36 or greater in Fall 07 and greater than 74 in Fall 05?
CREATE TABLE table_name_92 (fall_06 INTEGER,fall_05 VARCHAR,fall_08 VARCHAR,fall_07 VARCHAR)
SELECT AVG(fall_06) FROM table_name_92 WHERE fall_08 < 79 AND fall_07 > 36 AND fall_05 > 74
What is the number in season for the episode written by Chris Mitchell and Erik Wiese?
CREATE TABLE table_24474 ("No. in series" text,"No. in season" text,"Title" text,"Directed by" text,"Written by" text,"Original air date" text)
SELECT "No. in season" FROM table_24474 WHERE "Written by" = 'Chris Mitchell and Erik Wiese'
A bar chart shows the distribution of Sex and the sum of Weight , and group by attribute Sex.
CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex
What was the USA airdate for 'Jenny From the Block'?
CREATE TABLE table_24041 ("Episode #" real,"Episode" real,"Title" text,"Director" text,"Writer" text,"Original airdate" text,"U.S. airdate" text)
SELECT "U.S. airdate" FROM table_24041 WHERE "Title" = 'Jenny from the Block'
What's the English Title of Fanny Och Alexander?
CREATE TABLE table_name_20 (english_title VARCHAR,original_title VARCHAR)
SELECT english_title FROM table_name_20 WHERE original_title = "fanny och alexander"
What was Anthony Leung Kam-Chung previous position?
CREATE TABLE table_2263674_1 (portfolio VARCHAR,romanised_name VARCHAR)
SELECT portfolio FROM table_2263674_1 WHERE romanised_name = "Anthony Leung Kam-chung"
What is the country of the player who has a total larger than 300?
CREATE TABLE table_62506 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" real,"Finish" text)
SELECT "Country" FROM table_62506 WHERE "Total" > '300'
What is the average age for a male in each job?
CREATE TABLE personfriend (name text,friend text,year number)CREATE TABLE person (name text,age number,city text,gender text,job text)
SELECT AVG(age), job FROM person WHERE gender = 'male' GROUP BY job
What was the transfer fee when the moving from was celta de Vigo?
CREATE TABLE table_name_25 (transfer_fee VARCHAR,moving_from VARCHAR)
SELECT transfer_fee FROM table_name_25 WHERE moving_from = "celta de vigo"
What is the 6th dail share of votes?
CREATE TABLE table_name_67 (share_of_votes VARCHAR,dáil VARCHAR)
SELECT share_of_votes FROM table_name_67 WHERE dáil = "6th"
What is the size when the frame is bigger than for 4096.0
CREATE TABLE table_1251878_3 (aspect_ratio VARCHAR,width INTEGER)
SELECT aspect_ratio FROM table_1251878_3 WHERE width > 4096.0
Name the season for spvgg bayreuth and fsv salmrohr
CREATE TABLE table_14242137_4 (season VARCHAR,oberliga_bayern VARCHAR,oberliga_südwest VARCHAR)
SELECT season FROM table_14242137_4 WHERE oberliga_bayern = "SpVgg Bayreuth" AND oberliga_südwest = "FSV Salmrohr"
What is Away Team Score, when Ground is Optus Oval, and when Away Team is Fremantle?
CREATE TABLE table_name_65 (away_team VARCHAR,ground VARCHAR)
SELECT away_team AS score FROM table_name_65 WHERE ground = "optus oval" AND away_team = "fremantle"
WhichScore has a Location Attendance of seattle center coliseum 11,497?
CREATE TABLE table_name_15 (score VARCHAR,location_attendance VARCHAR)
SELECT score FROM table_name_15 WHERE location_attendance = "seattle center coliseum 11,497"
How many scores were at the Northville Long Island Classic?
CREATE TABLE table_11621873_1 (score VARCHAR,tournament VARCHAR)
SELECT COUNT(score) FROM table_11621873_1 WHERE tournament = "Northville Long Island Classic"
what was the last time patient 4401 intake time today?
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 inputevents_cv.charttime 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 = 4401)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'st...
What Player has a College that is alberta?
CREATE TABLE table_name_56 (player VARCHAR,college VARCHAR)
SELECT player FROM table_name_56 WHERE college = "alberta"
How faced Geelong at home?
CREATE TABLE table_32312 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_32312 WHERE "Home team" = 'geelong'
what is the original air date for julie warner?
CREATE TABLE table_26561498_1 (original_air_date VARCHAR,patient_portrayer VARCHAR)
SELECT original_air_date FROM table_26561498_1 WHERE patient_portrayer = "Julie Warner"
Compare the number of users in Switzerland and Mauritius.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,U...
SELECT b.Label, COUNT(*) FROM Users AS u JOIN (SELECT '%schweiz%', 'Switzerland' UNION ALL SELECT '%mauritius%', 'Mauritius') AS b(Mask, Label) ON LOWER(u.Location) LIKE b.Mask GROUP BY b.Label
Who is the opponent in 1992?
CREATE TABLE table_name_17 (opponent VARCHAR,year VARCHAR)
SELECT opponent FROM table_name_17 WHERE year = "1992"
until 05/26/2100, what was the first value of arterial bp mean for patient 20165?
CREATE TABLE diagnoses_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_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE microbiologyevents (row_id number,subject_id number,...
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 = 20165)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ...