answer
stringlengths
6
3.91k
question
stringlengths
7
766
context
stringlengths
27
7.14k
SELECT SUM("Weight") FROM table_68997 WHERE "Player" = 'deshawn stevenson'
What does DeShawn Stevenson weigh?
CREATE TABLE table_68997 ( "Pos." text, "Player" text, "Team" text, "Height" text, "Weight" real )
SELECT placings FROM table_name_72 WHERE total > 131.26 AND name = "jacqueline du bief"
How many placings did Jacqueline du Bief earn where her total score is greater than 131.26?
CREATE TABLE table_name_72 (placings VARCHAR, total VARCHAR, name VARCHAR)
SELECT high_assists FROM table_22871316_11 WHERE series = "0-1"
Who has the high assists when 0-1 is the series?
CREATE TABLE table_22871316_11 (high_assists VARCHAR, series VARCHAR)
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 Service_Type_Description DESC
What are the descriptions of the service types with product price above 100, and count them by a bar chart, and I want to order in desc by the names.
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 Ref_Service_Types ( Service_Type_Code CHAR(15), Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255) ) CREATE TABLE Order_Items ( Order_Item_ID INTEGER, Order_ID INTEGER, Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255) ) CREATE TABLE Bookings_Services ( Order_ID INTEGER, Product_ID INTEGER ) CREATE TABLE Performers ( Performer_ID INTEGER, Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Products ( Product_ID VARCHAR(100), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255) ) CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255) ) CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15), Marketing_Region_Name VARCHAR(255), Marketing_Region_Descriptrion VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Customer_Orders ( Order_ID INTEGER, Customer_ID INTEGER, Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) ) CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER, Address_ID INTEGER, Currency_Code CHAR(15), Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Stores ( Store_ID VARCHAR(100), Address_ID INTEGER, Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) ) CREATE TABLE Invoices ( Invoice_ID INTEGER, Order_ID INTEGER, payment_method_code CHAR(15), Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER ) CREATE TABLE Clients ( Client_ID INTEGER, Address_ID INTEGER, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER, Performer_ID INTEGER ) CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER, Invoice_ID INTEGER, Order_ID INTEGER, Order_Item_ID INTEGER, Product_ID INTEGER, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255) ) CREATE TABLE Addresses ( Address_ID VARCHAR(100), Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Customers ( Customer_ID VARCHAR(100), Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
SELECT placings FROM table_name_34 WHERE free < 524.3 AND total < 1170.1 AND name = "per cock-clausen"
Can you tell me the Placings that hasthe Free smaller than 524.3, and the Total smaller than 1170.1, and the Name of per cock-clausen?
CREATE TABLE table_name_34 (placings VARCHAR, name VARCHAR, free VARCHAR, total VARCHAR)
SELECT COUNT(high_rebounds) FROM table_22871316_11 WHERE series = "3-3"
How many high rebounds are in series 3-3?
CREATE TABLE table_22871316_11 (high_rebounds VARCHAR, series VARCHAR)
SELECT "Lost" FROM table_42933 WHERE "Position" > '2' AND "Drawn" > '0' AND "Against" > '15'
What lost has a position greater than 2, a drawn greater than 0, with an against greater than 15?
CREATE TABLE table_42933 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
SELECT AVG(figures) FROM table_name_63 WHERE placings = 34 AND total > 1247.51
Can you tell me the average Figures that has the Placings of 34, and the Total larger than 1247.51?
CREATE TABLE table_name_63 (figures INTEGER, placings VARCHAR, total VARCHAR)
SELECT MIN(game) FROM table_22871316_11 WHERE date = "April 30"
How many games are on the date of April 30?
CREATE TABLE table_22871316_11 (game INTEGER, date VARCHAR)
SELECT weight FROM table_name_43 WHERE name = "tatyana gubina"
What is Tatyana Gubina's Weight?
CREATE TABLE table_name_43 ( weight VARCHAR, name VARCHAR )
SELECT result FROM table_name_99 WHERE opponent = "columbus destroyers"
What is the result where the opponent is Columbus Destroyers?
CREATE TABLE table_name_99 (result VARCHAR, opponent VARCHAR)
SELECT high_points FROM table_22871316_6 WHERE date = "December 18"
Who did the high points in the game played on December 18?
CREATE TABLE table_22871316_6 (high_points VARCHAR, date VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.long_title = "Personal history of surgery to other organs"
how many patients whose admission type is elective and diagnoses long title is personal history of surgery to other organs?
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 text, admittime text, dischtime text, admityear 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 text ) 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 )
SELECT date FROM table_name_2 WHERE home_away_game = "away" AND week = 8
What is the date of the away game in week 8?
CREATE TABLE table_name_2 (date VARCHAR, home_away_game VARCHAR, week VARCHAR)
SELECT high_points FROM table_22871316_6 WHERE date = "December 2"
Who did the high points in the game played on December 2?
CREATE TABLE table_22871316_6 (high_points VARCHAR, date VARCHAR)
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, 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 = 'physical restraints' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.diagnosistime AND DATETIME(t2.diagnosistime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month') GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 3
for patients who received physical restraints in this year, what are the top three most frequent diagnoses that followed afterwards within 2 months?
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) 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, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) 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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
SELECT grand_prix FROM table_name_24 WHERE fastest_lap = "gerhard berger" AND pole_position = "jacques villeneuve"
Which grand prix had gerhard berger in his fastest lap and a jacques villeneuve pole position?
CREATE TABLE table_name_24 (grand_prix VARCHAR, fastest_lap VARCHAR, pole_position VARCHAR)
SELECT record FROM table_22871316_6 WHERE high_points = "Carlos Delfino (17)"
What's the record of the game in which Carlos Delfino (17) did the most high points?
CREATE TABLE table_22871316_6 (record VARCHAR, high_points VARCHAR)
SELECT range FROM mountain GROUP BY range ORDER BY COUNT(*) DESC LIMIT 1
Show the range that has the most number of mountains.
CREATE TABLE climber ( climber_id number, name text, country text, time text, points number, mountain_id number ) CREATE TABLE mountain ( mountain_id number, name text, height number, prominence number, range text, country text )
SELECT 2003 AS _result FROM table_name_97 WHERE council = "falkirk"
What's the 2003 result for the falkirk council?
CREATE TABLE table_name_97 (council VARCHAR)
SELECT high_rebounds FROM table_22871316_6 WHERE high_assists = "Brandon Jennings (8)"
Who did the high rebounds in the game in which Brandon Jennings (8) did the high assists?
CREATE TABLE table_22871316_6 (high_rebounds VARCHAR, high_assists VARCHAR)
SELECT COUNT(ties) FROM table_name_27 WHERE name = "totals" AND lost > 30
Tell me the total number of ties for name of totals and lost more than 30
CREATE TABLE table_name_27 ( ties VARCHAR, name VARCHAR, lost VARCHAR )
SELECT date_of_vacancy FROM table_name_70 WHERE manner_of_departure = "fired" AND replaced_by = "albert cartier"
On which date was the manager fired and replaced by Albert Cartier?
CREATE TABLE table_name_70 (date_of_vacancy VARCHAR, manner_of_departure VARCHAR, replaced_by VARCHAR)
SELECT player FROM table_22875514_3 WHERE field_goals = "18-50 .360"
Which player has 18-50 .360 field goals?
CREATE TABLE table_22875514_3 (player VARCHAR, field_goals VARCHAR)
SELECT COUNT("Opponent") FROM table_24000 WHERE "Result" = 'Loss'
Name the number opponent for loss result
CREATE TABLE table_24000 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Cardinals points" real, "Opponents" real, "Record" text )
SELECT manner_of_departure FROM table_name_70 WHERE team = "anderlecht"
What was the manner of departure for the team Anderlecht?
CREATE TABLE table_name_70 (manner_of_departure VARCHAR, team VARCHAR)
SELECT MAX(assists) FROM table_22875514_3 WHERE points = "129-3.9"
What is the most assists for points 129-3.9?
CREATE TABLE table_22875514_3 (assists INTEGER, points VARCHAR)
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 = 'rigid proctosigmoidoscpy') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year'))
count the number of patients who had been given a rigid proctosigmoidoscpy procedure this year.
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 d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) 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 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 d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
SELECT manner_of_departure FROM table_name_52 WHERE date_of_appointment = "27 december 2007"
What was the manner of depature when the date of appointment was 27 December 2007?
CREATE TABLE table_name_52 (manner_of_departure VARCHAR, date_of_appointment VARCHAR)
SELECT date FROM table_22875369_3 WHERE irish_points = 89
Name the date for irish points being 89
CREATE TABLE table_22875369_3 (date VARCHAR, irish_points VARCHAR)
SELECT "Score" FROM table_37199 WHERE "Date" = 'march 1'
What was the Score on March 1?
CREATE TABLE table_37199 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
SELECT replaced_by FROM table_name_46 WHERE team = "brussels" AND date_of_vacancy = "22 december 2007"
Who was the replacement for the Brussels team with a date of vacancy of 22 December 2007?
CREATE TABLE table_name_46 (replaced_by VARCHAR, team VARCHAR, date_of_vacancy VARCHAR)
SELECT COUNT(location) FROM table_22875369_3 WHERE record = "22-1"
Name the number of location for 22-1
CREATE TABLE table_22875369_3 (location VARCHAR, record VARCHAR)
SELECT time_retired FROM table_name_51 WHERE laps = 80 AND grid > 2
What's the Time/Retired of 80 laps with a Grid larger than 2?
CREATE TABLE table_name_51 ( time_retired VARCHAR, laps VARCHAR, grid VARCHAR )
SELECT date_of_vacancy FROM table_name_9 WHERE manner_of_departure = "fired" AND replaced_by = "albert cartier"
What was the date of vacancy where the replacement was Albert Cartier and the manager was fired?
CREATE TABLE table_name_9 (date_of_vacancy VARCHAR, manner_of_departure VARCHAR, replaced_by VARCHAR)
SELECT opponent FROM table_22875369_3 WHERE date = "2-27-10"
Name the opponent for 2-27-10
CREATE TABLE table_22875369_3 (opponent VARCHAR, date VARCHAR)
SELECT "Total fat" FROM table_53753 WHERE "Polyunsaturated fat" = '11g' AND "Monounsaturated fat" = '45g'
Name the total fat which has a polyunsaturated fat of 11g and monounsaturated fat of 45g
CREATE TABLE table_53753 ( "Total fat" text, "Saturated fat" text, "Monounsaturated fat" text, "Polyunsaturated fat" text, "Smoke point" text )
SELECT tallangatta_dfl FROM table_name_49 WHERE against > 1013 AND losses > 2
What is the Tallangatta DFL losses greater than 2 and an against greater than 1013
CREATE TABLE table_name_49 (tallangatta_dfl VARCHAR, against VARCHAR, losses VARCHAR)
SELECT MAX(irish_points) FROM table_22875369_3 WHERE opponent = "Eastern Michigan"
Name the max irish points for eastern michigan
CREATE TABLE table_22875369_3 (irish_points INTEGER, opponent VARCHAR)
SELECT opponent FROM table_23308178_8 WHERE date = "February 5"
How many games did they play on february 5?
CREATE TABLE table_23308178_8 ( opponent VARCHAR, date VARCHAR )
SELECT AVG(byes) FROM table_name_5 WHERE against > 1479 AND wins > 5 AND draws < 0
What are the average byes that are greater than 1479, wins greater than 5 and 0 draws?
CREATE TABLE table_name_5 (byes INTEGER, draws VARCHAR, against VARCHAR, wins VARCHAR)
SELECT irish_points FROM table_22875369_3 WHERE record = "23-1"
Name the irish points for 23-1 record
CREATE TABLE table_22875369_3 (irish_points VARCHAR, record VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2168" AND diagnoses.short_title = "Rheumatic heart failure"
Among patients diagnosed with rheumatic heart failure, calculate the total number of those born before the year 2168.
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 text, admittime text, dischtime text, admityear text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, 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 )
SELECT AVG(year) FROM table_name_84 WHERE rank > 3 AND floors = 28
Tell me the average year for rank more than 3 and 28 floors
CREATE TABLE table_name_84 (year INTEGER, rank VARCHAR, floors VARCHAR)
SELECT COUNT(high_rebounds) FROM table_22879262_14 WHERE score = "L 92–96 (OT)"
Name the number of high rebounds for l 92–96 (ot)
CREATE TABLE table_22879262_14 (high_rebounds VARCHAR, score VARCHAR)
SELECT COUNT("Launches to date") FROM table_12581 WHERE "Version" = '541' AND "CCBs" < '1'
What is the total Launches to date with a Version of 541, and CCBs smaller than 1?
CREATE TABLE table_12581 ( "Version" text, "Fairing" text, "CCBs" real, "SRBs" text, "Upper stage" text, "Payload to LEO" text, "Payload to GTO" text, "Launches to date" real )
SELECT name FROM table_name_75 WHERE rank < 6 AND year > 1974
I want the name for rank less than 6 and year more than 1974
CREATE TABLE table_name_75 (name VARCHAR, rank VARCHAR, year VARCHAR)
SELECT date FROM table_22879262_7 WHERE game = 29
what ist he date of game 29?
CREATE TABLE table_22879262_7 (date VARCHAR, game VARCHAR)
SELECT venue FROM table_name_95 WHERE date = "14 february 2009"
In what venue was the event held on 14 February 2009?
CREATE TABLE table_name_95 ( venue VARCHAR, date VARCHAR )
SELECT AVG(rank) FROM table_name_80 WHERE total > 4 AND nation = "great britain"
What is the average rank of Great Britain when their total is over 4?
CREATE TABLE table_name_80 (rank INTEGER, total VARCHAR, nation VARCHAR)
SELECT location_attendance FROM table_22879262_7 WHERE game = 27
what is the location attendance for game 27?
CREATE TABLE table_22879262_7 (location_attendance VARCHAR, game VARCHAR)
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'encephalopathy - metabolic' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
what are the five most commonly prescribed medication for patients who have been diagnosed with encephalopathy - metabolic previously during the same month, in the last year?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) 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 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 number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) 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, labresulttime 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 text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
SELECT COUNT(silver) FROM table_name_63 WHERE nation = "france" AND rank > 14
What is the total number of Silvers held by France when their rank was over 14?
CREATE TABLE table_name_63 (silver VARCHAR, nation VARCHAR, rank VARCHAR)
SELECT COUNT(high_rebounds) FROM table_22879262_7 WHERE team = "Minnesota"
what is the total number of high rebounds for minnesota?
CREATE TABLE table_22879262_7 (high_rebounds VARCHAR, team VARCHAR)
SELECT "Height (ft)" FROM table_23814 WHERE "Country" = 'Aruba'
How tall is the contestant from Aruba?
CREATE TABLE table_23814 ( "Country" text, "Contestant" text, "Age" real, "Height (cm)" real, "Height (ft)" text, "Hometown" text )
SELECT home_team FROM table_name_76 WHERE venue = "princes park"
Who was the home team at the game held at Princes Park?
CREATE TABLE table_name_76 (home_team VARCHAR, venue VARCHAR)
SELECT high_rebounds FROM table_22879323_10 WHERE date = "April 4"
What were the high rebounds on April 4?
CREATE TABLE table_22879323_10 (high_rebounds VARCHAR, date VARCHAR)
SELECT "Notes" FROM table_63154 WHERE "Rank" > '2' AND "Time" = '7:00:46'
What are the notes for the rower in ranks over 2 and having a time of 7:00:46?
CREATE TABLE table_63154 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text )
SELECT home_team FROM table_name_39 WHERE away_team = "hawthorn"
Who was the home team when Hawthorn was the away team?
CREATE TABLE table_name_39 (home_team VARCHAR, away_team VARCHAR)
SELECT score FROM table_22879323_10 WHERE game = 80
What was the score when the game was 80?
CREATE TABLE table_22879323_10 (score VARCHAR, game VARCHAR)
SELECT "Home team" FROM table_54272 WHERE "Venue" = 'western oval'
What's the home team for the western oval venue?
CREATE TABLE table_54272 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT record FROM table_name_21 WHERE loss = "hernandez (3–5)"
What was the Rockies record at their game that had a loss of Hernandez (3–5)?
CREATE TABLE table_name_21 (record VARCHAR, loss VARCHAR)
SELECT date FROM table_22879323_10 WHERE record = "11-67"
What date was the record 11-67?
CREATE TABLE table_22879323_10 (date VARCHAR, record VARCHAR)
SELECT "Weight" FROM table_15744 WHERE "Series" = 'iii series' AND "Reverse" = 'modern pentathlon'
How much did the Modern Pentathlon III Series coin weigh?
CREATE TABLE table_15744 ( "Year" real, "Denomination" text, "Alloy" text, "Reverse" text, "Diameter" text, "Weight" text, "Obverse" text, "Mintage" real, "Series" text )
SELECT engine FROM table_name_30 WHERE tyres = "g" AND driver = "elio de angelis"
What engine has g tyres and is driven by elio de angelis?
CREATE TABLE table_name_30 (engine VARCHAR, tyres VARCHAR, driver VARCHAR)
SELECT COUNT(high_rebounds) FROM table_22879323_10 WHERE date = "April 7"
How many high rebounds were there on April 7?
CREATE TABLE table_22879323_10 (high_rebounds VARCHAR, date VARCHAR)
SELECT MAX(points) FROM table_name_86 WHERE opponent = "@ pittsburgh penguins"
Which Points have an Opponent of @ pittsburgh penguins?
CREATE TABLE table_name_86 ( points INTEGER, opponent VARCHAR )
SELECT rounds FROM table_name_8 WHERE driver = "elio de angelis"
What rounds does elio de angelis drive?
CREATE TABLE table_name_8 (rounds VARCHAR, driver VARCHAR)
SELECT high_points FROM table_22879323_10 WHERE high_rebounds = "Terrence Williams (8)"
What was the high points when rebounds were Terrence Williams (8)?
CREATE TABLE table_22879323_10 (high_points VARCHAR, high_rebounds VARCHAR)
SELECT Name, COUNT(Name) FROM Products GROUP BY Name ORDER BY COUNT(Name) DESC
What is the number of names for each product in the store?, and order Y in desc 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 constructor FROM table_name_93 WHERE chassis = "fw06 fw07" AND driver = "alan jones"
Who is the constructor for driver alan jones using a chassis of fw06 fw07?
CREATE TABLE table_name_93 (constructor VARCHAR, chassis VARCHAR, driver VARCHAR)
SELECT high_assists FROM table_22879323_6 WHERE record = "2-29"
When the record was 2-29 who had the most assists?
CREATE TABLE table_22879323_6 (high_assists VARCHAR, record VARCHAR)
SELECT "Game 2" FROM table_5208 WHERE "Exhibition*" = 'michael o''connor'
Which Game 2 has an Exhibition of michael o'connor?
CREATE TABLE table_5208 ( "Position" text, "Game 1" text, "Game 2" text, "Game 3" text, "Exhibition*" text )
SELECT engine FROM table_name_94 WHERE driver = "james hunt"
What engine does driver james hunt have?
CREATE TABLE table_name_94 (engine VARCHAR, driver VARCHAR)
SELECT high_points FROM table_22879323_6 WHERE team = "Houston"
When we played Houston who had the most points?
CREATE TABLE table_22879323_6 (high_points VARCHAR, team VARCHAR)
SELECT AVG("Top-25") FROM table_41939 WHERE "Top-10" = '8' AND "Events" = '45'
What is the Top-25 with a Top-10 of 8, and an Events of 45?
CREATE TABLE table_41939 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
SELECT engine FROM table_name_1 WHERE rounds = "5-6"
What's the engine used for rounds 5-6?
CREATE TABLE table_name_1 (engine VARCHAR, rounds VARCHAR)
SELECT COUNT(high_points) FROM table_22879323_9 WHERE location_attendance = "Ford Center"
Name the number of high points for ford center
CREATE TABLE table_22879323_9 (high_points VARCHAR, location_attendance VARCHAR)
SELECT pennant FROM table_name_8 WHERE builder = "denny, dumbarton"
What is the pennant with Denny, Dumbarton as the builder?
CREATE TABLE table_name_8 ( pennant VARCHAR, builder VARCHAR )
SELECT home_team AS score FROM table_name_41 WHERE venue = "princes park"
Who was the home team at Princes Park?
CREATE TABLE table_name_41 (home_team VARCHAR, venue VARCHAR)
SELECT high_rebounds FROM table_22879323_9 WHERE location_attendance = "American Airlines Center"
Name the high rebounds for american airlines center
CREATE TABLE table_22879323_9 (high_rebounds VARCHAR, location_attendance VARCHAR)
SELECT character FROM table_2160215_1 WHERE original_japanese = "Makio Inoue"
Makio Inoue dubbed on which character?
CREATE TABLE table_2160215_1 ( character VARCHAR, original_japanese VARCHAR )
SELECT city___state FROM table_name_33 WHERE team = "holden racing team" AND winner = "mark skaife todd kelly"
Tell me the city/state for the holden racing team with winner of mark skaife todd kelly
CREATE TABLE table_name_33 (city___state VARCHAR, team VARCHAR, winner VARCHAR)
SELECT record FROM table_22879323_9 WHERE score = "L 90–100 (OT)"
Name the record for l 90–100 (ot)
CREATE TABLE table_22879323_9 (record VARCHAR, score VARCHAR)
SELECT "C_{low}" FROM table_73107 WHERE "C_{high}" = '12.0'
What's the C_{low} value when C_{high} is 12.0?
CREATE TABLE table_73107 ( "C_{low}" text, "C_{high}" text, "I_{low}" real, "I_{high}" real, "Category" text )
SELECT engine_configuration FROM table_name_80 WHERE engine_name = "1.2 mpi"
What is the engine configuration of the 1.2 mpi engine?
CREATE TABLE table_name_80 (engine_configuration VARCHAR, engine_name VARCHAR)
SELECT location_attendance FROM table_22879323_9 WHERE score = "L 83–106 (OT)"
Name the location attendance for l 83–106 (ot)
CREATE TABLE table_22879323_9 (location_attendance VARCHAR, score VARCHAR)
SELECT attendance FROM table_name_9 WHERE opponent = "houston oilers"
What was the attendance for the game against the Houston Oilers?
CREATE TABLE table_name_9 ( attendance VARCHAR, opponent VARCHAR )
SELECT max_torque_at_rpm FROM table_name_11 WHERE engine_name = "1.2 mpi"
What is the max torque of the 1.2 mpi engine?
CREATE TABLE table_name_11 (max_torque_at_rpm VARCHAR, engine_name VARCHAR)
SELECT score FROM table_22883210_10 WHERE record = "49-31"
Name the score for 49-31
CREATE TABLE table_22883210_10 (score VARCHAR, record VARCHAR)
SELECT "E. coli" FROM table_49141 WHERE "Human" = 'hneil1'
Which E. coli has a human value of HNEIL1?
CREATE TABLE table_49141 ( "E. coli" text, "Yeast (S. cerevisiae)" text, "Human" text, "Type" text, "Substrates" text )
SELECT long FROM table_name_93 WHERE player = "charles frederick"
Tell me the long for charles frederick
CREATE TABLE table_name_93 (long VARCHAR, player VARCHAR)
SELECT location_attendance FROM table_22883210_10 WHERE team = "Minnesota"
Name the location attendance for minnesota
CREATE TABLE table_22883210_10 (location_attendance VARCHAR, team VARCHAR)
SELECT AVG("Lost") FROM table_41487 WHERE "Difference" = '- 3' AND "Played" < '10'
What is the average Lost when the difference is - 3, and a Played is less than 10?
CREATE TABLE table_41487 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
SELECT avg FROM table_name_65 WHERE yards = "1"
Tell me the average for 1 yards
CREATE TABLE table_name_65 (avg VARCHAR, yards VARCHAR)
SELECT location_attendance FROM table_22883210_7 WHERE record = "20-12"
What location had a record of 20-12, and how many people attended?
CREATE TABLE table_22883210_7 (location_attendance VARCHAR, record VARCHAR)
SELECT date FROM table_name_33 WHERE set_4 = "25-19"
What date has a set 4 of 25-19?
CREATE TABLE table_name_33 ( date VARCHAR, set_4 VARCHAR )
SELECT time_retired FROM table_name_86 WHERE laps = 75 AND driver = "pedro de la rosa"
Which time/retired had 75 laps and Pedro de la Rosa as a driver?
CREATE TABLE table_name_86 (time_retired VARCHAR, laps VARCHAR, driver VARCHAR)
SELECT COUNT(score) FROM table_22883210_7 WHERE date = "January 18"
What was the total score for january 18?
CREATE TABLE table_22883210_7 (score VARCHAR, date VARCHAR)
SELECT MIN("Episodes") FROM table_23043
What was the minimum number of episodes in any of the series?
CREATE TABLE table_23043 ( "No." real, "Country" text, "Local title" text, "Format" text, "Start Date" text, "End Date" text, "Episodes" real, "Premiere/Air Dates" text )