instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Show me a bar chart for how many students are advised by each rank of faculty? List the rank and the number of students, list by the names in asc. | CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,acti... | SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY Rank |
What's the Time for an Event of 4x100 m relay and has a Venue of Frankfurt? | CREATE TABLE table_name_17 (time VARCHAR,event VARCHAR,venue VARCHAR) | SELECT time FROM table_name_17 WHERE event = "4x100 m relay" AND venue = "frankfurt" |
give me the number of female patients primarily suffering from congestive heart failure. | 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.gender = "F" AND demographic.diagnosis = "CONGESTIVE HEART FAILURE" |
What area all values for Slovak when value for Ukranian is , ? | CREATE TABLE table_25008327_8 (slovak VARCHAR,ukrainian VARCHAR) | SELECT slovak FROM table_25008327_8 WHERE ukrainian = "пес, собака" |
Who wrote the episode titled 'man talk'? | CREATE TABLE table_30380 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real) | SELECT "Written by" FROM table_30380 WHERE "Title" = 'Man Talk' |
Show me a bar chart for what are the department names and how many employees work in each of them?, could you list in asc by the bars? | CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE emp... | SELECT DEPARTMENT_NAME, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY DEPARTMENT_NAME ORDER BY DEPARTMENT_NAME |
Which highschool has senior (rs) for the year? | CREATE TABLE table_2623 ("Name" text,"#" real,"Position" text,"Height" text,"Weight" real,"Year" text,"Home Town" text,"High School" text) | SELECT "High School" FROM table_2623 WHERE "Year" = 'Senior (RS)' |
What is the area of the corporation named the powell river, the corporation of the city of? | CREATE TABLE table_30493 ("Name" text,"Corporate name" text,"Regional district" text,"Incorporation date (city)" text,"Population (2011)" real,"Population (2006)" real,"Change (%)" text,"Area (km\u00b2)" text,"Population density" text) | SELECT "Area (km\u00b2)" FROM table_30493 WHERE "Corporate name" = 'Powell River, The Corporation of the City of' |
Name the cost for latest stable date of online | CREATE TABLE table_55887 ("Software" text,"Latest stable date (version)" text,"Cost (USD)" text,"Open source" text,"License" text) | SELECT "Cost ( USD )" FROM table_55887 WHERE "Latest stable date (version)" = 'online' |
What is the margin of victory of the tournament on 5 Jun 1988? | CREATE TABLE table_name_75 (margin_of_victory VARCHAR,date VARCHAR) | SELECT margin_of_victory FROM table_name_75 WHERE date = "5 jun 1988" |
Which average wins have a Club of barcelona atl tic, and Goals for larger than 56? | CREATE TABLE table_67676 ("Position" real,"Club" text,"Played" real,"Points" text,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT AVG("Wins") FROM table_67676 WHERE "Club" = 'barcelona atlètic' AND "Goals for" > '56' |
Name the winning score for pga championship | CREATE TABLE table_25149 ("Year" real,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text) | SELECT "Winning score" FROM table_25149 WHERE "Championship" = 'PGA Championship' |
What is the lowest drawn that has a played greater than 19, with a position less than 2? | CREATE TABLE table_42053 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text) | SELECT MIN("Drawn") FROM table_42053 WHERE "Played" > '19' AND "Position" < '2' |
Count the number of divorce patients who belong to a black/cape verdean ethnic background. | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "BLACK/CAPE VERDEAN" |
Who was the director for episodes that were written be Matthew Lau? | CREATE TABLE table_28079 ("Series #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text) | SELECT "Directed by" FROM table_28079 WHERE "Written by" = 'Matthew Lau' |
How long does the 2579km route take? | CREATE TABLE table_28994 ("Dibrugarh" text,"Kanyakumari" text,"Vivek Express /15905/15906" text,"Indian Railways" text,"4286km" text,"55" real,"Weekly" text,"82.30 hrs(~3.5 days)" text) | SELECT "82.30 hrs(~3.5 days)" FROM table_28994 WHERE "4286km" = '2579km' |
How many opponents have a 1-0 record against the Cowboys? | CREATE TABLE table_25310 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Cowboys points" real,"Opponents" real,"Record" text) | SELECT "Opponents" FROM table_25310 WHERE "Record" = '1-0' |
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, and order by the y-axis from low to high please. | CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE va... | SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(SALARY) |
What language is the book Miss Macintosh, My Darling in? | CREATE TABLE table_name_17 (language VARCHAR,book_title VARCHAR) | SELECT language FROM table_name_17 WHERE book_title = "miss macintosh, my darling" |
What type is the 105/107e Block from a year prior to 1960? | CREATE TABLE table_9968 ("Type" text,"Year" real,"Block" text,"Displacement" text,"Mainly For" text) | SELECT "Type" FROM table_9968 WHERE "Block" = '105/107e' AND "Year" < '1960' |
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the average of code , and group by attribute name. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name |
Which Gender has a Residence of Haliburton? | CREATE TABLE table_69030 ("Riding" text,"Candidate's Name" text,"Gender" text,"Residence" text,"Occupation" text,"Votes" real,"Rank" text) | SELECT "Gender" FROM table_69030 WHERE "Residence" = 'haliburton' |
What is the sum of lap for the Dale Coyne Racing Team, and 0 points? | CREATE TABLE table_name_8 (laps INTEGER,team VARCHAR,points VARCHAR) | SELECT SUM(laps) FROM table_name_8 WHERE team = "dale coyne racing" AND points = 0 |
mmse score of 16 _ 26 inclusive. | CREATE TABLE table_train_106 ("id" int,"gender" string,"pregnancy_or_lactation" bool,"mini_mental_state_examination_mmse" int,"uncontrolled_diabetes" bool,"blood_glucose" int,"rosen_modified_hachinski_ischemic_score" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float) | SELECT * FROM table_train_106 WHERE mini_mental_state_examination_mmse >= 16 AND mini_mental_state_examination_mmse <= 26 |
What was the home team score with an away team of Melbourne? | CREATE TABLE table_name_65 (home_team VARCHAR,away_team VARCHAR) | SELECT home_team AS score FROM table_name_65 WHERE away_team = "melbourne" |
What horse was induced in 2011 with a sire of cowboy p-12? | CREATE TABLE table_name_77 (name_of_horse VARCHAR,year_inducted VARCHAR,broodmare_sire VARCHAR) | SELECT name_of_horse FROM table_name_77 WHERE year_inducted = 2011 AND broodmare_sire = "cowboy p-12" |
Calculate the average amount for all the payments processed with Visa of each day of week using a bar chart, rank y-axis in descending order. | CREATE TABLE Settlements (Settlement_ID INTEGER,Claim_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER,Customer_Policy_ID INTEGER)CREATE TABLE Customers (Customer_ID INTEGER,Customer_Details VARCHAR(255))CREATE TABLE Customer_Policies (Policy_ID INTEGER,Customer_ID I... | SELECT Date_Payment_Made, AVG(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY AVG(Amount_Payment) DESC |
when was patient 027-5581's last diagnosis time a year before for cardiac arrest - un-witnessed? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid ... | SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-5581')) AND diagnosis.diagnosisname = 'cardiac arrest - un-wi... |
What is the largest start for a player with 14 conv, 10 tries and more than 22 pens? | CREATE TABLE table_name_29 (start INTEGER,pens VARCHAR,conv VARCHAR,tries VARCHAR) | SELECT MAX(start) FROM table_name_29 WHERE conv = 14 AND tries = 10 AND pens > 22 |
tell me the number of trains headed for jolarpet junction . | CREATE TABLE table_204_78 (id number,"no." number,"train no." text,"origin" text,"destination" text,"train name" text) | SELECT COUNT("train name") FROM table_204_78 WHERE "destination" = 'jolarpet junction' |
What was the date for monaco grand prix? | CREATE TABLE table_1140067_2 (date VARCHAR,race VARCHAR) | SELECT date FROM table_1140067_2 WHERE race = "Monaco Grand Prix" |
how many patients whose admission location is transfer from hosp/extram and procedure icd9 code is 40? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "40" |
WHAT IS THE SKIP WITH A THIRD OF DEANNA DOIG? | CREATE TABLE table_44571 ("Skip" text,"Third" text,"Second" text,"Lead" text,"City" text) | SELECT "Skip" FROM table_44571 WHERE "Third" = 'deanna doig' |
When was the loan started when the coutry is eng, the loan club is sunderland and the end source is south wales echo? | CREATE TABLE table_name_23 (started VARCHAR,end_source VARCHAR,country VARCHAR,loan_club VARCHAR) | SELECT started FROM table_name_23 WHERE country = "eng" AND loan_club = "sunderland" AND end_source = "south wales echo" |
Select Top in Union test. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE T... | WITH S AS (SELECT 1 AS "index" UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) SELECT 1 AS "order", 'index' FROM S WHERE 2 * ('index' / 2) = 'index' LIMIT 2 UNION ALL SELECT 2 AS "order", 'index' FROM S WHERE 3 * ('index' / 3) = 'index' ORDER BY 'order', 'index' LIMIT 2 |
Visualize the general trend of how many year over the year, and display X-axis in descending order. | CREATE TABLE postseason (year INTEGER,round TEXT,team_id_winner TEXT,league_id_winner TEXT,team_id_loser TEXT,league_id_loser TEXT,wins INTEGER,losses INTEGER,ties INTEGER)CREATE TABLE salary (year INTEGER,team_id TEXT,league_id TEXT,player_id TEXT,salary INTEGER)CREATE TABLE batting (player_id TEXT,year INTEGER,stint ... | SELECT year, COUNT(year) FROM home_game ORDER BY year DESC |
What is the total number of each ship type? Give me a bar chart. | CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text) | SELECT Type, COUNT(Type) FROM ship GROUP BY Type |
give me the number of patients whose religion is episcopalian and lab test name is phosphate? | 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 lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "EPISCOPALIAN" AND lab.label = "Phosphate" |
Which Score has an Opponent of @ la lakers, and a Record of 8-6? | CREATE TABLE table_name_84 (score VARCHAR,opponent VARCHAR,record VARCHAR) | SELECT score FROM table_name_84 WHERE opponent = "@ la lakers" AND record = "8-6" |
Return a bar chart on how many players played each position?, show the total number in asc order. | CREATE TABLE player (Player_ID int,Player text,Years_Played text,Total_WL text,Singles_WL text,Doubles_WL text,Team int)CREATE TABLE country (Country_id int,Country_name text,Capital text,Official_native_language text)CREATE TABLE match_season (Season real,Player text,Position text,Country int,Team int,Draft_Pick_Numbe... | SELECT Position, COUNT(*) FROM match_season GROUP BY Position ORDER BY COUNT(*) |
what is procedure short title of procedure icd9 code 92? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT procedures.short_title FROM procedures WHERE procedures.icd9_code = "92" |
What is the League Goals when the FA Cup Goals are 0, position is mf, League Cup Apps of 0, and name is Ben Thornley? | CREATE TABLE table_name_98 (league_goals INTEGER,name VARCHAR,league_cup_apps VARCHAR,fa_cup_goals VARCHAR,position VARCHAR) | SELECT AVG(league_goals) FROM table_name_98 WHERE fa_cup_goals = "0" AND position = "mf" AND league_cup_apps = "0" AND name = "ben thornley" |
Tell me the prerequisites for BIOMEDE 530 and 241 . | CREATE TABLE area (course_id int,area varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_fe... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE (COURSE_1.number = 530 OR COURSE_1.number = 241) AND COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.depar... |
which game had a larger gap in score between the two teams , week 9 or week 11 ? | CREATE TABLE table_204_644 (id number,"week" number,"date" text,"opponent" text,"result" text,"record" text,"game site" text,"bye" text) | SELECT "week" FROM table_204_644 WHERE "week" IN (9, 11) ORDER BY ABS("result" - "result") DESC LIMIT 1 |
What is every example for the equivalent of NTE160? | CREATE TABLE table_31427 ("Prefix class" text,"Type and usage" text,"Example" text,"Equivalent" text,"Reference" text) | SELECT "Example" FROM table_31427 WHERE "Equivalent" = 'NTE160' |
What is the date of the match when Detroit is the home team and Colorado is the visiting team? | CREATE TABLE table_name_21 (date VARCHAR,home VARCHAR,visitor VARCHAR) | SELECT date FROM table_name_21 WHERE home = "detroit" AND visitor = "colorado" |
how many patients are diagnosed with unspecified problem with head, neck, or trunk and treated with base drug type? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Unspecified problem with head, neck, or trunk" AND prescriptions.drug_type = "BASE" |
i'd like a flight tomorrow late from NASHVILLE to HOUSTON with DINNER please | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,depa... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, food_service WHERE (((((flight.departure_time <= 2400 AND flight.departure_time >= 2000) AND date_day.day_number = 20 AND date_day.month_number = 1 AN... |
What was the result for week 2? | CREATE TABLE table_name_50 (result VARCHAR,week VARCHAR) | SELECT result FROM table_name_50 WHERE week = 2 |
Name the most rebounds for larry smith | CREATE TABLE table_22824319_3 (rebounds INTEGER,player VARCHAR) | SELECT MAX(rebounds) FROM table_22824319_3 WHERE player = "Larry Smith" |
What Tunnel has an Imperial Length of 307 yd? | CREATE TABLE table_46918 ("County" text,"Tunnel" text,"Type" text,"Length (Imperial)" text,"Date of opening" text) | SELECT "Tunnel" FROM table_46918 WHERE "Length (Imperial)" = '307 yd' |
Custom Off Topic close reasons. | CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time... | SELECT * FROM CloseAsOffTopicReasonTypes WHERE DeactivationDate IS NULL |
Show different types of ships and the number of ships of each type. Show a pie chart. | CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text) | SELECT Type, COUNT(*) FROM ship GROUP BY Type |
What is Title, when Studio is 'Embassy Pictures'? | CREATE TABLE table_76212 ("Rank" real,"Title" text,"Studio" text,"Director" text,"Gross" text) | SELECT "Title" FROM table_76212 WHERE "Studio" = 'embassy pictures' |
How much tonnage Tonnage (GRT) has a Nationality of united kingdom, and a Date of 27 june 1941? | CREATE TABLE table_61038 ("Date" text,"Name" text,"Nationality" text,"Tonnage (GRT)" real,"Fate" text) | SELECT COUNT("Tonnage (GRT)") FROM table_61038 WHERE "Nationality" = 'united kingdom' AND "Date" = '27 june 1941' |
For those products with a price between 60 and 120, return a bar chart about the distribution of name and manufacturer , and display by the Name in desc. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT Name, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name DESC |
How many engineers does each staff contact? Show a bar chart, rank in ascending by the staff_name. | CREATE TABLE Fault_Log_Parts (fault_log_entry_id INTEGER,part_fault_id INTEGER,fault_status VARCHAR(10))CREATE TABLE Fault_Log (fault_log_entry_id INTEGER,asset_id INTEGER,recorded_by_staff_id INTEGER,fault_log_entry_datetime DATETIME,fault_description VARCHAR(255),other_fault_details VARCHAR(255))CREATE TABLE Maintena... | SELECT staff_name, COUNT(staff_name) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY staff_name ORDER BY staff_name |
which team was the top scoring team ? | CREATE TABLE table_203_654 (id number,"position" number,"team" text,"points" number,"played" number,"won" number,"drawn" number,"lost" number,"for" number,"against" number,"difference" number) | SELECT "team" FROM table_203_654 ORDER BY "points" DESC LIMIT 1 |
For those records from the products and each product's manufacturer, find headquarter and the average of code , and group by attribute headquarter, and visualize them by a bar chart, order by the x axis in desc please. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC |
Show me the number of patients born before 2120 who were ordered a pleural fluid lab test. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2120" AND lab.fluid = "Pleural" |
List all budget type codes and descriptions. | CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR,budget_type_description VARCHAR) | SELECT budget_type_code, budget_type_description FROM Ref_budget_codes |
What was the outcome on 11 October 2009, when his partner was Jordan Kerr? | CREATE TABLE table_12896 ("Outcome" text,"Date" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT "Outcome" FROM table_12896 WHERE "Partner" = 'jordan kerr' AND "Date" = '11 october 2009' |
What is the 4wi when the economy is 7.82? | CREATE TABLE table_29384 ("Player" text,"Team" text,"Matches" real,"Overs" text,"Wickets" real,"Average" text,"Economy" text,"BBI" text,"4wi" real,"5wi" real) | SELECT "4wi" FROM table_29384 WHERE "Economy" = '7.82' |
find the number of female patients who had 24 hour creatinine lab test. | 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.gender = "F" AND lab.label = "24 hr Creatinine" |
has patient 25869 had pco2 tests in 2105? | CREATE TABLE diagnoses_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 d_icd_procedures (row_id number,icd9_code text,short_title text,l... | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'pco2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25869) AND STRFTIME('%y', labevents.charttime) = '2105' |
What's the part 3 of the verb with part 4 gelopen? | CREATE TABLE table_21705 ("Class" text,"Part 1" text,"Part 2" text,"Part 3" text,"Part 4" text,"Verb meaning" text) | SELECT "Part 3" FROM table_21705 WHERE "Part 4" = 'gelopen' |
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, find hire_date and the average of manager_id bin hire_date by weekday, and visualize them by a bar chart. | CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0)... | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
What is the municipality percentage for San Antonio de Lomerio is San Javier municipality percentage is 31? | CREATE TABLE table_19998428_3 (san_antonio_de_lomerío_municipality___percentage_ VARCHAR,san_javier_municipality___percentage_ VARCHAR) | SELECT san_antonio_de_lomerío_municipality___percentage_ FROM table_19998428_3 WHERE san_javier_municipality___percentage_ = 31 |
what's the height with current club being dkv joventut | CREATE TABLE table_12962773_5 (height VARCHAR,current_club VARCHAR) | SELECT height FROM table_12962773_5 WHERE current_club = "DKV Joventut" |
How many orders have detail 'Second time'? | CREATE TABLE customer_addresses (customer_id number,address_id number,date_address_from time,address_type text,date_address_to time)CREATE TABLE order_items (order_id number,product_id number,order_quantity text)CREATE TABLE customer_contact_channels (customer_id number,channel_code text,active_from_date time,active_to... | SELECT COUNT(*) FROM customer_orders WHERE order_details = "Second time" |
What is the sum of Total, when Rank is 8, and when Bronze is less than 1? | CREATE TABLE table_76909 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Total") FROM table_76909 WHERE "Rank" = '8' AND "Bronze" < '1' |
Name the least tries for when w is 4 | CREATE TABLE table_16770037_4 (tries_for INTEGER,w VARCHAR) | SELECT MIN(tries_for) FROM table_16770037_4 WHERE w = 4 |
What was the try bonus when the points for was 608? | CREATE TABLE table_61794 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Try bonus" FROM table_61794 WHERE "Points for" = '608' |
What is the number of first class team with birthday of 5 december 1970? | CREATE TABLE table_11950720_4 (first_class_team VARCHAR,date_of_birth VARCHAR) | SELECT COUNT(first_class_team) FROM table_11950720_4 WHERE date_of_birth = "5 December 1970" |
How many high rebounds took place on December 8? | CREATE TABLE table_29774 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT COUNT("High rebounds") FROM table_29774 WHERE "Date" = 'December 8' |
Net votes per question by tag. | 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 Tags.TagName, SUM(Posts.Score) AS TotScore, COUNT(*) AS TotCount, CAST(CAST(SUM(Posts.Score) AS FLOAT) / COUNT(*) AS FLOAT(20, 3)) AS NetScorePQ, SUM(CASE WHEN Posts.Score > 0 THEN 1 ELSE 0 END) AS PosScoreQs, SUM(CASE WHEN Posts.Score = 0 THEN 1 ELSE 0 END) AS ZeroScoreQs, SUM(CASE WHEN Posts.Score < 0 THEN 1 E... |
what was patient 20441's changes in the weight last measured on the last hospital visit compared to the value second to last measured on the last hospital visit? | 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 d_icd_diagnoses (row_id number,icd9_code text,short_title text,... | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20441 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND ch... |
name the nation with the most appearances . | CREATE TABLE table_204_159 (id number,"name" text,"nation" text,"position" text,"league apps" number,"league goals" number,"fa cup apps" number,"fa cup goals" number,"total apps" number,"total goals" number) | SELECT "nation" FROM table_204_159 ORDER BY "total apps" DESC LIMIT 1 |
find out how many patients were discharged from the hospital until 2101. | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE cost (cos... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) <= '2101' |
Which line is the Geumjeong tunnel? | CREATE TABLE table_name_82 (line VARCHAR,name VARCHAR) | SELECT line FROM table_name_82 WHERE name = "geumjeong tunnel" |
What are the names of wrestlers and the elimination moves? | CREATE TABLE elimination (Elimination_Move VARCHAR,Wrestler_ID VARCHAR)CREATE TABLE wrestler (Name VARCHAR,Wrestler_ID VARCHAR) | SELECT T2.Name, T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID |
what is the monthly average value of patient 5828's mch? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 d_labitems (row_id number,itemid number,label text)CREATE TABLE transfers (row_id number,subject_id number,... | SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mch') GROUP BY STRFTIME('%y-%m', labevents.charttime) |
Name the lfop 4/24/09 for opinionway of 4/17/09 of 5% for party of left front | CREATE TABLE table_name_43 (ifop_4_24_09 VARCHAR,opinionway_4_17_09 VARCHAR,party VARCHAR) | SELECT ifop_4_24_09 FROM table_name_43 WHERE opinionway_4_17_09 = "5%" AND party = "left front" |
What is every description if NO votes is 233759? | CREATE TABLE table_256286_43 (description VARCHAR,no_votes VARCHAR) | SELECT description FROM table_256286_43 WHERE no_votes = 233759 |
How many wins did team Kolles & Heinz union, with f/laps of 0, have in the Formula Three Euroseries? | CREATE TABLE table_name_16 (wins VARCHAR,team VARCHAR,f_laps VARCHAR,series VARCHAR) | SELECT wins FROM table_name_16 WHERE f_laps = "0" AND series = "formula three euroseries" AND team = "kolles & heinz union" |
What is the transfer window for the country of ESP and the name of de la red? | CREATE TABLE table_70529 ("Name" text,"Country" text,"Status" text,"Transfer window" text,"Transfer fee" text) | SELECT "Transfer window" FROM table_70529 WHERE "Country" = 'esp' AND "Name" = 'de la red' |
was the value of the creatinine of patient 2334 last measured on the first hospital visit greater than that second to last measured on the first hospital visit? | 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 microbiologyevents (row... | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2334 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label =... |
What was the final place came for the performance of Erlend Bratland? | CREATE TABLE table_26066 ("Place came" text,"Artist" text,"Category" text,"Act" text,"Semi-final" text,"Result" text) | SELECT "Place came" FROM table_26066 WHERE "Artist" = 'Erlend Bratland' |
Count the hometown by hometown using a bar chart, and order in descending by the x-axis please. | CREATE TABLE branch (Branch_ID int,Name text,Open_year text,Address_road text,City text,membership_amount text)CREATE TABLE member (Member_ID int,Card_Number text,Name text,Hometown text,Level int)CREATE TABLE membership_register_branch (Member_ID int,Branch_ID text,Register_Year text)CREATE TABLE purchase (Member_ID i... | SELECT Hometown, COUNT(Hometown) FROM member GROUP BY Hometown ORDER BY Hometown DESC |
how many of the laureates received the nobel peace prize ? | CREATE TABLE table_203_437 (id number,"year" number,"laureate" text,"relation" text,"category" text,"rationale" text) | SELECT COUNT("laureate") FROM table_203_437 WHERE "category" = 'nobel peace prize' |
how many male patients had unspecified erythematous condition? | 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 WHERE demographic.gender = "M" AND diagnoses.long_title = "Unspecified erythematous condition" |
what is the first flight arriving in MONTREAL from TORONTO friday | CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE code_description (code varc... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((((flight.departure_time > flight.arrival_time) AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.da... |
What is the to par value for the game with a winning score of 71-69-71-70=281? | CREATE TABLE table_name_49 (to_par VARCHAR,winning_score VARCHAR) | SELECT to_par FROM table_name_49 WHERE winning_score = 71 - 69 - 71 - 70 = 281 |
Who was the opponent for the 2003 davis cup europe/africa group ii? | CREATE TABLE table_9620 ("Edition" text,"Round" text,"Date" text,"Against" text,"Surface" text,"Opponent" text,"Result" text) | SELECT "Opponent" FROM table_9620 WHERE "Edition" = '2003 davis cup europe/africa group ii' |
What is the reunion weight of the contestant who lost 74.4 lbs at the finale? | CREATE TABLE table_28654454_5 (reunion_weight VARCHAR,lbs_lost_finale VARCHAR) | SELECT reunion_weight FROM table_28654454_5 WHERE lbs_lost_finale = "74.4" |
Name the most races | CREATE TABLE table_21457754_2 (races INTEGER) | SELECT MAX(races) FROM table_21457754_2 |
Which enzyme names have the substring 'ALA'? | CREATE TABLE enzyme (name VARCHAR) | SELECT name FROM enzyme WHERE name LIKE "%ALA%" |
What are all the locations with a cinema? | CREATE TABLE cinema (LOCATION VARCHAR) | SELECT DISTINCT LOCATION FROM cinema |
what 's the total number of albums released by willy deville ? | CREATE TABLE table_204_471 (id number,"year" number,"title" text,"peak chart positions\nger" number,"label" text,"artist" text) | SELECT COUNT("title") FROM table_204_471 WHERE "artist" = 'willy deville' |
Name the least game for record of 5-1-3 | CREATE TABLE table_name_93 (game INTEGER,record VARCHAR) | SELECT MIN(game) FROM table_name_93 WHERE record = "5-1-3" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.