table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255) ) CREATE TABLE Accounts ( account_id INTEGER, c...
Bar graph to show sum card number from different card type code, could you rank Y from high to low order?
SELECT card_type_code, SUM(card_number) FROM Customers_Cards GROUP BY card_type_code ORDER BY SUM(card_number) DESC
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
For those employees who do not work in departments with managers that have ids between 100 and 200, a line chart shows the trend of salary over hire_date , I want to order by the X in ascending.
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE dorm_amenity ( amenid number, ...
Find the first and last name of students who are not in the largest major.
SELECT fname, lname FROM student WHERE major <> (SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1)
CREATE TABLE table_16244 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Featured character(s)" text, "Original air date" text, "U.S. viewers (million)" text )
Who directed the episode where u.s. viewers (million) is 12.90?
SELECT "Directed by" FROM table_16244 WHERE "U.S. viewers (million)" = '12.90'
CREATE TABLE table_17323042_11 ( high_assists VARCHAR, game VARCHAR )
Who was the High Assist in game 1?
SELECT high_assists FROM table_17323042_11 WHERE game = 1
CREATE TABLE VOTING_RECORD ( Secretary_Vote VARCHAR, ELECTION_CYCLE VARCHAR )
What are the distinct secretary votes in the fall election cycle?
SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall"
CREATE TABLE table_name_98 ( first_elected VARCHAR, district VARCHAR )
What is the first elected date for the incumbent in the South Carolina 4 district?
SELECT first_elected FROM table_name_98 WHERE district = "south carolina 4"
CREATE TABLE table_1849243_1 ( viewers__in_millions_ VARCHAR, run_time VARCHAR )
How many viewers in millions watched the episode 23:55 minutes long?
SELECT viewers__in_millions_ FROM table_1849243_1 WHERE run_time = "23:55"
CREATE TABLE table_name_53 ( district VARCHAR, location VARCHAR )
What District has a Location of villupuram?
SELECT district FROM table_name_53 WHERE location = "villupuram"
CREATE TABLE table_name_80 ( silver INTEGER, bronze VARCHAR, rank VARCHAR )
What is the low silver medal total for nations with over 1 bronze ranked above 11?
SELECT MIN(silver) FROM table_name_80 WHERE bronze > 1 AND rank < 11
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE student_record ( student_id int, course_id int, semest...
During the Fall and Winter term , how many 200 level classes are there ?
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 200 AND 200 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester...
CREATE TABLE table_71735 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "9:30" text, "10:00" text )
What is on at 9:30 on the channel of dancing with the stars?
SELECT "9:30" FROM table_71735 WHERE "8:30" = 'dancing with the stars'
CREATE TABLE region ( region_name VARCHAR, Label VARCHAR )
Show all distinct region names ordered by their labels.
SELECT DISTINCT region_name FROM region ORDER BY Label
CREATE TABLE table_19482 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text )
What is the pick number of the player whose college is Florida State?
SELECT "Pick #" FROM table_19482 WHERE "College" = 'Florida State'
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE aircraft ( ...
show me flights from PITTSBURGH to SAN FRANCISCO on sunday
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 (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 27 AND date_day.month_number = 8...
CREATE TABLE table_name_88 ( grid INTEGER, laps VARCHAR, time_retired VARCHAR, driver VARCHAR )
what is the lowest grid when the time retired is clutch, the driver is peter collins and the laps is smaller than 26?
SELECT MIN(grid) FROM table_name_88 WHERE time_retired = "clutch" AND driver = "peter collins" AND laps < 26
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 job_history ( EMPLOYEE...
For those employees who did not have any job in the past, return a scatter chart about the correlation between manager_id and department_id .
SELECT MANAGER_ID, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
CREATE TABLE table_name_87 ( round VARCHAR, pick VARCHAR )
What is the total number of rounds of the player with a pick of 20?
SELECT COUNT(round) FROM table_name_87 WHERE pick = 20
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 Users ( Id number, Reputation number,...
Answers Given To A Particular User.
SELECT DISTINCT qtns.Id, qtns.Title, qtns.CreationDate, CASE WHEN qtns.AcceptedAnswerId = ans.Id THEN 'Yes' ELSE 'No' END AS Accepted FROM Posts AS qtns JOIN Posts AS ans ON qtns.Id = ans.ParentId WHERE qtns.OwnerUserId = @QtnsUser AND ans.OwnerUserId = @AnsUser ORDER BY qtns.CreationDate
CREATE TABLE table_name_13 ( points VARCHAR, tries_for VARCHAR )
What is the Points with a Tries For that is 21?
SELECT points FROM table_name_13 WHERE tries_for = "21"
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, Par...
Duplicate link score of answers for a specific user.
SELECT PL.RelatedPostId AS "post_link", COUNT(*) AS LinkScore FROM PostLinks AS PL INNER JOIN Posts AS PS ON PS.Id = PL.PostId INNER JOIN Posts AS PT ON PT.ParentId = PL.RelatedPostId WHERE PL.LinkTypeId = 3 AND PT.OwnerUserId = '##UserId?2751851##' GROUP BY PL.RelatedPostId ORDER BY LinkScore DESC
CREATE TABLE table_1733457_1 ( kerry_number INTEGER, others_number VARCHAR )
Name the maximum kerry # for where others is 47
SELECT MAX(kerry_number) FROM table_1733457_1 WHERE others_number = 47
CREATE TABLE table_name_61 ( gold VARCHAR, year VARCHAR )
How many gold medals were won in 1970?
SELECT gold FROM table_name_61 WHERE year = "1970"
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, t...
Which courses offered this semester unlock most other classes ?
SELECT COUNT(DISTINCT course_prerequisite.course_id), course.department, course.name, course.number FROM course, course_offering, course_prerequisite, semester WHERE course.course_id = course_offering.course_id AND course.course_id = course_prerequisite.pre_course_id AND course.department = 'EECS' AND semester.semester...
CREATE TABLE table_19897294_10 ( original_air_date VARCHAR, family_families VARCHAR )
When did the episode with the Ririe family air for the first time?
SELECT original_air_date FROM table_19897294_10 WHERE family_families = "The Ririe Family"
CREATE TABLE table_204_525 ( id number, "rank" number, "player" text, "county" text, "tally" text, "total" number, "opposition" text )
how many players are from cork ?
SELECT COUNT("player") FROM table_204_525 WHERE "county" = 'cork'
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description ...
Find all DAML Tagged questions.
SELECT p.Title, p.Id, t.TagName, p.Body FROM Posts AS p, PostTags AS pt, Tags AS t, PostHistory AS ph WHERE t.TagName = 'tornado' AND t.Id = pt.TagId AND pt.PostId = p.Id AND p.Id = ph.PostId
CREATE TABLE table_name_82 ( game INTEGER, date VARCHAR )
What was the game number that was played on November 15?
SELECT MIN(game) FROM table_name_82 WHERE date = "november 15"
CREATE TABLE table_203_794 ( id number, "year" number, "location" text, "attendance" number, "theme phrase" text, "top messages" text, "host" text, "opening general session guest(s)" text, "closing general session guest(s)" text, "sunday night reception" text, "wednesday nigh...
how much more people were in attendance at the orlando lotusphere conference in 2001 than the one in 2004 ?
SELECT (SELECT "attendance" FROM table_203_794 WHERE "year" = 2001) - (SELECT "attendance" FROM table_203_794 WHERE "year" = 2004)
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, ...
how many patients are diagnosed with the primary disease st elevated myocardial infarction or cardiac cath and procedured with icd9 code 7935?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND procedures.icd9_code = "7935"
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE route ( train_id int, station_id int ) CREATE TA...
Compare the number of the local authority by the local authority, and could you show by the total number in ascending?
SELECT local_authority, COUNT(local_authority) FROM station GROUP BY local_authority ORDER BY COUNT(local_authority)
CREATE TABLE table_5892 ( "Rank" real, "Rider" text, "Team" text, "Speed" text, "Time" text )
Which Team has a Time of 1:14.51.73?
SELECT "Team" FROM table_5892 WHERE "Time" = '1:14.51.73'
CREATE TABLE table_42513 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the average number of silver medals of the nation with 3 bronzes and more than 4 total medals?
SELECT AVG("Silver") FROM table_42513 WHERE "Bronze" = '3' AND "Total" > '4'
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTa...
50 top-voted comments for the month of November.
SELECT * FROM Comments WHERE CreationDate BETWEEN '2012-11-01' AND '2012-11-30' ORDER BY Score DESC LIMIT 50
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange ...
Tags ordered by total number of questions.
SELECT DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS SN, COUNT(*) AS Num, Tags.TagName FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON Tags.Id = PostTags.TagId WHERE Posts.PostTypeId = 1 GROUP BY Tags.TagName HAVING COUNT(*) > 100 ORDER BY Num DESC
CREATE TABLE table_name_16 ( rank INTEGER, borough VARCHAR, population VARCHAR )
Which Rank is the lowest one that has a Borough of richmondshire, and a Population larger than 8,178?
SELECT MIN(rank) FROM table_name_16 WHERE borough = "richmondshire" AND population > 8 OFFSET 178
CREATE TABLE table_13500 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
what is the silver when the nation is syria (syr) and gold is more than 0?
SELECT SUM("Silver") FROM table_13500 WHERE "Nation" = 'syria (syr)' AND "Gold" > '0'
CREATE TABLE table_53730 ( "Tie no" real, "Home team" text, "Score" text, "Away team" text, "Attendance" real )
who is the home team when tie no is less than 7 and the away team is havant & waterlooville?
SELECT "Home team" FROM table_53730 WHERE "Tie no" < '7' AND "Away team" = 'havant & waterlooville'
CREATE TABLE table_name_78 ( unanimous VARCHAR, school VARCHAR )
What is the unanimous result of the player from Michigan Dartmouth?
SELECT unanimous FROM table_name_78 WHERE school = "michigan dartmouth"
CREATE TABLE airlines ( alid VARCHAR, name VARCHAR ) CREATE TABLE routes ( alid VARCHAR )
Find the number of different airports which are the destinations of the American Airlines.
SELECT COUNT(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
CREATE TABLE table_74724 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the average crowd at Western Oval?
SELECT AVG("Crowd") FROM table_74724 WHERE "Venue" = 'western oval'
CREATE TABLE table_train_235 ( "id" int, "urinary_protein" float, "nephrotic_range_proteinuria" bool, "hepatic_disease" bool, "estimated_glomerular_filtration_rate_egfr" int, "kidney_disease" bool, "renal_transplantation" bool, "NOUSE" float )
nephrotic range proteinuria ( urinary protein > 3.5 gm / day )
SELECT * FROM table_train_235 WHERE nephrotic_range_proteinuria = 1 OR urinary_protein > 3.5
CREATE TABLE table_37167 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text )
Which school was the drafted player from in a pick larger than 181?
SELECT "School" FROM table_37167 WHERE "Pick" > '181'
CREATE TABLE personfriend ( name text, friend text, year number ) CREATE TABLE person ( name text, age number, city text, gender text, job text )
Find the number of people who is under 40 for each gender.
SELECT COUNT(*), gender FROM person WHERE age < 40 GROUP BY gender
CREATE TABLE table_204_600 ( id number, "name" text, "status" text, "population" number, "district" text, "former local authority" text )
how many people live in the bold civil parish ?
SELECT "population" FROM table_204_600 WHERE "name" = 'bold'
CREATE TABLE table_76239 ( "Rank" real, "Title" text, "Studio" text, "Director" text, "Worldwide Gross" text )
What is the Title of the Film with a Rank greater than 11 and Worldwide Gross of $131,002,597?
SELECT "Title" FROM table_76239 WHERE "Rank" > '11' AND "Worldwide Gross" = '$131,002,597'
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDa...
Last 5 Notable Question Badges in MATLAB Tag.
SELECT DISTINCT CreationDate, Posts.Id AS "post_link", Posts.Tags AS "tagged_with" FROM Posts WHERE (Tags LIKE '%matlab%') ORDER BY CreationDate DESC LIMIT 5
CREATE TABLE table_55734 ( "State" text, "Interview" real, "Swimsuit" real, "Evening gown" real, "Average" real )
What's the lowest average for a swimsuit over 6.89, evening gown over 7.76, and an interview over 8.57 in illinois?
SELECT MIN("Average") FROM table_55734 WHERE "Swimsuit" > '6.89' AND "Evening gown" > '7.76' AND "State" = 'illinois' AND "Interview" > '8.57'
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Which classes are going to be offered over the ensuing 6 semesters ?
SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND se...
CREATE TABLE table_60715 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the average bronze for less than 0 gold?
SELECT AVG("Bronze") FROM table_60715 WHERE "Gold" < '0'
CREATE TABLE table_3477 ( "District" real, "Representative" text, "Party" text, "Residence" text, "First Elected" text, "Term Limited" real )
How many times was Scott Oelslager a representative?
SELECT COUNT("Residence") FROM table_3477 WHERE "Representative" = 'Scott Oelslager'
CREATE TABLE table_name_52 ( fall_08 VARCHAR, fall_06 VARCHAR, fall_05 VARCHAR )
What number is Fall 08 from the state with 57 in Fall 06 and 74 or less in Fall 05?
SELECT COUNT(fall_08) FROM table_name_52 WHERE fall_06 = 57 AND fall_05 < 74
CREATE TABLE invoiceline ( invoicelineid number, invoiceid number, trackid number, unitprice number, quantity number ) CREATE TABLE playlist ( playlistid number, name text ) CREATE TABLE customer ( customerid number, firstname text, lastname text, company text, address ...
What are the duration of the longest and shortest pop tracks in milliseconds?
SELECT MAX(milliseconds), MIN(milliseconds) FROM genre AS T1 JOIN track AS T2 ON T1.genreid = T2.genreid WHERE T1.name = "Pop"
CREATE TABLE table_name_16 ( pommel_horse VARCHAR, rings VARCHAR, total VARCHAR )
How many pommel Horses have Rings of 37.461, and a Total smaller than 229.507?
SELECT COUNT(pommel_horse) FROM table_name_16 WHERE rings = 37.461 AND total < 229.507
CREATE TABLE table_40270 ( "Year" text, "Team" text, "Comp" text, "Long" text, "Rate" text, "RAtt" text, "RYds" text, "RAvg" text, "Lost" text )
What is the RAtt when the long is 73?
SELECT "RAtt" FROM table_40270 WHERE "Long" = '73'
CREATE TABLE table_32004 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the rank of the nation that has more than 1 Bronze medals and fewer than 4 Gold medals?
SELECT MIN("Rank") FROM table_32004 WHERE "Bronze" > '1' AND "Gold" < '4'
CREATE TABLE table_4476 ( "Number" text, "Name" text, "Meaning" text, "Fleet" text, "Launched" text )
when was garibaldets ( ) launched?
SELECT "Launched" FROM table_4476 WHERE "Name" = 'garibaldets (гарибальдиец)'
CREATE TABLE table_name_51 ( nfl_club VARCHAR, player VARCHAR )
What club is robert gallery a part of
SELECT nfl_club FROM table_name_51 WHERE player = "robert gallery"
CREATE TABLE table_name_74 ( year_built VARCHAR, venue VARCHAR )
What year was John m. Belk Arena built?
SELECT year_built FROM table_name_74 WHERE venue = "john m. belk arena"
CREATE TABLE table_13410 ( "Overall points" text, "100 m" text, "400 m" text, "110 m H" text, "1500 m" text )
What is the 100 m time when the 110 m H number is 0 dnf?
SELECT "100 m" FROM table_13410 WHERE "110 m H" = '0 dnf'
CREATE TABLE table_name_70 ( playoffs VARCHAR, year VARCHAR )
What Playoffs were held during the years of 2007-08?
SELECT playoffs FROM table_name_70 WHERE year = "2007-08"
CREATE TABLE table_52205 ( "Rank" real, "Movie" text, "Year" real, "Studio(s)" text, "Third Week Nett. Gross" real )
Tell me the average rank for dharma productions before 2013
SELECT AVG("Rank") FROM table_52205 WHERE "Studio(s)" = 'dharma productions' AND "Year" < '2013'
CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text ) CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text )
Group by the result and count them by a bar chart.
SELECT Result, COUNT(Result) FROM Acceptance GROUP BY Result
CREATE TABLE table_1847523_2 ( affiliation VARCHAR, station VARCHAR )
What station is affiliated with kmgh-tv?
SELECT affiliation FROM table_1847523_2 WHERE station = "KMGH-TV"
CREATE TABLE table_name_64 ( fa_cup VARCHAR, total VARCHAR, play_offs VARCHAR, name VARCHAR )
What's the total number of FA Cup with a Play-offs of 3, and the Name of Mitch Cook Category:Articles with hCards and has a Total thats less than 11?
SELECT COUNT(fa_cup) FROM table_name_64 WHERE play_offs = 3 AND name = "mitch cook category:articles with hcards" AND total < 11
CREATE TABLE table_40385 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text )
What was the score when the opponent in the final was iroda tulyaganova?
SELECT "Score" FROM table_40385 WHERE "Opponent in the final" = 'iroda tulyaganova'
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, ...
retrieve the patient identifications who have been diagnosed with pituitary cushing syndrome until 1 year ago.
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'pituitary cushing syndrome' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year'))
CREATE TABLE table_name_55 ( post_season_record_ VARCHAR, e_ VARCHAR, mlb_affiliate VARCHAR )
Tell me the post-season record for kansas city
SELECT post_season_record_ AS "e_" FROM table_name_55 WHERE mlb_affiliate = "kansas city"
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
what is the cost of the hdl lab test?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = 'hdl')
CREATE TABLE table_22384475_1 ( team__a_ VARCHAR, margin VARCHAR )
How many games were won by a margin of 131 runs?
SELECT COUNT(team__a_) FROM table_22384475_1 WHERE margin = "131 runs"
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varch...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of job_id and salary , and could you order Y-axis in ascending order?
SELECT JOB_ID, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY
CREATE TABLE table_name_69 ( roll VARCHAR, name VARCHAR, decile VARCHAR, authority VARCHAR )
What is the roll of Bishop Viard College (An Integrated College), which has a decile larger than 1?
SELECT COUNT(roll) FROM table_name_69 WHERE decile > 1 AND authority = "integrated" AND name = "bishop viard college"
CREATE TABLE table_9761 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What is the Result of the AFG Arena, St. Gallen Competition with a Score of 1 0?
SELECT "Result" FROM table_9761 WHERE "Venue" = 'afg arena, st. gallen' AND "Score" = '1–0'
CREATE TABLE table_name_88 ( structure VARCHAR, country VARCHAR )
What structure is in Chile?
SELECT structure FROM table_name_88 WHERE country = "chile"
CREATE TABLE table_name_48 ( pop__2004_ INTEGER, governorate VARCHAR )
How many Pop (2004) has a Governorate of al mahwit?
SELECT SUM(pop__2004_) FROM table_name_48 WHERE governorate = "al mahwit"
CREATE TABLE invoices ( billing_country VARCHAR, total INTEGER )
A list of the top 10 countries by average invoice size. List country name and average invoice size.
SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
CREATE TABLE table_name_52 ( result VARCHAR, goals VARCHAR )
I want the result for goals which has goals of deacon 6/6
SELECT result FROM table_name_52 WHERE goals = "deacon 6/6"
CREATE TABLE table_26202940_6 ( no VARCHAR, score_in_the_final VARCHAR )
How many numbers correspond to the score in the final of 6 3, 6 4, 7 6 (13 11)?
SELECT COUNT(no) FROM table_26202940_6 WHERE score_in_the_final = "6–3, 6–4, 7–6 (13–11)"
CREATE TABLE Ref_Incident_Type ( incident_type_code VARCHAR(10), incident_type_description VARCHAR(80) ) CREATE TABLE Student_Addresses ( student_id INTEGER, address_id INTEGER, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL(19,4), other_details VARCHAR(255...
Show me about the distribution of date_address_to and the average of monthly_rental , and group by attribute other_details and bin date_address_to by weekday in a bar chart.
SELECT date_address_to, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int )
Give me a bar chart to show the theme and their sales of the journal which did not have any of the listed editors serving on the committee, rank in descending by the x axis.
SELECT T1.Theme, T1.Sales FROM journal EXCEPT SELECT T1.Date, T1.Theme, T1.Sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.Journal_ID = T2.Journal_ID ORDER BY T1.Theme DESC
CREATE TABLE table_38250 ( "Election" text, "D\u00e1il" text, "Share of votes" text, "Seats" real, "Government" text )
How many seats does the 6th Dail have?
SELECT COUNT("Seats") FROM table_38250 WHERE "D\u00e1il" = '6th'
CREATE TABLE table_name_23 ( bats VARCHAR, first VARCHAR )
Which bats did mitchell play first?
SELECT bats FROM table_name_23 WHERE first = "mitchell"
CREATE TABLE table_45843 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What was the score of the game when Sheffield Wednesday was the home team?
SELECT "Score" FROM table_45843 WHERE "Home team" = 'sheffield wednesday'
CREATE TABLE table_203_450 ( id number, "team" text, "outgoing manager" text, "manner of departure" text, "date of vacancy" text, "replaced by" text, "date of appointment" text, "position in table" text )
what team is listed after manchester city ?
SELECT "team" FROM table_203_450 WHERE id = (SELECT id FROM table_203_450 WHERE "team" = 'manchester city') + 1
CREATE TABLE table_1745843_2 ( part_4 VARCHAR, part_2 VARCHAR )
For part 2 *lauk, what is listed for part 4?
SELECT part_4 FROM table_1745843_2 WHERE part_2 = "*lauk"
CREATE TABLE table_26638600_3 ( lites_2_race_one_winning_team VARCHAR, lites_1_race_two_winning_team VARCHAR )
How many different circuits had Gary Gibson has the Lites 1 race two winning team?
SELECT COUNT(lites_2_race_one_winning_team) FROM table_26638600_3 WHERE lites_1_race_two_winning_team = "Gary Gibson"
CREATE TABLE table_15187735_13 ( segment_b VARCHAR, episode VARCHAR )
Name the segment b for 167
SELECT segment_b FROM table_15187735_13 WHERE episode = 167
CREATE TABLE table_2226817_9 ( no_in_season INTEGER, no_in_series VARCHAR )
How many seasons had episode 158?
SELECT MIN(no_in_season) FROM table_2226817_9 WHERE no_in_series = 158
CREATE TABLE table_34846 ( "Tournament" text, "1981" text, "1982" text, "1983" text, "1984" text, "1985" text, "1986" text, "1987" text, "1988" text, "1989" text )
Which Tournament has A in 1987?
SELECT "Tournament" FROM table_34846 WHERE "1987" = 'a'
CREATE TABLE table_79523 ( "Date" text, "Internet Explorer" text, "Firefox" text, "Safari" text, "Opera" text )
What is the safari value with a 2.4% opera and 29.9% internet explorer?
SELECT "Safari" FROM table_79523 WHERE "Opera" = '2.4%' AND "Internet Explorer" = '29.9%'
CREATE TABLE table_29232 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text )
Who is the replaced by when the date of vacancy is 27 december 2010?
SELECT "Replaced by" FROM table_29232 WHERE "Date of vacancy" = '27 December 2010'
CREATE TABLE table_name_12 ( pick VARCHAR, nhl_team VARCHAR )
Tell me the pick for pittsburgh penguins
SELECT pick FROM table_name_12 WHERE nhl_team = "pittsburgh penguins"
CREATE TABLE table_name_89 ( date VARCHAR, record VARCHAR )
What was the date of the game when the record was 53 104?
SELECT date FROM table_name_89 WHERE record = "53–104"
CREATE TABLE table_204_983 ( id number, "year" number, "1st venue" text, "2nd venue" text, "3rd venue" text, "4th venue" text, "5th venue" text, "6th venue" text )
name a year whose second venue was the same as 2011 .
SELECT "year" FROM table_204_983 WHERE "year" <> 2011 AND "2nd venue" = (SELECT "2nd venue" FROM table_204_983 WHERE "year" = 2011)
CREATE TABLE diagnoses ( 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 ) C...
how many patients are with admission year before 2194 and with lab test item id 50817?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2194" AND lab.itemid = "50817"
CREATE TABLE table_34513 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" text )
Record of 6 8 had what attendance?
SELECT "Attendance" FROM table_34513 WHERE "Record" = '6–8'
CREATE TABLE table_name_86 ( rank VARCHAR, ø_pts VARCHAR, games VARCHAR )
What was the rank for 1.26 -Pts in game 1458?
SELECT COUNT(rank) FROM table_name_86 WHERE ø_pts > 1.26 AND games = 1458
CREATE TABLE table_204_932 ( id number, "#" number, "title" text, "time" text, "lead vocals" text, "notes" text )
how long is the song i love you jesus ?
SELECT "time" FROM table_204_932 WHERE "title" = 'i love you jesus'
CREATE TABLE table_name_89 ( rebounds VARCHAR, name VARCHAR )
How many rebounds does Ann Wauters have?
SELECT COUNT(rebounds) FROM table_name_89 WHERE name = "ann wauters"
CREATE TABLE table_31361 ( "Subject" text, "No. Sat" real, "No. Passed" real, "% Pass" real, "Highest mark" real, "Lowest mark" real, "Mean" real )
How many lowest mark entries are there when % passed is 76?
SELECT COUNT("Lowest mark") FROM table_31361 WHERE "% Pass" = '76'