instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what are the four most frequently ordered microbiological tests until 2104 for patients that received kidney stone procedure - with removal of ureteral calculus previously within 2 months?
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 treatment (treatmentid number,patientunitstayid number,treatmentname text,...
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'kidney stone procedure - with removal of ure...
How many times a year is the Brighton Marathon held?
CREATE TABLE table_28347 ("Road race" text,"Distance" text,"Location" text,"Country" text,"Month held" text)
SELECT COUNT("Month held") FROM table_28347 WHERE "Distance" = 'Marathon' AND "Location" = 'Brighton'
Short ID questions to review.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT Score, LENGTH(Body) AS BodyLength, CreationDate, Id AS "post_link", p.Id, ViewCount, LastEditDate FROM Posts AS p WHERE Tags LIKE '%identify%' AND PostTypeId = 1 AND AcceptedAnswerId IS NULL AND ClosedDate IS NULL ORDER BY LENGTH(Body), CreationDate
has patient 14397 been admitted into the hospital this year?
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 prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text...
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 14397 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
Which Opponent in the final has a Score in the final of 6 2, 6 3, 2 6, 7 5?
CREATE TABLE table_49409 ("Outcome" text,"Date" real,"Championship" text,"Surface" text,"Opponent in the final" text,"Score in the final" text)
SELECT "Opponent in the final" FROM table_49409 WHERE "Score in the final" = '6–2, 6–3, 2–6, 7–5'
Find the number of matches in different competitions Visualize by bar chart, and rank in descending by the total number.
CREATE TABLE city (City_ID int,City text,Hanzi text,Hanyu_Pinyin text,Regional_Population int,GDP real)CREATE TABLE hosting_city (Year int,Match_ID int,Host_City text)CREATE TABLE match (Match_ID int,Date text,Venue text,Score text,Result text,Competition text)CREATE TABLE temperature (City_ID int,Jan real,Feb real,Mar...
SELECT Competition, COUNT(*) FROM match GROUP BY Competition ORDER BY COUNT(*) DESC
What are the different card types, and how many cards are there of each. Show a pie chart.
CREATE TABLE Customers (customer_id INTEGER,customer_first_name VARCHAR(20),customer_last_name VARCHAR(20),customer_address VARCHAR(255),customer_phone VARCHAR(255),customer_email VARCHAR(255),other_customer_details VARCHAR(255))CREATE TABLE Financial_Transactions (transaction_id INTEGER,previous_transaction_id INTEGER...
SELECT card_type_code, COUNT(*) FROM Customers_Cards GROUP BY card_type_code
what is the college/junior/club team (league) when the round is higher than 1, the nationality is canada and the position is (d)?
CREATE TABLE table_name_27 (college_junior_club_team__league_ VARCHAR,position VARCHAR,round VARCHAR,nationality VARCHAR)
SELECT college_junior_club_team__league_ FROM table_name_27 WHERE round > 1 AND nationality = "canada" AND position = "(d)"
What is the weight with a denomination that is ten paise?
CREATE TABLE table_39077 ("Denomination" text,"Metal" text,"Weight" text,"Shape" text,"Size" text)
SELECT "Weight" FROM table_39077 WHERE "Denomination" = 'ten paise'
how much do the reptilase time control actually cost?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id numb...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'reptilase time control'))
Name the air date for uk17
CREATE TABLE table_19897294_5 (original_air_date VARCHAR,no_overall VARCHAR)
SELECT original_air_date FROM table_19897294_5 WHERE no_overall = "UK17"
What is the maximum possible Copa Del Rey?
CREATE TABLE table_25571 ("R" real,"Player" text,"Position" text,"League" real,"Champions League" real,"Copa del Rey" real,"Total" real)
SELECT MAX("Copa del Rey") FROM table_25571
What is the name of the plaza where the toll for heavy vehicles with 2 axles is r87.00?
CREATE TABLE table_1211545_2 (name VARCHAR,heavy_vehicle__2_axles_ VARCHAR)
SELECT name FROM table_1211545_2 WHERE heavy_vehicle__2_axles_ = "R87.00"
Which country is dated October 20, 1976?
CREATE TABLE table_name_83 (country VARCHAR,date VARCHAR)
SELECT country FROM table_name_83 WHERE date = "october 20, 1976"
Which conflicts took place in Yemen?
CREATE TABLE table_22891 ("Start of conflict" real,"End of conflict" text,"Conflict" text,"Continent" text,"Location" text,"Branches involved" text)
SELECT "Conflict" FROM table_22891 WHERE "Location" = 'Yemen'
What kind of Sanskrit has a Tamil of r ki i ?
CREATE TABLE table_35106 ("Sanskrit \u0938\u0902\u0938\u094d\u0915\u0943\u0924\u092e\u094d" text,"Tamil \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text,"Telugu \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text,"Kannada \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text,"Malayalam \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" text,"Mongolian" text)
SELECT "Sanskrit \u0938\u0902\u0938\u094d\u0915\u0943\u0924\u092e\u094d" FROM table_35106 WHERE "Tamil \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" = 'rōkiṇi ரோகிணி'
What is Quantity Made, when Year Made is '4-4-0 oooo american'?
CREATE TABLE table_name_65 (quantity_made VARCHAR,year_made VARCHAR)
SELECT quantity_made FROM table_name_65 WHERE year_made = "4-4-0 — oooo — american"
Score of new york yankees 2, brooklyn dodgers 3 involves how many number of games?
CREATE TABLE table_name_13 (game VARCHAR,score VARCHAR)
SELECT COUNT(game) FROM table_name_13 WHERE score = "new york yankees – 2, brooklyn dodgers – 3"
Name the play for 1976
CREATE TABLE table_74521 ("Year" real,"Recipient" text,"Role" text,"Play" text,"Production" text)
SELECT "Play" FROM table_74521 WHERE "Year" = '1976'
What type of state is bo qin?
CREATE TABLE table_name_99 (type VARCHAR,name VARCHAR)
SELECT type FROM table_name_99 WHERE name = "bo qin"
Which season has rank 2?
CREATE TABLE table_name_35 (season VARCHAR,rank VARCHAR)
SELECT season FROM table_name_35 WHERE rank = "2"
In what stadium were the New England Patriots the visiting team?
CREATE TABLE table_name_13 (stadium VARCHAR,visiting_team VARCHAR)
SELECT stadium FROM table_name_13 WHERE visiting_team = "new england patriots"
where was the venue where the attendance was 702?
CREATE TABLE table_21359 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" text,"Competition" text,"Man of the Match" text)
SELECT "Venue" FROM table_21359 WHERE "Attendance" = '702'
What is the episode number that was first broadcast on 3 September 2010?
CREATE TABLE table_2906 ("Episode" text,"First broadcast" text,"Davids team" text,"Lees team" text,"Scores" text)
SELECT "Episode" FROM table_2906 WHERE "First broadcast" = '3 September 2010'
What is the score points when the total is 16?
CREATE TABLE table_60585 ("Shooter" text,"Event" text,"Rank points" text,"Score points" text,"Total" text)
SELECT "Score points" FROM table_60585 WHERE "Total" = '16'
Which Rank has a Country of costa rica, and a Losing Semi- finalist larger than 1?
CREATE TABLE table_41259 ("Rank" real,"Country" text,"Winner" real,"Runner -up" real,"Losing Semi- finalist" real)
SELECT AVG("Rank") FROM table_41259 WHERE "Country" = 'costa rica' AND "Losing Semi- finalist" > '1'
did patient 013-28507 receive any tests for crp in this year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientu...
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507')) AND lab.labname = 'crp' AND DATETIME(lab.labresulttime, 'start of year') = ...
Can you tell me the Barrel twist that has the Barrel lenght of 11.5 in.?
CREATE TABLE table_name_63 (barrel_twist VARCHAR,barrel_length VARCHAR)
SELECT barrel_twist FROM table_name_63 WHERE barrel_length = "11.5 in."
What was the 2009 results that has q1 for 2010, and A as the result for 2011?
CREATE TABLE table_name_71 (Id VARCHAR)
SELECT 2009 FROM table_name_71 WHERE 2010 = "q1" AND 2011 = "a"
what is the race on 23 october?
CREATE TABLE table_name_81 (race VARCHAR,date VARCHAR)
SELECT race FROM table_name_81 WHERE date = "23 october"
Find the average age for students with different sex in a bar chart, and list by the bar in ascending please.
CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Dorm (dormid INTEG...
SELECT Sex, AVG(Age) FROM Student GROUP BY Sex ORDER BY Sex
Which Result has an Award of virgin media tv awards?
CREATE TABLE table_61027 ("Year" real,"Award" text,"Category" text,"Role" text,"Result" text)
SELECT "Result" FROM table_61027 WHERE "Award" = 'virgin media tv awards'
Which Current Conference has a Nickname of lynx?
CREATE TABLE table_name_53 (current_conference VARCHAR,nickname VARCHAR)
SELECT current_conference FROM table_name_53 WHERE nickname = "lynx"
what was the first year that kid creole and the coconuts recorded with I Too Have Seen The Woods / Sire Records?
CREATE TABLE table_28232443_1 (year INTEGER,artist VARCHAR)
SELECT MIN(year) FROM table_28232443_1 WHERE artist = "Kid Creole and the Coconuts"
What is the description of the measure that got 78.27% yes votes?
CREATE TABLE table_256286_55 (description VARCHAR,_percentage_yes VARCHAR)
SELECT description FROM table_256286_55 WHERE _percentage_yes = "78.27%"
Count the number of urgent hospital admission patients who had a magnesium lab test done.
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.admission_type = "URGENT" AND lab.label = "Magnesium"
How many people attended the game that ended 4-6?
CREATE TABLE table_name_15 (attendance VARCHAR,score VARCHAR)
SELECT COUNT(attendance) FROM table_name_15 WHERE score = "4-6"
What Year was the United States the country for aug 3 5?
CREATE TABLE table_name_64 (year VARCHAR,country VARCHAR,dates VARCHAR)
SELECT year FROM table_name_64 WHERE country = "united states" AND dates = "aug 3–5"
Which engine of bmw had the lowest points and chassis of march 792 that is newer than 1979?
CREATE TABLE table_68399 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real)
SELECT MIN("Points") FROM table_68399 WHERE "Engine" = 'bmw' AND "Chassis" = 'march 792' AND "Year" > '1979'
What is the sum of gold medals for a rank of 14?
CREATE TABLE table_76046 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT SUM("Gold") FROM table_76046 WHERE "Rank" = '14'
What's the percentage of undecided according to the poll source with sampling error of 2.7%?
CREATE TABLE table_20032301_3 (undecided VARCHAR,sampling_error VARCHAR)
SELECT undecided FROM table_20032301_3 WHERE sampling_error = "2.7%"
For all employees who have the letters D or S in their first name, give me the comparison about the sum of manager_id over the hire_date bin hire_date by weekday by a bar chart, I want to sort by the Y-axis in asc.
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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE ...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(MANAGER_ID)
what is drug code of drug name doxazosin?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Doxazosin"
What is the mean vertical relief in feet when the rank is more than 40 and the location is va0573?
CREATE TABLE table_7246 ("Rank" real,"Park" text,"Location" text,"Peak Name" text,"Elevation (ft)" real,"Minimum Elevation (ft)" text,"Vertical Relief (ft)" real)
SELECT AVG("Vertical Relief (ft)") FROM table_7246 WHERE "Rank" > '40' AND "Location" = 'va0573'
pm flights DALLAS to ATLANTA
CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE ground_service (city_code text,airport_code t...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.departure_time <= 2359 AND flight.departure_time >= 1200) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight...
Highest rated unanimously upvoted posts.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT v.PostId AS postId, COUNT(v.Id) AS Upvotes FROM Votes AS v WHERE v.VoteTypeId = 2 GROUP BY v.PostId ORDER BY COUNT(v.Id)
Find the payment method that is used the most often in all the invoices. Give me its code.
CREATE TABLE stores (store_id text,address_id number,marketing_region_code text,store_name text,store_phone text,store_email_address text,other_details text)CREATE TABLE performers (performer_id number,address_id number,customer_name text,customer_phone text,customer_email_address text,other_details text)CREATE TABLE p...
SELECT payment_method_code FROM invoices GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1
how much is a flight from WASHINGTON to BOSTON
CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREA...
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 = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
Which Electrics has an Engine of 175cc, bhp (kw), and a Model Name of d10 sports & bushman?
CREATE TABLE table_name_28 (electrics VARCHAR,engine VARCHAR,model_name VARCHAR)
SELECT electrics FROM table_name_28 WHERE engine = "175cc, bhp (kw)" AND model_name = "d10 sports & bushman"
Which Season has a 19th Final Place?
CREATE TABLE table_14919 ("Season" text,"Series" text,"Races" text,"Wins" text,"Podiums" text,"Points" text,"Final Placing" text)
SELECT "Season" FROM table_14919 WHERE "Final Placing" = '19th'
Show the number of documents in different starting date and bin starting date by weekday interval with a bar chart, and rank y axis in desc order please.
CREATE TABLE Roles (Role_Code CHAR(15),Role_Name VARCHAR(255),Role_Description VARCHAR(255))CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Documents_to_be_Destroyed (Document_ID INTEGER,Destruction_Authorised_by_Employee_I...
SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations ORDER BY COUNT(Date_in_Location_From) DESC
What was the Name v t e, of the player whose Weight (kg) was 84, whose Position was D, and whose Jersey number was 2?
CREATE TABLE table_40957 ("Position" text,"Jersey number" real,"Name v t e" text,"Height (cm)" real,"Weight (kg)" real,"Birthplace" text,"1995-96 team" text)
SELECT "Name v t e" FROM table_40957 WHERE "Weight (kg)" = '84' AND "Position" = 'd' AND "Jersey number" = '2'
tell me the top four most common diagnoses for the patients in the 30s until 1 year ago?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,he...
SELECT 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 30 AND 39) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 yea...
What is the highest crowd with north melbourne as away team?
CREATE TABLE table_51917 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MAX("Crowd") FROM table_51917 WHERE "Away team" = 'north melbourne'
display job ID for those jobs that were done by two or more for more than 300 days.
CREATE TABLE departments (department_id number,department_name text,manager_id number,location_id number)CREATE TABLE jobs (job_id text,job_title text,min_salary number,max_salary number)CREATE TABLE employees (employee_id number,first_name text,last_name text,email text,phone_number text,hire_date time,job_id text,sal...
SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2
What was the session at the circuit of lowes motor speedway?
CREATE TABLE table_8622 ("Discipline" text,"Championship" text,"Circuit" text,"Session" text,"Cause" text)
SELECT "Session" FROM table_8622 WHERE "Circuit" = 'lowes motor speedway'
what venue is previous to gin sio chico neto , maring ?
CREATE TABLE table_204_130 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT "venue" FROM table_204_130 WHERE "date" < (SELECT "date" FROM table_204_130 WHERE "venue" = 'ginasio chico neto, maringa') ORDER BY "date" DESC LIMIT 1
What's the Score with a Home of Scotland and Date of 24 February?
CREATE TABLE table_37687 ("Year" real,"Home" text,"Score" text,"Away" text,"Date" text,"Venue" text)
SELECT "Score" FROM table_37687 WHERE "Home" = 'scotland' AND "Date" = '24 february'
What's the series number of the episode seen by 2.43 million viewers in the UK?
CREATE TABLE table_22901 ("Series No." real,"Season No." real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.K. viewers (million)" text)
SELECT "Series No." FROM table_22901 WHERE "U.K. viewers (million)" = '2.43'
Name the height for number 7
CREATE TABLE table_26228 ("No" real,"Player" text,"Height (m)" text,"Height (f)" text,"Position" text,"Year born" real,"Current Club" text)
SELECT "Height (m)" FROM table_26228 WHERE "No" = '7'
What was the vote % of Heather and Matt?
CREATE TABLE table_26375386_18 (vote_percentage VARCHAR,couple VARCHAR)
SELECT vote_percentage FROM table_26375386_18 WHERE couple = "Heather and Matt"
Users by Popular Question ratio. (only users with at least 10 Popular Questions)
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS SeptemberRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = Pos...
give me the number of patients with other specified cardiac dysrhythmias diagnoses who have delta abnormal lab test status.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Other specified cardiac dysrhythmias" AND lab.flag = "delta"
what is the number of patients whose primary disease is mesenteric ischemia and age is less than 86?
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 WHERE demographic.diagnosis = "MESENTERIC ISCHEMIA" AND demographic.age < "86"
Name the marginal ordinary income tax rate that has a head of household of $372,951+
CREATE TABLE table_name_40 (marginal_ordinary_income_tax_rate VARCHAR,head_of_household VARCHAR)
SELECT marginal_ordinary_income_tax_rate FROM table_name_40 WHERE head_of_household = "$372,951+"
What year is the location Ta'izz?
CREATE TABLE table_12650 ("Perpetrator" text,"Year" text,"Location" text,"Country" text,"Killed" text)
SELECT "Year" FROM table_12650 WHERE "Location" = 'ta''izz'
What is Nick Price's score?
CREATE TABLE table_14870 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Score" FROM table_14870 WHERE "Player" = 'nick price'
what is the procedure icd9 code of Jerry Deberry?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jerry Deberry"
How many hectars of land is in Kaxholmen?
CREATE TABLE table_1532 ("Urban area (locality)" text,"Municipality" text,"Population" real,"Land area (hectares)" text,"Density (inh./km\u00b2)" text,"Code" real)
SELECT "Land area (hectares)" FROM table_1532 WHERE "Urban area (locality)" = 'Kaxholmen'
how many singles were released before 2001 but after 1997 ?
CREATE TABLE table_203_696 (id number,"year" number,"single" text,"charts\nfr" number,"charts\nbel\nwa" number,"charts\nswi" number,"certification" number,"album" text)
SELECT COUNT("single") FROM table_203_696 WHERE "year" < 2001 AND "year" > 1997
What is the average crowd size for games with hawthorn as the home side?
CREATE TABLE table_33524 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT AVG("Crowd") FROM table_33524 WHERE "Home team" = 'hawthorn'
Who was the subject of the sculpture created in 1982?
CREATE TABLE table_20903658_1 (title_subject VARCHAR,date_painted_created VARCHAR)
SELECT title_subject FROM table_20903658_1 WHERE date_painted_created = "1982"
What is the average value in the 100s category when the high score is 196?
CREATE TABLE table_name_86 (highest_score VARCHAR)
SELECT AVG(100 AS s) FROM table_name_86 WHERE highest_score = "196"
what is average age of patients whose marital status is married and primary disease is brain mass;intracranial hemorrhage?
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.marital_status = "MARRIED" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE"
Give me the number of living patients who have atrial septal defect mitral valve replacement repair atrial-septal defect/sda as their primary 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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "ATRIAL SEPTAL DEFECT\MITRAL VALVE REPLACEMENT;REPAIR ATRIAL-SEPTAL DEFECT/SDA"
Just show the employee's last name and their employee id using a bar chart, sort from low to high by the Y-axis.
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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_...
SELECT LAST_NAME, EMPLOYEE_ID FROM employees ORDER BY EMPLOYEE_ID
Score distribution (all questions, no filters).
CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Ta...
SELECT COUNT(Id) AS CountOfScore, Score FROM Posts AS p WHERE p.PostTypeId = 1 AND Score BETWEEN -20 AND 20 GROUP BY Score ORDER BY Score
What is the name of the couple if the total points earned is 161?
CREATE TABLE table_23662272_4 (couple VARCHAR,total_points_earned VARCHAR)
SELECT couple FROM table_23662272_4 WHERE total_points_earned = 161
What was the result of the game seen by 31095 people?
CREATE TABLE table_72987 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Raiders points" real,"Opponents" real,"Raiders first downs" real,"Record" text,"Attendance" real)
SELECT "Result" FROM table_72987 WHERE "Attendance" = '31095'
What is the highest Match No., when Date is 2008-03-21, and when Time is 16:00?
CREATE TABLE table_47463 ("Match No." real,"Date" text,"Time" text,"Score" text,"Venue" text,"Match Report" text)
SELECT MAX("Match No.") FROM table_47463 WHERE "Date" = '2008-03-21' AND "Time" = '16:00'
had patient 22648 had any gastric emesis output since 12/2105?
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 icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid nu...
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22648)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'gastric emesis...
What's the average round number for East Carolina?
CREATE TABLE table_11071 ("Pick" real,"Round" real,"Player" text,"Position" text,"School" text)
SELECT AVG("Round") FROM table_11071 WHERE "School" = 'east carolina'
what are the number of times jive records is listed as the label ?
CREATE TABLE table_203_545 (id number,"single/ep" text,"release date" text,"label" text,"format(s)" text,"uk singles chart position" number,"notes" text)
SELECT COUNT(*) FROM table_203_545 WHERE "label" = 'jive records'
known renal insufficiency ( either known creatinin clearance < 30 ml / min / 1.73 m2 or current medical care for severe renal insufficiency )
CREATE TABLE table_test_2 ("id" int,"loss_of_consciousness" bool,"gender" string,"bleeding" int,"systolic_blood_pressure_sbp" int,"stroke" bool,"renal_disease" bool,"hemorrhagic_diathesis" bool,"transient_ischemic_attack" bool,"creatinine_clearance_cl" float,"dementia" bool,"glasgow_come_score_gcs" int,"prior_creatinin...
SELECT * FROM table_test_2 WHERE renal_disease = 1 OR (creatinine_clearance_cl < 30 OR renal_disease = 1)
What was the Week on December 17?
CREATE TABLE table_name_12 (week INTEGER,date VARCHAR)
SELECT MIN(week) FROM table_name_12 WHERE date = "december 17"
display the department name and number of employees in each of the department.
CREATE TABLE locations (location_id number,street_address text,postal_code text,city text,state_province text,country_id text)CREATE TABLE regions (region_id number,region_name text)CREATE TABLE jobs (job_id text,job_title text,min_salary number,max_salary number)CREATE TABLE job_history (employee_id number,start_date ...
SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name
What are the series in which ' Scott Foley ' is an actor ?
CREATE TABLE made_by (id int,msid int,pid int)CREATE TABLE keyword (id int,keyword text)CREATE TABLE directed_by (id int,msid int,did int)CREATE TABLE written_by (id int,msid int,wid int)CREATE TABLE writer (wid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE director (did int,gen...
SELECT tv_series.title FROM actor, cast, tv_series WHERE actor.name = 'Scott Foley' AND cast.aid = actor.aid AND tv_series.sid = cast.msid
What is the highest taijijian with a 9.87 taijiquan and a total less than 19.77?
CREATE TABLE table_61890 ("Rank" real,"Athlete" text,"Taijijian" real,"Taijiquan" real,"Total" real)
SELECT MAX("Taijijian") FROM table_61890 WHERE "Taijiquan" = '9.87' AND "Total" < '19.77'
count the number of times that patient 20713 had had a tooth extraction nec procedure.
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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE transfers (row_id nu...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'tooth extraction nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20713)
Show the faculty id of each faculty member, along with the number of students he or she advises. Show scatter chart.
CREATE TABLE Activity (actid INTEGER,activity_name varchar(25))CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR...
SELECT FacID, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.FacID
What is the result when 13 is the week?
CREATE TABLE table_name_64 (result VARCHAR,week VARCHAR)
SELECT result FROM table_name_64 WHERE week = 13
For those records from the products and each product's manufacturer, find name and the average of manufacturer , and group by attribute name, and visualize them by a bar chart, sort mean manufacturer in ascending order.
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.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Manufacturer
Name the total number of scores for 7x10
CREATE TABLE table_25938 ("Episode" text,"First broadcast" text,"Seans team" text,"Jasons team" text,"Scores" text)
SELECT COUNT("Scores") FROM table_25938 WHERE "Episode" = '7x10'
What is the work number for Victor?
CREATE TABLE table_78346 ("Name" text,"Builder" text,"Wheel arrangement" text,"Works Number" real,"Built" real)
SELECT "Works Number" FROM table_78346 WHERE "Name" = 'victor'
how many times patient 006-122567 has come to the intensive care unit in 2101?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime 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,lab...
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-122567') AND STRFTIME('%y', patient.unitadmittime) = '2101'
What Away team had an Attendance of 3,395?
CREATE TABLE table_70147 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" text)
SELECT "Away team" FROM table_70147 WHERE "Attendance" = '3,395'
What years did the player from LaSalle play for the Rockets?
CREATE TABLE table_72219 ("Player" text,"No.(s)" text,"Height in Ft." text,"Position" text,"Years for Rockets" text,"School/Club Team/Country" text)
SELECT "Years for Rockets" FROM table_72219 WHERE "School/Club Team/Country" = 'LaSalle'
What is the birthplace and date of pick 4?
CREATE TABLE table_name_47 (birthplace VARCHAR,_date VARCHAR,pick VARCHAR)
SELECT birthplace, _date FROM table_name_47 WHERE pick = 4
Show the names and ids of tourist attractions that are visited at most once by a bar chart, list by the Y-axis in asc please.
CREATE TABLE Museums (Museum_ID INTEGER,Museum_Details VARCHAR(255))CREATE TABLE Shops (Shop_ID INTEGER,Shop_Details VARCHAR(255))CREATE TABLE Staff (Staff_ID INTEGER,Tourist_Attraction_ID INTEGER,Name VARCHAR(40),Other_Details VARCHAR(255))CREATE TABLE Visits (Visit_ID INTEGER,Tourist_Attraction_ID INTEGER,Tourist_ID ...
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Tourist_Attraction_ID
Who was the mediator in k haku number 53?
CREATE TABLE table_1315616_1 (mediator VARCHAR,kōhaku__number VARCHAR)
SELECT mediator FROM table_1315616_1 WHERE kōhaku__number = 53