instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the average of revenue , and group by attribute name, and could you list by the x axis in ascending 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.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name |
How many league of communists have the municipality of bar? | CREATE TABLE table_15306124_1 (league_of_communists VARCHAR,municipality VARCHAR) | SELECT COUNT(league_of_communists) FROM table_15306124_1 WHERE municipality = "Bar" |
Find out the number of patients with aortic valve disorder diagnoses who had an ascitic lab fluid test. | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | 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.short_title = "Aortic valve disorder" AND lab.fluid = "Ascites" |
What was the race when the winner of 2nd was Voleuse? | CREATE TABLE table_name_27 (race VARCHAR,winner_or_2nd VARCHAR) | SELECT race FROM table_name_27 WHERE winner_or_2nd = "voleuse" |
Can you tell me the sum of Intake that has the Faith of rc, and the DCSF number larger than 2428? | CREATE TABLE table_name_54 (intake INTEGER,faith VARCHAR,dcsf_number VARCHAR) | SELECT SUM(intake) FROM table_name_54 WHERE faith = "rc" AND dcsf_number > 2428 |
what is minimum age for different job title? | CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT) | SELECT job, MIN(age) FROM Person GROUP BY job |
What is the highes win % that manager juan carlos ch vez's team had when they lost less than 4 times? | CREATE TABLE table_name_40 (win__percentage INTEGER,manager VARCHAR,lost VARCHAR) | SELECT MAX(win__percentage) FROM table_name_40 WHERE manager = "juan carlos chávez" AND lost < 4 |
Has Episode 1b-16 (42) been preserved? | CREATE TABLE table_6266 ("Episode" text,"Title" text,"Writer(s)" text,"Preservation" text,"Original airdate" text) | SELECT "Preservation" FROM table_6266 WHERE "Episode" = '1b-16 (42)' |
What is the highest number of Cuts made that has a Top 10 smaller than 8 and Wins larger than 0? | CREATE TABLE table_56531 ("Year" text,"Starts" real,"Cuts made" real,"Wins" real,"Top 10" real,"Top 25" real,"Earnings ($)" real,"Money list rank" text) | SELECT MAX("Cuts made") FROM table_56531 WHERE "Top 10" < '8' AND "Wins" > '0' |
Which Artist has an Issue Price of $8,159.95? | CREATE TABLE table_54942 ("Year" real,"Artist" text,"Composition" text,"Mintage" real,"Issue Price" text) | SELECT "Artist" FROM table_54942 WHERE "Issue Price" = '$8,159.95' |
What is the most used instrument? | CREATE TABLE instruments (instrument VARCHAR) | SELECT instrument FROM instruments GROUP BY instrument ORDER BY COUNT(*) DESC LIMIT 1 |
Which final has a run of 1:19.49? | CREATE TABLE table_47597 ("Rank" text,"Team" text,"Run 1" text,"Run 2" text,"Run 3" text,"Final" text) | SELECT "Final" FROM table_47597 WHERE "Run 3" = '1:19.49' |
Who received the reward on the episode where the finish was '3rd voted out day 8'? | CREATE TABLE table_1272844_2 (reward VARCHAR,finish VARCHAR) | SELECT reward FROM table_1272844_2 WHERE finish = "3rd voted Out Day 8" |
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, give me the comparison about the average of manager_id over the hire_date bin hire_date by time by a bar chart, could you sort total number from high to low order please? | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE employees (... | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID) DESC |
Which competition was on August 11, 1996? | CREATE TABLE table_38215 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Competition" FROM table_38215 WHERE "Date" = 'august 11, 1996' |
count the number of patients whose marital status is divorced and diagnoses short title is cardiogenic shock? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.short_title = "Cardiogenic shock" |
Top 20 Bounty hunters per # of bounties and rep. | CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,U... | SELECT Posts.OwnerUserId AS "user_link", COUNT(*) AS "bounties_won", SUM(Votes.BountyAmount) AS "rep_gained" FROM Votes INNER JOIN Posts ON Votes.PostId = Posts.Id WHERE VoteTypeId = 9 GROUP BY Posts.OwnerUserId ORDER BY 2 DESC LIMIT 20 |
what is the date of appointment 11 june 2010? | CREATE TABLE table_26914854_3 (team VARCHAR,date_of_appointment VARCHAR) | SELECT team FROM table_26914854_3 WHERE date_of_appointment = "11 June 2010" |
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, visualize a line chart about the change of department_id over hire_date , rank HIRE_DATE in descending order. | 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 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 jobs (JOB_ID var... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC |
What event had 1 round and a record of 6-2? | CREATE TABLE table_name_9 (event VARCHAR,round VARCHAR,record VARCHAR) | SELECT event FROM table_name_9 WHERE round = 1 AND record = "6-2" |
Can you tell me the sum of Grid that has the Laps of 30, and the Rider of toni elias? | CREATE TABLE table_name_54 (grid INTEGER,laps VARCHAR,rider VARCHAR) | SELECT SUM(grid) FROM table_name_54 WHERE laps = 30 AND rider = "toni elias" |
How many writers write the episode whose director is Jonathan Herron? | CREATE TABLE table_22580855_1 (written_by VARCHAR,directed_by VARCHAR) | SELECT COUNT(written_by) FROM table_22580855_1 WHERE directed_by = "Jonathan Herron" |
A bar chart showing the average of capacity of cinemas open for each year, and order in ascending by the the average of capacity. | CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_cod... | SELECT Openning_year, AVG(Capacity) FROM cinema GROUP BY Openning_year ORDER BY AVG(Capacity) |
What are the names of mountains in ascending alphabetical order? | CREATE TABLE mountain (mountain_id number,name text,height number,prominence number,range text,country text)CREATE TABLE climber (climber_id number,name text,country text,time text,points number,mountain_id number) | SELECT name FROM mountain ORDER BY name |
What's the date of the game that has the Bulls as a visiting team? | CREATE TABLE table_34990 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text) | SELECT "Date" FROM table_34990 WHERE "Visitor" = 'bulls' |
how many patients categorized under chemistry lab test are less than 58 years? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "58" AND lab."CATEGORY" = "Chemistry" |
List the method, date and amount of all the payments, in ascending order of date. | CREATE TABLE settlements (settlement_id number,claim_id number,date_claim_made time,date_claim_settled time,amount_claimed number,amount_settled number,customer_policy_id number)CREATE TABLE claims (claim_id number,policy_id number,date_claim_made time,date_claim_settled time,amount_claimed number,amount_settled number... | SELECT payment_method_code, date_payment_made, amount_payment FROM payments ORDER BY date_payment_made |
How many tries for were there while having 479 points against? | CREATE TABLE table_70630 ("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 "Tries for" FROM table_70630 WHERE "Points against" = '479' |
Name the least episode number for jonathan harvey | CREATE TABLE table_3714 ("Episode #" real,"Title" text,"Directed by" text,"Written by" text,"Originalairdate" text,"Ratings" text) | SELECT MIN("Episode #") FROM table_3714 WHERE "Written by" = 'Jonathan Harvey' |
How many times is the shot volume (cm3) less than 172.76? | CREATE TABLE table_name_37 (shot_diameter__cm_ VARCHAR,shot_volume__cm_3__ INTEGER) | SELECT COUNT(shot_diameter__cm_) FROM table_name_37 WHERE shot_volume__cm_3__ < 172.76 |
In what Year of Census or Estimate is the Toronto Population larger than 1,556,396? | CREATE TABLE table_66597 ("Rank" real,"City" text,"Population" real,"Year of Census or Estimate" real,"Country" text) | SELECT SUM("Year of Census or Estimate") FROM table_66597 WHERE "Population" > '1,556,396' AND "City" = 'toronto' |
What's amount of L2 Cache on a device that has a Frequency of 1500mhz? | CREATE TABLE table_name_78 (l2_cache VARCHAR,frequency VARCHAR) | SELECT l2_cache FROM table_name_78 WHERE frequency = "1500mhz" |
Which Political Party has a Name of rexhep bej mitrovica? | CREATE TABLE table_name_22 (political_party VARCHAR,name VARCHAR) | SELECT political_party FROM table_name_22 WHERE name = "rexhep bej mitrovica" |
For each project id, how many staff does it have? List them in increasing order. | CREATE TABLE organisations (organisation_id number,organisation_type text,organisation_details text)CREATE TABLE tasks (task_id number,project_id number,task_details text,eg agree objectives text)CREATE TABLE project_staff (staff_id number,project_id number,role_code text,date_from time,date_to time,other_details text)... | SELECT T1.project_id, COUNT(*) FROM project_staff AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY COUNT(*) |
out of total number of patients diagnosed with crbl art ocl nos w infrc, how many of them belonged to hispanic or latino ethnic origin? | 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 WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND diagnoses.short_title = "Crbl art ocl NOS w infrc" |
i want to go from BALTIMORE to SAN FRANCISCO with a stopover in DENVER | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,gro... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CIT... |
What is the call sign of the station with the frequency of 90.3mhz | CREATE TABLE table_21749 ("Branding" text,"Callsign" text,"Frequency" text,"Power (kW)" text,"Location" text) | SELECT "Callsign" FROM table_21749 WHERE "Frequency" = '90.3MHz' |
this year what is the first careunit of patient 97314? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod 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)CREA... | SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97314) AND NOT transfers.careunit IS NULL AND DATETIME(transfers.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY transfers.intime LIMIT 1 |
What is the record when St. Louis is the visitor? | CREATE TABLE table_name_56 (record VARCHAR,visitor VARCHAR) | SELECT record FROM table_name_56 WHERE visitor = "st. louis" |
List all the movies directed by ' Asghar Farhadi ' in which ' Taraneh Alidoosti ' played | CREATE TABLE classification (id int,msid int,gid int)CREATE TABLE genre (gid int,genre text)CREATE TABLE keyword (id int,keyword text)CREATE TABLE actor (aid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE tv_series (sid int,title text,release_year int,num_of_seasons int,num_of_ep... | SELECT movie.title FROM actor, cast, directed_by, director, movie WHERE actor.name = 'Taraneh Alidoosti' AND cast.aid = actor.aid AND director.did = directed_by.did AND director.name = 'Asghar Farhadi' AND movie.mid = cast.msid AND movie.mid = directed_by.msid |
List records for game 29. | CREATE TABLE table_27734286_6 (record VARCHAR,game VARCHAR) | SELECT record FROM table_27734286_6 WHERE game = 29 |
What's the sum of gold where silver is more than 2 and the total is 12? | CREATE TABLE table_55404 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Gold") FROM table_55404 WHERE "Silver" > '2' AND "Total" = '12' |
The last time ARMENIAN 171 was offered was when ? | CREATE TABLE gsi (course_offering_id int,student_id int)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_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respe... | SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ARMENIAN' AND course.number = 171 AND semester.semester_id = course_offering.semester ORDER BY semester.year DESC LIMIT 1 |
List all the image name and URLs in the order of their names. | CREATE TABLE document_sections_images (section_id number,image_id number)CREATE TABLE documents (document_code text,document_structure_code text,document_type_code text,access_count number,document_name text)CREATE TABLE roles (role_code text,role_description text)CREATE TABLE functional_areas (functional_area_code tex... | SELECT image_name, image_url FROM images ORDER BY image_name |
What is the average number of draws for losses over 8 and Against values under 1344? | CREATE TABLE table_79583 ("Club" text,"Wins" real,"Losses" real,"Draws" real,"Against" real) | SELECT AVG("Draws") FROM table_79583 WHERE "Losses" > '8' AND "Against" < '1344' |
what was the first value of an osmolality, urine lab test in patient 72107 until 02/2103? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE admissions ... | SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72107) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'osmolality, urine') AND STRFTIME('%y-%m', labevents.charttime) <= '2103-02' ORDE... |
what is the name of the station where the metlink code is mata? | CREATE TABLE table_3005450_1 (station VARCHAR,metlink_code VARCHAR) | SELECT station FROM table_3005450_1 WHERE metlink_code = "MATA" |
Who was the home team at Kardinia Park? | CREATE TABLE table_name_78 (home_team VARCHAR,venue VARCHAR) | SELECT home_team FROM table_name_78 WHERE venue = "kardinia park" |
Draw a scatterplot of team id vs all_games_percent where team id is on the x-axis and points are colored by ACC_Home | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT Team_ID, All_Games_Percent FROM basketball_match GROUP BY ACC_Home |
when was patient 20441 last prescribed both potassium chl 20 meq / 1000 ml d5 1/2 ns and vial at the same time in 03/this year? | CREATE TABLE d_labitems (row_id number,itemid number,label 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 chartevents (row_id number,subject_... | SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'potassium chl 20 meq / 1000 ml d5 1/2 ns' AND admissions.subject_id = 20441 AND DATETIME(prescriptions.startdate, 'start of year') ... |
Who is the incumbent in the Alabama 6 voting district? | CREATE TABLE table_1341973_3 (incumbent VARCHAR,district VARCHAR) | SELECT incumbent FROM table_1341973_3 WHERE district = "Alabama 6" |
how many patients less than 31 years of age have been diagnosed with crnry athrscl natve vssl? | 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 WHERE demographic.age < "31" AND diagnoses.short_title = "Crnry athrscl natve vssl" |
how much is the difference in body weight of patient 12726 last measured on the current hospital visit compared to the value first measured on the current hospital visit? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE transfers (row_id num... | 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 = 12726 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM... |
Name the number of season for beluga shipping | CREATE TABLE table_26168687_5 (no_in_season VARCHAR,vessel_operator VARCHAR) | SELECT COUNT(no_in_season) FROM table_26168687_5 WHERE vessel_operator = "Beluga Shipping" |
how many prescriptions of methylprednisolone na succ had been issued this year? | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)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 ... | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.drug = 'methylprednisolone na succ' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
What are the earnings for jim colbert with under 4 wins? | CREATE TABLE table_name_33 (earnings___ VARCHAR,player VARCHAR,wins VARCHAR) | SELECT COUNT(earnings___) AS $__ FROM table_name_33 WHERE player = "jim colbert" AND wins < 4 |
count the number of times that patient 005-76912 had had an ns ivf intake on 08/02/this year. | 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 vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature n... | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-76912')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.ce... |
Who wrote 'the diaper incident'? | CREATE TABLE table_30747 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text) | SELECT "Written by" FROM table_30747 WHERE "Title" = 'The Diaper Incident' |
Will 334 have a lab ? | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE program_requirement (program_id int,category varc... | SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 334 |
Which team has Yuriy Hruznov as coach? | CREATE TABLE table_57030 ("Team" text,"Location" text,"Venue" text,"League and position in 1991" text,"Coach" text) | SELECT "Team" FROM table_57030 WHERE "Coach" = 'yuriy hruznov' |
How many clubs are involved when the clubs remaining are 2? | CREATE TABLE table_63651 ("Round" text,"Clubs remaining" real,"Clubs involved" real,"Winners from previous round" text,"New entries this round" text,"Leagues entering at this round" text) | SELECT SUM("Clubs involved") FROM table_63651 WHERE "Clubs remaining" = '2' |
What is the lowest division number? | CREATE TABLE table_21602734_1 (division INTEGER) | SELECT MIN(division) FROM table_21602734_1 |
Find All_Home and School_ID , and group by attribute ACC_Road, and visualize them by a bar chart, and could you show x axis in descending order? | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY All_Home DESC |
It is was announced on July 2, 2006 that what asset had been acquired? | CREATE TABLE table_18944 ("Asset Acquired" text,"Acquired From" text,"Date Announced" text,"Date Completed" text,"Reported Cost" text) | SELECT "Asset Acquired" FROM table_18944 WHERE "Date Announced" = 'July 2, 2006' |
who is the author for harry potter and the deathly hallows? | CREATE TABLE table_name_17 (author VARCHAR,title VARCHAR) | SELECT author FROM table_name_17 WHERE title = "harry potter and the deathly hallows" |
A bar chart for what are the number of the facility codes of the apartments with more than four bedrooms?, and list Y in descending order. | CREATE TABLE Guests (guest_id INTEGER,gender_code CHAR(1),guest_first_name VARCHAR(80),guest_last_name VARCHAR(80),date_of_birth DATETIME)CREATE TABLE View_Unit_Status (apt_id INTEGER,apt_booking_id INTEGER,status_date DATETIME,available_yn BIT)CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name C... | SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC |
Find the average gpa of all students in each department with a bar chart, sort from high to low by the Y please. | CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF... | SELECT DEPT_CODE, AVG(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY AVG(STU_GPA) DESC |
What is the title of #33? | CREATE TABLE table_28119 ("Series #" real,"Season #" real,"Title" text,"Director" text,"Writer(s)" text,"Airdate" text) | SELECT "Title" FROM table_28119 WHERE "Season #" = '33' |
What is the south season of the scorpio sign, which has cold & wet qualities? | CREATE TABLE table_name_88 (season VARCHAR,qualities VARCHAR,sign VARCHAR) | SELECT season AS :_south FROM table_name_88 WHERE qualities = "cold & wet" AND sign = "scorpio" |
What was the venue for the dates 1,2,3,4,6,7 jan 1908? | CREATE TABLE table_44920 ("Date" text,"Home captain" text,"Away captain" text,"Venue" text,"Result" text) | SELECT "Venue" FROM table_44920 WHERE "Date" = '1,2,3,4,6,7 jan 1908' |
How many bills where originally cosponsored in those years where the total of all amendments cosponsored was 0? | CREATE TABLE table_22637 ("Years covered" text,"All bills sponsored" real,"All amendments sponsored" real,"All bills cosponsored" real,"All amendments cosponsored" real,"Bills originally cosponsored" real,"Amendments originally cosponsored" real) | SELECT "Bills originally cosponsored" FROM table_22637 WHERE "All amendments cosponsored" = '0' |
how many patients have undergone cont inv mec ven 96+ hrs within the same month after the previous nephroureterectomy in 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 d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id n... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'nephrourete... |
Top reputation users - ordered by Id. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByRev... | SELECT Id AS "user_link", DisplayName, Reputation FROM Users ORDER BY Reputation DESC LIMIT 500 |
What is the average ranking for a react of 0.17300000000000001 and less than 5 lanes? | CREATE TABLE table_13280 ("Rank" real,"Lane" real,"Athlete" text,"Nationality" text,"Time" real,"React" real) | SELECT AVG("Rank") FROM table_13280 WHERE "React" = '0.17300000000000001' AND "Lane" < '5' |
what is the latest flight from SALT LAKE CITY to ST. PETERSBURG | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline te... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SALT LAKE CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name =... |
What is the most money United States player Bob Gilder won? | CREATE TABLE table_8070 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real) | SELECT MAX("Money ( $ )") FROM table_8070 WHERE "Country" = 'united states' AND "Player" = 'bob gilder' |
How many live births per year do people with a life expectancy of 65.1 have? | CREATE TABLE table_27434_2 (live_births_per_year VARCHAR,life_expectancy_total VARCHAR) | SELECT live_births_per_year FROM table_27434_2 WHERE life_expectancy_total = "65.1" |
Name the term ends for bethlehem | CREATE TABLE table_23333 ("District" real,"Representative" text,"Party" text,"Residence" text,"Counties represented" text,"Term ends" real,"First Elected" real) | SELECT COUNT("Term ends") FROM table_23333 WHERE "Residence" = 'Bethlehem' |
Answers by the given user with the given phrase (case insensitive, accent insensitive). | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivileg... | SELECT Id AS "post_link", Score FROM Posts WHERE (PostTypeId = 2) AND (OwnerUserId = '##userid?25510##') AND (Body LIKE '%##word?urgent##%' COLLATE Latin1_General_CI_AI) ORDER BY Id |
What classes do n't have lab sessions ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time... | SELECT DISTINCT name, number FROM course WHERE department = 'EECS' AND has_lab = 'N' |
Show each state and the number of addresses in each state. | CREATE TABLE addresses (state_province_county VARCHAR) | SELECT state_province_county, COUNT(*) FROM addresses GROUP BY state_province_county |
What was the time in part 3 when Heikki Kovalainen was the driver? | CREATE TABLE table_20159025_1 (part_3 VARCHAR,driver VARCHAR) | SELECT part_3 FROM table_20159025_1 WHERE driver = "Heikki Kovalainen" |
I want the sum of tracks for raised on rock | CREATE TABLE table_name_99 (track INTEGER,song_title VARCHAR) | SELECT SUM(track) FROM table_name_99 WHERE song_title = "raised on rock" |
Users don't like to accept. | CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId n... | SELECT OwnerUserId AS "user_link", COUNT(*) AS N FROM Posts WHERE PostTypeId = 1 AND AcceptedAnswerId IS NULL AND NOT OwnerUserId IS NULL AND NOT ClosedDate IS NULL AND Posts.Id IN (SELECT DISTINCT ParentId FROM Posts) GROUP BY OwnerUserId ORDER BY N DESC LIMIT 100 |
What's the name of the competition in 8th position? | CREATE TABLE table_name_98 (competition VARCHAR,position VARCHAR) | SELECT competition FROM table_name_98 WHERE position = "8th" |
count the number of patients whose admission type is emergency and procedure long title is other partial resection of small intestine? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.long_title = "Other partial resection of small intestine" |
I want the years for marathon distance and wins of 3 | CREATE TABLE table_57663 ("Athlete" text,"Country" text,"Wins" real,"Years" text,"Distance" text) | SELECT "Years" FROM table_57663 WHERE "Distance" = 'marathon' AND "Wins" = '3' |
What is the number of podiums with 0 wins, 0 F.L. and 35 points? | CREATE TABLE table_76659 ("Season" text,"Series" text,"Team Name" text,"Races" text,"Wins" text,"Poles" text,"F.L." text,"Podiums" text,"Points" text,"Position" text) | SELECT "Podiums" FROM table_76659 WHERE "Wins" = '0' AND "F.L." = '0' AND "Points" = '35' |
bmi between 25 & 45 kg / m2 | CREATE TABLE table_train_188 ("id" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float) | SELECT * FROM table_train_188 WHERE body_mass_index_bmi > 25 AND body_mass_index_bmi < 45 |
2 _ h plasma glucose > 200 mg / dl based on 75 _ g ogtt | CREATE TABLE table_train_204 ("id" int,"systolic_blood_pressure_sbp" int,"plasma_glucose_concentration" int,"fasting_plasma_glucose_fpg" float,"increase_risk_of_intervention" bool,"diastolic_blood_pressure_dbp" int,"life_span" bool,"body_mass_index_bmi" float,"NOUSE" float) | SELECT * FROM table_train_204 WHERE plasma_glucose_concentration > 200 |
what is the number of patients whose age is less than 72 and drug route is po/ng? | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "72" AND prescriptions.route = "PO/NG" |
Which sport has 17 as the medal count? | CREATE TABLE table_63603 ("Medal count" real,"Date" text,"Athlete" text,"Nation" text,"Sport" text,"Record medal event" text) | SELECT "Sport" FROM table_63603 WHERE "Medal count" = '17' |
What is Points, when Draws is less than 7, when Wins is less than 16, and when Goals For is '35'? | CREATE TABLE table_50764 ("Position" real,"Played" real,"Points" real,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT "Points" FROM table_50764 WHERE "Draws" < '7' AND "Wins" < '16' AND "Goals for" = '35' |
Who constructed the car that has a Time/Retired of +2:06.0? | CREATE TABLE table_56489 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Constructor" FROM table_56489 WHERE "Time/Retired" = '+2:06.0' |
What is Tournament, when Opponent In The Final is 'Andre Agassi'? | CREATE TABLE table_50594 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent in the final" text,"Score in the final" text) | SELECT "Tournament" FROM table_50594 WHERE "Opponent in the final" = 'andre agassi' |
What is the lowest number of draws with more than 2 byes? | CREATE TABLE table_name_81 (draws INTEGER,byes INTEGER) | SELECT MIN(draws) FROM table_name_81 WHERE byes > 2 |
how many days have passed since the last time patient 003-10080 on their current hospital encounter received a wbc x 1000 lab test? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-10080' AND patient.hospi... |
what's the bleeding time with platelet count being decreased or unaffected | CREATE TABLE table_19064 ("Condition" text,"Prothrombin time" text,"Partial thromboplastin time" text,"Bleeding time" text,"Platelet count" text) | SELECT "Bleeding time" FROM table_19064 WHERE "Platelet count" = 'Decreased or unaffected' |
show the number of female patients whose primary disease was overdose. | 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 = "OVERDOSE" |
how many patients were diagnosed with syst rheum arthritis nec did not return to the hospital within 2 months? | 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 chartevents (row_id number,subject_id number,hadm_id number,ic... | SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'syst rheum... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.