instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
For those employees who did not have any job in the past, give me the comparison about the average of department_id over the hire_date bin hire_date by time.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
What is the average rank of the company with more than 146.56 billion in sales and profits of 11.68 billions?
CREATE TABLE table_name_97 (rank INTEGER,sales__billion_$_ VARCHAR,profits__billion_$_ VARCHAR)
SELECT AVG(rank) FROM table_name_97 WHERE sales__billion_$_ > 146.56 AND profits__billion_$_ = 11.68
Name the least ends lost for jo lle belley (glenmore)
CREATE TABLE table_31202 ("Skip (Club)" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real)
SELECT MIN("Ends Lost") FROM table_31202 WHERE "Skip (Club)" = 'Joëlle Belley (Glenmore)'
What countries have had eruptions of growth episodes in 1986?
CREATE TABLE table_106 ("Name of lava dome" text,"Country" text,"Volcanic area" text,"Composition" text,"Last eruption or growth episode" text)
SELECT "Country" FROM table_106 WHERE "Last eruption or growth episode" = '1986'
Who was the winning team at the Homestead-Miami Speedway?
CREATE TABLE table_name_74 (winning_team VARCHAR,circuit VARCHAR)
SELECT winning_team FROM table_name_74 WHERE circuit = "homestead-miami speedway"
College of san diego state, and a Pick # smaller than 30 has what lowest overall?
CREATE TABLE table_name_46 (overall INTEGER,college VARCHAR,pick__number VARCHAR)
SELECT MIN(overall) FROM table_name_46 WHERE college = "san diego state" AND pick__number < 30
Give me a histogram for what are the names and ids of the tourist attractions that are visited at most once?, and sort Name in asc order.
CREATE TABLE Street_Markets (Market_ID INTEGER,Market_Details VARCHAR(255))CREATE TABLE Ref_Attraction_Types (Attraction_Type_Code CHAR(15),Attraction_Type_Description VARCHAR(255))CREATE TABLE Tourist_Attraction_Features (Tourist_Attraction_ID INTEGER,Feature_ID INTEGER)CREATE TABLE Ref_Hotel_Star_Ratings (star_rating...
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Name
For those employees who was hired before 2002-06-21, find hire_date and the average of salary bin hire_date by weekday, and visualize them by a bar chart, display in descending by the Y-axis please.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID d...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC
How many sets were played in the 2011 Tournament in which there were 3R in 2007?
CREATE TABLE table_name_81 (Id VARCHAR)
SELECT 2011 FROM table_name_81 WHERE 2007 = "3r"
What are the names of students who haven't taken any Biology courses?
CREATE TABLE course (course_id text,title text,dept_name text,credits number)CREATE TABLE time_slot (time_slot_id text,day text,start_hr number,start_min number,end_hr number,end_min number)CREATE TABLE teaches (id text,course_id text,sec_id text,semester text,year number)CREATE TABLE section (course_id text,sec_id tex...
SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')
who placed first in the 2006 asian games finals ??
CREATE TABLE table_204_937 (id number,"rank" number,"lane" number,"athlete" text,"time" number)
SELECT "athlete" FROM table_204_937 WHERE id = 1
Which Placings have a Nation of west germany, and Points larger than 303.72?
CREATE TABLE table_name_31 (placings INTEGER,nation VARCHAR,points VARCHAR)
SELECT SUM(placings) FROM table_name_31 WHERE nation = "west germany" AND points > 303.72
What is the roll number of Te Puke Intermediate, which has a decile of 4?
CREATE TABLE table_name_62 (roll VARCHAR,decile VARCHAR,name VARCHAR)
SELECT roll FROM table_name_62 WHERE decile = 4 AND name = "te puke intermediate"
Who was the 1st member that was elected in 1541/42?
CREATE TABLE table_name_44 (elected VARCHAR)
SELECT 1 AS st_member FROM table_name_44 WHERE elected = "1541/42"
who is the youngest female , but not the youngest overall on the show cha $ e ?
CREATE TABLE table_203_446 (id number,"name" text,"gender" text,"age" number,"from" text,"occupation" text,"prize money (usd)" text,"status" text)
SELECT "name" FROM table_203_446 WHERE "gender" = 'female' ORDER BY "age" LIMIT 1
When were the shares 39.1%?
CREATE TABLE table_61772 ("Show" text,"Date" text,"Official ratings (millions)" real,"Weekly rank" text,"Share" text)
SELECT "Date" FROM table_61772 WHERE "Share" = '39.1%'
which numbers were not withdrawn from service in 1957 ?
CREATE TABLE table_204_882 (id number,"number" number,"builder" text,"entered service" text,"withdrawn" text,"notes" text)
SELECT "number" FROM table_204_882 WHERE "withdrawn" <> 1957
How many picks had less than 11 rounds and a player of Charley Casey?
CREATE TABLE table_name_29 (pick INTEGER,round VARCHAR,player VARCHAR)
SELECT SUM(pick) FROM table_name_29 WHERE round < 11 AND player = "charley casey"
What engine doe the Ed Carpenter Racing team use?
CREATE TABLE table_3204 ("Team" text,"#" real,"Car Sponsor(s)" text,"Driver(s)" text,"Listed Owner(s)" text,"Engine" text,"Chassis" text)
SELECT "Engine" FROM table_3204 WHERE "Team" = 'Ed Carpenter Racing'
What is the socket for the processor with part number ADH2350IAA5DO?
CREATE TABLE table_6090 ("Model Number" text,"Stepping" text,"Frequency" text,"L2 Cache" text,"Multi 1" text,"V Core" text,"Socket" text,"Release Date" text,"Part Number(s)" text)
SELECT "Socket" FROM table_6090 WHERE "Part Number(s)" = 'adh2350iaa5do'
What loss has 26-9 as a loss?
CREATE TABLE table_74862 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Loss" FROM table_74862 WHERE "Record" = '26-9'
how many strokes was isao aoki behind larry nelson ?
CREATE TABLE table_203_555 (id number,"place" text,"player" text,"country" text,"score" text,"to par" number,"money ($)" number)
SELECT (SELECT "to par" FROM table_203_555 WHERE "player" = 'isao aoki') - (SELECT "to par" FROM table_203_555 WHERE "player" = 'larry nelson')
What school or team has round of 2 with less than 42 picks?
CREATE TABLE table_54351 ("Round" real,"Pick" real,"Player" text,"Position" text,"Nationality" text,"School/Club Team" text)
SELECT "School/Club Team" FROM table_54351 WHERE "Round" = '2' AND "Pick" < '42'
For employees with first names that end with the letter m, groups and count the first name to visualize a bar graph, and could you rank total number in ascending order please?
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 jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE loc...
SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY COUNT(FIRST_NAME)
What are the memories and carriers of phones, show in ascending by the sum memory in g.
CREATE TABLE phone_market (Market_ID int,Phone_ID text,Num_of_stock int)CREATE TABLE phone (Name text,Phone_ID int,Memory_in_G int,Carrier text,Price real)CREATE TABLE market (Market_ID int,District text,Num_of_employees int,Num_of_shops real,Ranking int)
SELECT Carrier, SUM(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY SUM(Memory_in_G)
What is the lowest round Trinity school was drafted with an overall higher than 21?
CREATE TABLE table_name_89 (round INTEGER,school_club_team VARCHAR,overall VARCHAR)
SELECT MIN(round) FROM table_name_89 WHERE school_club_team = "trinity" AND overall < 21
What year did the team based in the city of Winamac join the conference?
CREATE TABLE table_name_6 (year_joined VARCHAR,city VARCHAR)
SELECT year_joined FROM table_name_6 WHERE city = "winamac"
what is the college/junior/club team for the player alfie turcotte?
CREATE TABLE table_29007 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text)
SELECT "College/junior/club team" FROM table_29007 WHERE "Player" = 'Alfie Turcotte'
What is the phone number of the performer Ashley?
CREATE TABLE PERFORMERS (Customer_Phone VARCHAR,Customer_Name VARCHAR)
SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = "Ashley"
how many peaks in the dolomites are above 10,000 feet ?
CREATE TABLE table_202_80 (id number,"name" text,"metres" number,"feet" number)
SELECT COUNT(*) FROM table_202_80 WHERE "feet" >= 10000
What was the result of the election featuring incumbent norman sisisky?
CREATE TABLE table_1341423_46 (results VARCHAR,incumbent VARCHAR)
SELECT results FROM table_1341423_46 WHERE incumbent = "Norman Sisisky"
who has papers at NIPS ?
CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE cite (citingpaperid int,citedpaperid int)CREATE TABLE writes (paperid int,autho...
SELECT DISTINCT writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'NIPS' AND writes.paperid = paper.paperid
Which Place has a Country of united states, and a Money ($) larger than 0, and a Player of craig wood?
CREATE TABLE table_60311 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "Place" FROM table_60311 WHERE "Country" = 'united states' AND "Money ( $ )" > '0' AND "Player" = 'craig wood'
count the number of patients who were admitted before the year 2150 with the lab test category blood gas.
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 procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2150" AND lab."CATEGORY" = "Blood Gas"
Which circuit did fran ois eysermann win ?
CREATE TABLE table_name_54 (circuit VARCHAR,winning_driver VARCHAR)
SELECT circuit FROM table_name_54 WHERE winning_driver = "françois eysermann"
What was the result with West Ham United with more than 67,577 in attendance?
CREATE TABLE table_68247 ("Date" text,"Opponents" text,"Result F\u2013A" text,"Attendance" real,"League position" text)
SELECT "Result F\u2013A" FROM table_68247 WHERE "Attendance" > '67,577' AND "Opponents" = 'west ham united'
What is Ivan Ciernik's average points with less than 11 goals?
CREATE TABLE table_name_29 (points INTEGER,player VARCHAR,goals VARCHAR)
SELECT AVG(points) FROM table_name_29 WHERE player = "ivan ciernik" AND goals < 11
patient 027-136480 received the procedure of pulmonary resection - tumor in other hospitals since 2105?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatment...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '027-136480' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '027-136480' AND patient.hospitaldischargetime IS NULL)) AND ...
What is the time/retired for phil hill with over 67 laps and a grad smaller than 18?
CREATE TABLE table_78377 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_78377 WHERE "Laps" > '67' AND "Grid" < '18' AND "Driver" = 'phil hill'
What is the entry number on the list for Fairfield Moravian Church?
CREATE TABLE table_name_13 (list_entry_number VARCHAR,name VARCHAR)
SELECT list_entry_number FROM table_name_13 WHERE name = "fairfield moravian church"
give me some restaurants good for arabic food in mountain view ?
CREATE TABLE geographic (city_name varchar,county varchar,region varchar)CREATE TABLE restaurant (id int,name varchar,food_type varchar,city_name varchar,rating "decimal)CREATE TABLE location (restaurant_id int,house_number int,street_name varchar,city_name varchar)
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
Who is the player from the United States with a score of 71-75=146?
CREATE TABLE table_name_24 (player VARCHAR,country VARCHAR,score VARCHAR)
SELECT player FROM table_name_24 WHERE country = "united states" AND score = 71 - 75 = 146
What is the episode number of the episode with a production code of 4aky14?
CREATE TABLE table_29043 ("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 (millions)" text)
SELECT "No. in season" FROM table_29043 WHERE "Production code" = '4AKY14'
what is the procedure, which patient 51200 underwent two times the last month?
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_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE diagnoses_icd (row_id n...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 512...
What is the founding date if the letters are ?
CREATE TABLE table_27650 ("Letters" text,"Organization" text,"Nickname" text,"Founding Date" text,"Founding University" text,"Type" text)
SELECT "Founding Date" FROM table_27650 WHERE "Letters" = 'ΚΨΚ'
has patient 60136 been prescribed amlodipine besylate this year.
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime 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,ro...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 60136) AND prescriptions.drug = 'amlodipine besylate' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
List a user's rejected suggested edits. List all the rejected suggested edits proposed by a given user.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance te...
SELECT 'site://suggested-edits/' + CAST(s.Id AS TEXT(20)) + '|' + CASE LENGTH(LTRIM(s.Comment)) WHEN 0 THEN 'none' ELSE s.Comment END AS "suggested_edit", s.PostId AS "post_link", s.CreationDate AS "creation_date", s.RejectionDate AS "rejection_date" FROM SuggestedEdits AS s WHERE s.OwnerUserId = '##UserId##' AND NOT s...
what is the daily maximum value of patient 011-35642's base excess until 30 months ago?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname...
SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-35642')) AND lab.labname = 'base excess' AND DATETIME(lab.labresulttime) <= DA...
provide the number of patients whose year of birth is less than 2047 and lab test fluid is cerebrospinal fluid (csf)?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2047" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
how many days has it been since last time patient 025-50213 was prescribed dextrose 50% 25 gram/50 ml syr during this hospital encounter?
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 number,chargetime time,cost number)CREATE TABLE intakeoutput (intak...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-502...
What was the highest guard picked?
CREATE TABLE table_name_50 (pick INTEGER,position VARCHAR)
SELECT MAX(pick) FROM table_name_50 WHERE position = "guard"
what was the last output that patient 23042 has had until 11/06/2104?
CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,lin...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23042)) AND STRFTIME('%y-%m-%d', outputeve...
What is number 21's highest time?
CREATE TABLE table_name_24 (time INTEGER,number VARCHAR)
SELECT MAX(time) FROM table_name_24 WHERE number = 21
What's the total for a league cup less than 1?
CREATE TABLE table_67603 ("Name" text,"League" real,"Play-offs" real,"FA Cup" real,"League Cup" real,"Total" real)
SELECT COUNT("League Cup") FROM table_67603 WHERE "Total" < '1'
give me patient 013-12480's length of stay of his first stay in the icu.
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 number,chargetime time,cost number)CREATE TABLE lab (labid number,p...
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-12480') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
Which country does Adam Scott play for?
CREATE TABLE table_38635 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Country" FROM table_38635 WHERE "Player" = 'adam scott'
Name the first aired with money requested more than 85,000
CREATE TABLE table_name_86 (first_aired VARCHAR,money_requested__£_ INTEGER)
SELECT first_aired FROM table_name_86 WHERE money_requested__£_ > 85 OFFSET 000
What is the spoofed title for Parks and Recreation with an issue larger than 509?
CREATE TABLE table_43353 ("Spoofed Title" text,"Actual Title" text,"Writer" text,"Artist" text,"Issue" real)
SELECT "Spoofed Title" FROM table_43353 WHERE "Issue" > '509' AND "Actual Title" = 'parks and recreation'
are there any results of patient 031-3355's microbiological test on the first hospital visit?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patient...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
what is the only organization whose treaties morocco has signed ?
CREATE TABLE table_203_109 (id number,"treaty" text,"organization" text,"introduced" number,"signed" number,"ratified" number)
SELECT DISTINCT "organization" FROM table_203_109 WHERE NOT "signed" IS NULL
What are the names of the countries and average invoice size of the top countries by size.
CREATE TABLE employees (id INTEGER,last_name VARCHAR(20),first_name VARCHAR(20),title VARCHAR(30),reports_to INTEGER,birth_date TIMESTAMP,hire_date TIMESTAMP,address VARCHAR(70),city VARCHAR(40),state VARCHAR(40),country VARCHAR(40),postal_code VARCHAR(10),phone VARCHAR(24),fax VARCHAR(24),email VARCHAR(60))CREATE TABL...
SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
What are the ids of documents with letter 's' in the name with any expense budgets.
CREATE TABLE ref_budget_codes (budget_type_code text,budget_type_description text)CREATE TABLE documents (document_id number,document_type_code text,project_id number,document_date time,document_name text,document_description text,other_details text)CREATE TABLE accounts (account_id number,statement_id number,account_d...
SELECT T1.document_id FROM documents AS T1 JOIN documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'
What are the types of vocals used in the song 'Le Pop'?
CREATE TABLE albums (aid number,title text,year number,label text,type text)CREATE TABLE instruments (songid number,bandmateid number,instrument text)CREATE TABLE tracklists (albumid number,position number,songid number)CREATE TABLE vocals (songid number,bandmate number,type text)CREATE TABLE performance (songid number...
SELECT type FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = "Le Pop"
what were the four most frequently ordered laboratory tests for patients who had been diagnosed with respiratory acidosis - acute previously within 2 months, in this year?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,discha...
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory acidosis - acute' AND DATETIME(diagnosis...
Users from a given place ranked by Rep.
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 CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwne...
SELECT U.Id AS "user_link", U.Location, U.Age, U.Reputation, SUM(U.Reputation) / P."number_of_posts" AS "average_reputation_per_post" FROM Users AS U JOIN (SELECT OwnerUserId, COUNT(*) AS "number_of_posts" FROM Posts GROUP BY OwnerUserId) AS P ON U.Id = P.OwnerUserId WHERE U.Location LIKE '%##Location##' GROUP BY U.Id,...
What is the date the high rebounds were by lamarcus aldridge (6)?
CREATE TABLE table_29903 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Date" FROM table_29903 WHERE "High rebounds" = 'LaMarcus Aldridge (6)'
Give me a histogram for what are the different names and credit scores of customers who have taken a loan?, and sort in descending by the cust_name.
CREATE TABLE loan (loan_ID varchar(3),loan_type varchar(15),cust_ID varchar(3),branch_ID varchar(3),amount int)CREATE TABLE customer (cust_ID varchar(3),cust_name varchar(20),acc_type char(1),acc_bal int,no_of_loans int,credit_score int,branch_ID int,state varchar(20))CREATE TABLE bank (branch_ID int,bname varchar(20),...
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID ORDER BY cust_name DESC
What is the original airdate of the episode that had 8.23 million viewers?
CREATE TABLE table_3482 ("Episode #" real,"Series #" real,"Title" text,"Director" text,"Writer" text,"Original airdate" text,"Viewers (in millions)" text)
SELECT "Original airdate" FROM table_3482 WHERE "Viewers (in millions)" = '8.23'
what was the total hospital bill of patient 29611's stay on their last hospital encounter?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title 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 text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id numb...
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29611 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)
What is the original title where Paul Verhoeven is the director?
CREATE TABLE table_name_42 (original_title VARCHAR,director VARCHAR)
SELECT original_title FROM table_name_42 WHERE director = "paul verhoeven"
What team was the player that received a penalty at time 32:17 playing for?
CREATE TABLE table_name_13 (team VARCHAR,time VARCHAR)
SELECT team FROM table_name_13 WHERE time = "32:17"
Name the number of locations for geneva college
CREATE TABLE table_28470 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Enrollment" real,"Joined" real)
SELECT COUNT("Location") FROM table_28470 WHERE "Institution" = 'Geneva College'
What is the highest rank with less than 2 bronze, more than 1 gold, and less than 1 silver?
CREATE TABLE table_name_35 (rank INTEGER,silver VARCHAR,bronze VARCHAR,gold VARCHAR)
SELECT MAX(rank) FROM table_name_35 WHERE bronze < 2 AND gold > 1 AND silver < 1
Who was the visitor when phoenix was at home?
CREATE TABLE table_53986 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Visitor" FROM table_53986 WHERE "Home" = 'phoenix'
Where is Cameron Beckman's rank on the money list?
CREATE TABLE table_29499399_2 (money_list_rank VARCHAR,player VARCHAR)
SELECT money_list_rank FROM table_29499399_2 WHERE player = "Cameron Beckman"
who published the most at chi
CREATE TABLE writes (paperid int,authorid int)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE cite (citingpaperid int,citedpape...
SELECT DISTINCT COUNT(DISTINCT paper.paperid), writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'chi' AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(DISTINCT paper.paperid) DESC
What are the results for Bill Shuster?
CREATE TABLE table_name_71 (results VARCHAR,incumbent VARCHAR)
SELECT results FROM table_name_71 WHERE incumbent = "bill shuster"
What are the most popular first 3 words in question titles?.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time...
SELECT SUBSTRING(p.Title, 1, STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ') + 1) + 1)) AS First3Words, COUNT(DISTINCT p.Id) AS Questions, AVG(p.Score) AS AvgScore FROM dbo.Posts AS p WHERE p.PostTypeId = 1 AND STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ...
how many times have I said 'pivot table'?.
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,CreationDate time,DeletionDate time,Score number,ViewCount number,Body te...
SELECT 'Pivot Table comments' AS pType, UserId AS "user_link", COUNT(Id) AS numMentions FROM Comments WHERE UserId IN ('##UserID##') AND Text LIKE '%pivot table%' COLLATE SQL_Latin1_General_CP1_CI_AS GROUP BY UserId UNION SELECT 'Pivot Table posts' AS pType, OwnerUserId AS "user_link", COUNT(Id) AS numMentions FROM Pos...
Total number of comments that contains keyword by year and month.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwner...
SELECT CAST(YEAR(CreationDate) AS TEXT(4)) + '-' + RIGHT('00' + CAST(MONTH(CreationDate) AS TEXT(2)), 2) AS year_month, COUNT(*) AS total FROM Comments WHERE (UPPER(Text) LIKE '%DEVOPS%') GROUP BY CAST(YEAR(CreationDate) AS TEXT(4)) + '-' + RIGHT('00' + CAST(MONTH(CreationDate) AS TEXT(2)), 2) ORDER BY CAST(YEAR(Creati...
What is the average grid for johnny dumfries with less than 8 laps?
CREATE TABLE table_name_26 (grid INTEGER,driver VARCHAR,laps VARCHAR)
SELECT AVG(grid) FROM table_name_26 WHERE driver = "johnny dumfries" AND laps < 8
Plot the number of result by grouped by result as a bar graph, and I want to rank from high to low by the X.
CREATE TABLE artist (Artist_ID int,Artist text,Age int,Famous_Title text,Famous_Release_date text)CREATE TABLE volume (Volume_ID int,Volume_Issue text,Issue_Date text,Weeks_on_Top real,Song text,Artist_ID int)CREATE TABLE music_festival (ID int,Music_Festival text,Date_of_ceremony text,Category text,Volume int,Result t...
SELECT Result, COUNT(Result) FROM music_festival GROUP BY Result ORDER BY Result DESC
what was the four most frequently taken lab tests until 3 years ago for patients 60 or above?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE patients (row_id number,subject...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(labevents.charttime) <= DATET...
Plot season by how many season as a line chart, and could you rank by the X from high to low please?
CREATE TABLE game (stadium_id int,id int,Season int,Date text,Home_team text,Away_team text,Score text,Competition text)CREATE TABLE injury_accident (game_id int,id int,Player text,Injury text,Number_of_matches text,Source text)CREATE TABLE stadium (id int,name text,Home_Games int,Average_Attendance real,Total_Attendan...
SELECT Season, COUNT(Season) FROM game ORDER BY Season DESC
Which player is T3?
CREATE TABLE table_name_70 (player VARCHAR,place VARCHAR)
SELECT player FROM table_name_70 WHERE place = "t3"
What is the System when the Licence is gpl and the Current Version is 1.72?
CREATE TABLE table_55981 ("Name" text,"Current version" text,"System" text,"Platform" text,"License" text)
SELECT "System" FROM table_55981 WHERE "License" = 'gpl' AND "Current version" = '1.72'
What is the name of gao chiappe meng o'connor wang cheng liu?
CREATE TABLE table_name_99 (name VARCHAR,authors VARCHAR)
SELECT name FROM table_name_99 WHERE authors = "gao chiappe meng o'connor wang cheng liu"
What is the average points earned for entrants with ATS V8 engines?
CREATE TABLE table_name_12 (points INTEGER,engine VARCHAR)
SELECT AVG(points) FROM table_name_12 WHERE engine = "ats v8"
What was the AB team's position in table?
CREATE TABLE table_27782699_3 (position_in_table VARCHAR,team VARCHAR)
SELECT position_in_table FROM table_27782699_3 WHERE team = "AB"
What was the poll source that showed Democrat: John Lynch at 62% and had a lead margin of less than 33?
CREATE TABLE table_9675 ("Poll Source" text,"Dates administered" text,"Democrat: John Lynch" text,"Republican: Joe Kenney" text,"Lead Margin" real)
SELECT "Poll Source" FROM table_9675 WHERE "Lead Margin" < '33' AND "Democrat: John Lynch" = '62%'
Which seasons have fernando alonso as the driver?
CREATE TABLE table_5443 ("Driver" text,"Seasons" text,"Entries" real,"3rd places" real,"Percentage" text)
SELECT "Seasons" FROM table_5443 WHERE "Driver" = 'fernando alonso'
What is the smallest number of Total Goals?
CREATE TABLE table_10240125_1 (total_goals INTEGER)
SELECT MIN(total_goals) FROM table_10240125_1
What is the English title of the film from 2001?
CREATE TABLE table_71642 ("Year" real,"English title" text,"Original title" text,"Country" text,"Director(s)" text)
SELECT "English title" FROM table_71642 WHERE "Year" = '2001'
What is the fewest number of places for a skater from Norway with fewer than 1524.9 points?
CREATE TABLE table_37491 ("Rank" real,"Name" text,"Nation" text,"Points" real,"Places" real)
SELECT MIN("Places") FROM table_37491 WHERE "Nation" = 'norway' AND "Points" < '1524.9'
when was the episode guest starring michael mcintyre and alex james broadcasted
CREATE TABLE table_30968 ("Episode" real,"Broadcast date" text,"Guest(s)" text,"Singer(s)" text,"Ratings" text)
SELECT "Broadcast date" FROM table_30968 WHERE "Guest(s)" = 'Michael McIntyre and Alex James'
select * from Posts where tags like '%android%' and tags like '%material-design%.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Users (Id number,Reputation number...
SELECT * FROM Posts AS p JOIN Posts AS a ON a.Id = p.ParentId WHERE a.Tags LIKE '%material-design%' AND a.Tags LIKE '%android%' AND a.AnswerCount > 0
What is the percent yes of Nova Scotia, which had more than 2,410,119 vote yes and less than 51.3 vote no?
CREATE TABLE table_11111 ("Jurisdiction" text,"Voted Yes" real,"Percent Yes" real,"Voted No" real,"Percent No" real)
SELECT COUNT("Percent Yes") FROM table_11111 WHERE "Voted Yes" > '2,410,119' AND "Jurisdiction" = 'nova scotia' AND "Percent No" < '51.3'
What is the total number of overall picks that were after pick 9 and went to Auburn College?
CREATE TABLE table_name_48 (overall VARCHAR,college VARCHAR,pick VARCHAR)
SELECT COUNT(overall) FROM table_name_48 WHERE college = "auburn" AND pick > 9
What is the copa mercosur 1999 result for team gr mio, who did not qualify for the Copa Libertadores 1999 and Copa Conmebol 1999?
CREATE TABLE table_39173 ("Team" text,"Copa Libertadores 1999" text,"Copa Mercosur 1999" text,"Copa CONMEBOL 1999" text,"Intercontinental Cup 1999" text)
SELECT "Copa Mercosur 1999" FROM table_39173 WHERE "Copa Libertadores 1999" = 'did not qualify' AND "Copa CONMEBOL 1999" = 'did not qualify' AND "Team" = 'grêmio'
Who has a length of 71 ft?
CREATE TABLE table_name_21 (name VARCHAR,length__ft_ VARCHAR)
SELECT name FROM table_name_21 WHERE length__ft_ = 71