db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
works_cycles
select sum(case when t2.productline = 'm' then 1 else 0 end) from productreview as t1 inner join product as t2 on t1.productid = t2.productid group by t1.productid having count(t1.productreviewid) > 1
Question: among the products that get over at least 1 review, how many of them are from the mountain product line? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Currenc...
among the products that get over at least 1 review, how many of them are from the mountain product line?
works_cycles
select t1.emailaddress from productreview as t1 inner join product as t2 on t1.productid = t2.productid where t2.name = 'hl mountain pedal' order by t1.rating limit 1
Question: please list the email adresses of the reviewers who have given the lowest rating to the product hl mountain pedal. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCod...
please list the email adresses of the reviewers who have given the lowest rating to the product hl mountain pedal.
works_cycles
select count(t2.productid) from productvendor as t1 inner join product as t2 on t1.productid = t2.productid where t1.onorderqty is null or t1.onorderqty = 0
Question: how many products that take more than 2 days to make are out of stock? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bus...
how many products that take more than 2 days to make are out of stock?
works_cycles
select t2.name from productvendor as t1 inner join product as t2 on t1.productid = t2.productid where t2.makeflag = 0 and (t1.onorderqty is null or t1.onorderqty = 0)
Question: please list the products that are out of stock and purchased in house. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bus...
please list the products that are out of stock and purchased in house.
works_cycles
select sum(case when t2.productline = 'm' then 1 else 0 end) from productreview as t1 inner join product as t2 on t1.productid = t2.productid where t2.finishedgoodsflag = 1 group by t1.productid order by count(t1.productreviewid) desc limit 1
Question: among the salable products from the mountain product line, how many of them have the most reviews? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode,...
among the salable products from the mountain product line, how many of them have the most reviews?
works_cycles
select sum(t1.standardprice) / count(t1.businessentityid) from productvendor as t1 inner join product as t2 on t1.productid = t2.productid where t2.name = 'hex nut 5'
Question: what is the average selling price of different vendors of the product hex nut 5? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Per...
what is the average selling price of different vendors of the product hex nut 5?
works_cycles
select t2.name from productreview as t1 inner join product as t2 on t1.productid = t2.productid where t2.productline = 'm' group by t2.name order by cast(sum(t1.rating) as real) / count(t1.productid) desc limit 1
Question: what is the product that has the highest average rating from the mountain product line? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDa...
what is the product that has the highest average rating from the mountain product line?
works_cycles
select t2.name from productreview as t1 inner join product as t2 on t1.productid = t2.productid where t2.makeflag = 1 group by t2.name order by sum(t1.rating) desc limit 1
Question: please list the top 3 house-manufactured products with the highest average rating. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. P...
please list the top 3 house-manufactured products with the highest average rating.
works_cycles
select firstname, lastname from person where persontype = 'em' order by businessentityid
Question: list all the non-sales employees in ascending order of its business entitty id. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Pers...
list all the non-sales employees in ascending order of its business entitty id.
works_cycles
select firstname, middlename, lastname from person where lastname = 'anderson' and persontype = 'in'
Question: name all person in the individual retail whose last name is 'anderson'. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bu...
name all person in the individual retail whose last name is 'anderson'.
works_cycles
select t1.firstname, t1.lastname, t2.hiredate from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid inner join employeedepartmenthistory as t3 on t2.businessentityid = t3.businessentityid where t3.enddate is not null
Question: list the name of employees who had left the company? when were they hired? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person ->...
list the name of employees who had left the company? when were they hired?
works_cycles
select t1.firstname, t1.lastname from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid where strftime('%y', t2.hiredate) >= '2007' and t2.salariedflag = 1
Question: name all salaried employee who are hired in 2007 and later. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntity...
name all salaried employee who are hired in 2007 and later.
works_cycles
select t1.firstname, t1.lastname from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid where t2.maritalstatus = 'm' and t2.vacationhours < 20
Question: list the name of married employees with less than 20 vacation hours. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busin...
list the name of married employees with less than 20 vacation hours.
works_cycles
select t1.firstname, t1.lastname , strftime('%y', current_timestamp) - strftime('%y', birthdate) from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid inner join employeedepartmenthistory as t3 on t2.businessentityid = t3.businessentityid where t3.shiftid = 3 order by strftime('%y', c...
Question: name the oldest employee who is working on night shift. how old is the employee? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Per...
name the oldest employee who is working on night shift. how old is the employee?
works_cycles
select t1.firstname, t1.lastname from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid inner join employeedepartmenthistory as t3 on t2.businessentityid = t3.businessentityid inner join department as t4 on t3.departmentid = t4.departmentid where strftime('%y', t2.hiredate) = '2009' an...
Question: list all staff in the shipping and receiving department who are hired in 2009. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Perso...
list all staff in the shipping and receiving department who are hired in 2009.
works_cycles
select t2.jobtitle, t4.name from person as t1 inner join employee as t2 on t1.businessentityid = t2.businessentityid inner join employeedepartmenthistory as t3 on t2.businessentityid = t3.businessentityid inner join department as t4 on t3.departmentid = t4.departmentid order by t2.hiredate limit 1
Question: what is the job title of the oldest employee in the company? in which department is he in? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, Modifie...
what is the job title of the oldest employee in the company? in which department is he in?
works_cycles
select avg(t1.rate) from employeepayhistory as t1 inner join employeedepartmenthistory as t2 on t1.businessentityid = t2.businessentityid inner join department as t3 on t2.departmentid = t3.departmentid where t1.ratechangedate = ( select max(t1.ratechangedate) from employeepayhistory as t1 inner join department as t2 o...
Question: based on the lastet payrate of each employee, calculate the average hourly payrate for each department. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Currency...
based on the lastet payrate of each employee, calculate the average hourly payrate for each department.
works_cycles
select t2.firstname, t2.lastname from employeepayhistory as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid inner join employee as t3 on t2.businessentityid = t3.businessentityid where t3.jobtitle not like 'chief executive officer' order by t1.rate desc limit 1
Question: other than the chief executive officer, who is the employee who has the highest payrate? state the rate. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Currenc...
other than the chief executive officer, who is the employee who has the highest payrate? state the rate.
works_cycles
select t1.name from vendor as t1 inner join productvendor as t2 on t1.businessentityid = t2.businessentityid where t2.productid = 319 order by t2.averageleadtime limit 1
Question: name the vendor who has the shortest average lead time for product id 319. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person ->...
name the vendor who has the shortest average lead time for product id 319.
works_cycles
select t3.name from vendor as t1 inner join productvendor as t2 on t1.businessentityid = t2.businessentityid inner join product as t3 on t2.productid = t3.productid where t1.name = 'australia bike retailer'
Question: list all product name from australia bike retailer order by product id. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bu...
list all product name from australia bike retailer order by product id.
works_cycles
select t1.name from vendor as t1 inner join productvendor as t2 on t1.businessentityid = t2.businessentityid where t2.productid = 342 order by t2.lastreceiptcost - t2.standardprice desc limit 1
Question: which vendor gives the best profit on net for product id 342? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEnti...
which vendor gives the best profit on net for product id 342?
works_cycles
select t2.rate , (max(t2.rate) - min(t2.rate)) * 100 / max(t2.rate) from person as t1 inner join employeepayhistory as t2 on t1.businessentityid = t2.businessentityid where t1.firstname = 'rob' and t1.lastname = 'walters'
Question: what is the current payrate of rob walters? calculate the percentage increment from his previous payrate. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Curren...
what is the current payrate of rob walters? calculate the percentage increment from his previous payrate.
works_cycles
select avg(strftime('%y', current_timestamp) - strftime('%y', t1.hiredate)) from employee as t1 inner join employeedepartmenthistory as t2 on t1.businessentityid = t2.businessentityid inner join department as t3 on t2.departmentid = t3.departmentid where t3.name = 'research and development'
Question: calculate the average length of employment for employee working in the research and development deparment. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Curre...
calculate the average length of employment for employee working in the research and development deparment.
works_cycles
select avg(strftime('%y', current_timestamp) - strftime('%y', birthdate)) from employee
Question: what is the average age of employee in adventure works? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, ...
what is the average age of employee in adventure works?
works_cycles
select cast(sum(case when jobtitle = 'sales representative' then 1 else 0 end) as real) * 100 / count(businessentityid) from employee
Question: among the employees in adventure works, calculate the percentage of them working as sales representatives. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Curre...
among the employees in adventure works, calculate the percentage of them working as sales representatives.
works_cycles
select t1.firstname, t1.lastname, t2.phonenumber from person as t1 inner join personphone as t2 on t1.businessentityid = t2.businessentityid inner join employee as t3 on t1.businessentityid = t3.businessentityid where t3.jobtitle = 'marketing manager'
Question: please provide contact details of all marketing managers. state their name and phone number. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, Modif...
please provide contact details of all marketing managers. state their name and phone number.
works_cycles
select t3.firstname, t3.lastname from creditcard as t1 inner join personcreditcard as t2 on t1.creditcardid = t2.creditcardid inner join person as t3 on t2.businessentityid = t3.businessentityid where t1.cardtype = 'distinguish'
Question: list the person who owns a distinguish credt card. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Perso...
list the person who owns a distinguish credt card.
works_cycles
select t4.name from store as t1 inner join salesperson as t2 on t1.salespersonid = t2.businessentityid inner join person as t3 on t2.businessentityid = t3.businessentityid inner join salesterritory as t4 on t2.territoryid = t4.territoryid where t1.name = 'area bike accessories'
Question: name the sales person for store area bike accessories. which territory is he / she in? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDat...
name the sales person for store area bike accessories. which territory is he / she in?
works_cycles
select t3.name, t4.firstname, t4.lastname from salesterritory as t1 inner join customer as t2 on t1.territoryid = t2.territoryid inner join store as t3 on t2.storeid = t3.businessentityid inner join person as t4 on t2.personid = t4.businessentityid where t1.name = 'france'
Question: name all stores and its sales representative in france territory. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Business...
name all stores and its sales representative in france territory.
works_cycles
select t1.name, t3.name from product as t1 inner join productvendor as t2 on t1.productid = t2.productid inner join vendor as t3 on t2.businessentityid = t3.businessentityid where strftime('%y', t1.sellstartdate) = '2013'
Question: name all products that started selling in 2013. state its respective vendor's name. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. ...
name all products that started selling in 2013. state its respective vendor's name.
works_cycles
select t2.firstname, t2.middlename, t2.lastname from salesperson as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid order by t1.salesytd desc limit 1
Question: names the sales representative with the highest year to date sales. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busine...
names the sales representative with the highest year to date sales.
works_cycles
select t2.name from productvendor as t1 inner join product as t2 on t1.productid = t2.productid inner join vendor as t3 on t1.businessentityid = t3.businessentityid where t1.maxorderqty = 1000 and t2.standardcost > 17
Question: list all product only moq of 1,000 and with standard cost more than 17. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bu...
list all product only moq of 1,000 and with standard cost more than 17.
works_cycles
select t2.firstname, t2.lastname, t1.jobtitle from employee as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where t1.gender = 'm' and t1.maritalstatus = 'm' order by t1.birthdate limit 1
Question: who is the oldest married male? state his job title. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Per...
who is the oldest married male? state his job title.
works_cycles
select t3.name from product as t1 inner join productvendor as t2 on t1.productid = t2.productid inner join vendor as t3 on t2.businessentityid = t3.businessentityid where t1.productnumber = 'wb-h098'
Question: state the vendor for product number wb-h098. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonType,...
state the vendor for product number wb-h098.
works_cycles
select t2.name from productvendor as t1 inner join vendor as t2 on t1.businessentityid = t2.businessentityid where t1.productid = 348 order by t1.averageleadtime asc limit 1
Question: find the vendor with the least average lead time for product id 348. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busin...
find the vendor with the least average lead time for product id 348.
works_cycles
select t2.firstname, t2.lastname from employee as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where strftime('%y', t1.birthdate) > '1970' order by t1.sickleavehours limit 1
Question: state the employee who are born in or after 1970 and with the least sick leave hour. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate....
state the employee who are born in or after 1970 and with the least sick leave hour.
works_cycles
select strftime('%y', current_timestamp) - strftime('%y', t1.birthdate) + 1 , t3.name from employee as t1 inner join employeedepartmenthistory as t2 using (businessentityid) inner join department as t3 using (departmentid) order by t1.birthdate desc limit 1
Question: calculate the average age of employee in each department and state which department has the youngest employees. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, ...
calculate the average age of employee in each department and state which department has the youngest employees.
works_cycles
select distinct productcategoryid from productsubcategory limit 3
Question: please provide the ids of any three adventureworks product subcategories. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> ...
please provide the ids of any three adventureworks product subcategories.
works_cycles
select salesytd - salesquota from salesperson where businessentityid = 288
Question: what are the differences between the 288th salesperson's predicted annual sales and his or her actual sales thus far? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegion...
what are the differences between the 288th salesperson's predicted annual sales and his or her actual sales thus far?
works_cycles
select businessentityid from salesperson order by saleslastyear limit 3
Question: please list three businesses with the lowest total sales from last year. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> B...
please list three businesses with the lowest total sales from last year.
works_cycles
select territoryid from salesterritory order by salesytd desc limit 3
Question: which three sales regions have generated the most revenue thus far? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busine...
which three sales regions have generated the most revenue thus far?
works_cycles
select type from specialoffer where category = 'reseller'
Question: what categories of offers qualify for group discounts for resellers? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busin...
what categories of offers qualify for group discounts for resellers?
works_cycles
select discountpct from specialoffer where type = 'excess inventory' order by discountpct desc limit 1
Question: what is the highest possible discount rate for 'excess inventory'? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busines...
what is the highest possible discount rate for 'excess inventory'?
works_cycles
select plannedcost - actualcost from workorderrouting where productid = 818
Question: what is the difference between the actual manufacturing cost of product number 818 and the estimated manufacturing cost? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryReg...
what is the difference between the actual manufacturing cost of product number 818 and the estimated manufacturing cost?
works_cycles
select count(*) from billofmaterials where bomlevel = 2 and enddate is null
Question: how many materials still need to be assembled and have a depth of 2 between each component and their parent product? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionC...
how many materials still need to be assembled and have a depth of 2 between each component and their parent product?
works_cycles
select count(documentnode) from document where status = 2 and documentsummary is null
Question: how many of the approved documents are confidential? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Per...
how many of the approved documents are confidential?
works_cycles
select salestaxrateid from salestaxrate where name like '%+%'
Question: what are the sales tax records charged by multiple types of tax? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessE...
what are the sales tax records charged by multiple types of tax?
works_cycles
select transactionid from transactionhistory where transactiontype = 'w' order by quantity desc limit 1
Question: which work order transaction number has the highest product quantity? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busi...
which work order transaction number has the highest product quantity?
works_cycles
select name from vendor where preferredvendorstatus = 0 limit 3
Question: please list any 3 vendors that are not recommended by adventure works. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bus...
please list any 3 vendors that are not recommended by adventure works.
works_cycles
select count(businessentityid) from vendor where preferredvendorstatus = 0 and activeflag = 1
Question: how many vendors does adventure works still work with but are not preferable? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person...
how many vendors does adventure works still work with but are not preferable?
works_cycles
select count(t1.businessentityid) from employeedepartmenthistory as t1 inner join shift as t2 on t1.shiftid = t2.shiftid where t2.shiftid = 3 and strftime('%y', t2.starttime) >= '2009'
Question: how many employees who began working in 2009 or later had night shifts? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bu...
how many employees who began working in 2009 or later had night shifts?
works_cycles
select t3.name from employeedepartmenthistory as t1 inner join shift as t2 on t1.shiftid = t2.shiftid inner join department as t3 on t1.departmentid = t3.departmentid where t2.name = 'night' group by t3.name order by count(t1.businessentityid) desc limit 1
Question: which department, altogether, has the most personnel who work the evening shift? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Per...
which department, altogether, has the most personnel who work the evening shift?
works_cycles
select count(*) from shipmethod as t1 inner join salesorderheader as t2 using (shipmethodid) where t1.name = 'xrq - truck ground'
Question: how many shipments by truck were made? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonType, NameS...
how many shipments by truck were made?
works_cycles
select t2.name from salesorderheadersalesreason as t1 inner join salesreason as t2 on t1.salesreasonid = t2.salesreasonid where t1.salesorderid = 43718
Question: what are the sales reasons for order 43718? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonType, ...
what are the sales reasons for order 43718?
works_cycles
select t1.name from productsubcategory as t1 inner join productcategory as t2 on t1.productcategoryid = t2.productcategoryid where t2.name = 'bikes'
Question: what bike subcategories are there? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonType, NameStyle...
what bike subcategories are there?
works_cycles
select t2.name from salesperson as t1 inner join salesterritory as t2 on t1.territoryid = t2.territoryid group by t1.territoryid order by sum(t1.salesquota) desc limit 1
Question: which sales areas are expected to have the highest yearly sales quota? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bus...
which sales areas are expected to have the highest yearly sales quota?
works_cycles
select t1.name from product as t1 inner join salesorderdetail as t2 on t1.productid = t2.productid where t2.salesorderid = 43660
Question: what goods were sold to customers in accordance with sales order number 43660? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Perso...
what goods were sold to customers in accordance with sales order number 43660?
works_cycles
select t1.name from product as t1 inner join salesorderdetail as t2 on t1.productid = t2.productid group by t1.name order by sum(t2.orderqty) desc limit 0, 5
Question: please list the top 5 products with the most orders. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Per...
please list the top 5 products with the most orders.
works_cycles
select t2.shelf from product as t1 inner join productinventory as t2 on t1.productid = t2.productid where t1.name = 'down tube'
Question: where are the shelves where the down tube product was stored? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEnti...
where are the shelves where the down tube product was stored?
works_cycles
select t2.name from businessentityaddress as t1 inner join addresstype as t2 on t1.addresstypeid = t2.addresstypeid inner join store as t3 on t1.businessentityid = t3.businessentityid where t3.name = 'fun toys and bikes'
Question: which address type does 'fun toys and bikes' fall under? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID,...
which address type does 'fun toys and bikes' fall under?
works_cycles
select t1.name from contacttype as t1 inner join businessentitycontact as t2 on t1.contacttypeid = t2.contacttypeid inner join store as t3 on t2.businessentityid = t3.businessentityid where t3.name = 'next-door bike store'
Question: who is the 'next-door bike store' point of contact? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Pers...
who is the 'next-door bike store' point of contact?
works_cycles
select t2.referenceorderid from product as t1 inner join transactionhistory as t2 on t1.productid = t2.productid where t1.name = 'mountain end caps'
Question: what is the order reference number for the 'mountain end caps' product? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Bu...
what is the order reference number for the 'mountain end caps' product?
works_cycles
select t1.addressline1 from address as t1 inner join businessentityaddress as t2 on t1.addressid = t2.addressid where t2.businessentityid = 12
Question: what is the 12th business's first line address? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonTy...
what is the 12th business's first line address?
works_cycles
select t2.businessentityid from address as t1 inner join businessentityaddress as t2 on t1.addressid = t2.addressid where t1.city = 'dallas' limit 3
Question: please list any three businesses with their ids that are located in dallas city. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Per...
please list any three businesses with their ids that are located in dallas city.
works_cycles
select t2.name from address as t1 inner join stateprovince as t2 on t1.stateprovinceid = t2.stateprovinceid where t1.city = 'racine'
Question: what is the name of the state that racine belongs to? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Pe...
what is the name of the state that racine belongs to?
works_cycles
select cast(sum(case when t1.name = 'arabic' then 1 else 0 end) as real) * 100 / sum(case when t1.name = 'thai' then 1 else 0 end) from culture as t1 inner join productmodelproductdescriptionculture as t2 on t1.cultureid = t2.cultureid
Question: what is the difference in percentage between the product descriptions written in arabic and thai? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ...
what is the difference in percentage between the product descriptions written in arabic and thai?
works_cycles
select cast(sum(case when t1.salesquota > 300000 then 1 else 0 end) as real) * 100 / count(t1.businessentityid) from salesperson as t1 inner join salesterritory as t2 on t1.territoryid = t2.territoryid where t2.countryregioncode = 'us' and t2.name = 'northwest'
Question: what percentage of businesses in the northwest us have forecasted annual sales of above 300,000? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, M...
what percentage of businesses in the northwest us have forecasted annual sales of above 300,000?
works_cycles
select t2.lastreceiptcost - t2.standardprice from product as t1 inner join productvendor as t2 on t1.productid = t2.productid where t1.name like '%crankarm%'
Question: what is the crankarm product's net profit? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, PersonType, N...
what is the crankarm product's net profit?
works_cycles
select t1.name from product as t1 inner join productreview as t2 on t1.productid = t2.productid where t2.rating = ( select rating from productreview order by rating desc limit 1 )
Question: what is the name of the product with the almost highest review score? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busi...
what is the name of the product with the almost highest review score?
works_cycles
select rate from employeepayhistory where payfrequency = 1 order by rate desc limit 1, 1
Question: what is the company's second highest salary per hour for employees who are paid monthly? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedD...
what is the company's second highest salary per hour for employees who are paid monthly?
works_cycles
select count(creditcardid) from creditcard where cardtype = 'vista' and expyear < 2007
Question: how many vista cards expired before the year 2007? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Perso...
how many vista cards expired before the year 2007?
works_cycles
select starttime from shift where name = 'night'
Question: what time does the company's night shift begin? indicate the answer in regular form. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate....
what time does the company's night shift begin? indicate the answer in regular form.
works_cycles
select weight from product where weightunitmeasurecode = 'lb' group by weight order by count(style) desc limit 1
Question: what is the weight in pounds of the style that is produced the most by the company? if there are multiple products sharing the same weight, indicate the name of each one of them and their corresponding weights. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, Modif...
what is the weight in pounds of the style that is produced the most by the company? if there are multiple products sharing the same weight, indicate the name of each one of them and their corresponding weights.
works_cycles
select saleslastyear - salesytd, name, countryregioncode from salesterritory order by saleslastyear - salesytd desc limit 1
Question: which territory has the greatest difference in sales from previous year to this year? indicate the difference, as well as the name and country of the region. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate...
which territory has the greatest difference in sales from previous year to this year? indicate the difference, as well as the name and country of the region.
works_cycles
select name, reorderpoint from product where sizeunitmeasurecode = 'cm' order by size desc limit 6
Question: what are the names of the top 6 products that has the biggest size in centimeter and what are its reorder point? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode,...
what are the names of the top 6 products that has the biggest size in centimeter and what are its reorder point?
works_cycles
select totaldue from purchaseorderheader order by freight desc limit 2, 1
Question: how much is the amount to be paid by the company for the purchase order with the third highest freight amount? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, C...
how much is the amount to be paid by the company for the purchase order with the third highest freight amount?
works_cycles
select 10 * (listprice - standardcost) from product where weight is not null order by weight limit 1
Question: what profit will the company gain if they sell 10 items of the product that has the lightest weight? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCod...
what profit will the company gain if they sell 10 items of the product that has the lightest weight?
works_cycles
select taxamt, purchaseorderid from purchaseorderheader order by taxamt desc limit 1
Question: how much is the tax amount of the purchase order with the biggest tax amount? indicate the purchase order id. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, Cu...
how much is the tax amount of the purchase order with the biggest tax amount? indicate the purchase order id.
works_cycles
select count(businessentityid) from salespersonquotahistory where salesquota < 500000
Question: how many person have a projected yearly sales of no more than 50,000? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> Busi...
how many person have a projected yearly sales of no more than 50,000?
works_cycles
select t3.starttime, t3.endtime from employee as t1 inner join employeedepartmenthistory as t2 on t1.businessentityid = t2.businessentityid inner join shift as t3 on t2.shiftid = t3.shiftid where strftime('%y', t1.birthdate) < '1969' order by t1.birthdate limit 5, 1
Question: among the employees who were born before 1969, what is the work shift of the 6th oldest employee? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ...
among the employees who were born before 1969, what is the work shift of the 6th oldest employee?
works_cycles
select t1.name, t2.rating from product as t1 inner join productreview as t2 on t1.productid = t2.productid where t1.daystomanufacture = ( select daystomanufacture from product order by daystomanufacture limit 1 ) order by t1.listprice - t1.standardcost desc limit 1
Question: which product allows the company to make the highest profit on a single item among those that are the fastest to manufacture? indicate the rating of the product if there any. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, N...
which product allows the company to make the highest profit on a single item among those that are the fastest to manufacture? indicate the rating of the product if there any.
works_cycles
select t2.firstname, t2.middlename, t2.lastname from salesperson as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where t1.bonus < 1000
Question: what are the full names of the sales person whose bonuses are less than 1,000? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Perso...
what are the full names of the sales person whose bonuses are less than 1,000?
works_cycles
select t2.enddate from employee as t1 inner join employeedepartmenthistory as t2 on t1.businessentityid = t2.businessentityid inner join department as t3 on t2.departmentid = t3.departmentid where t1.jobtitle = 'senior tool designer' and strftime('%y', t1.hiredate) - strftime('%y', t1.birthdate) = 33 and t2.enddate is ...
Question: when did the senior tool designer, who was 33 years old at the time he was hired, stopped working in the engineering department? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> Co...
when did the senior tool designer, who was 33 years old at the time he was hired, stopped working in the engineering department?
works_cycles
select sum(t2.totaldue) from vendor as t1 inner join purchaseorderheader as t2 on t1.businessentityid = t2.vendorid where t1.creditrating = 4 and t1.preferredvendorstatus = 0
Question: among the vendors with an average credit rating, what is the overall total due amount of purchases made by the company to the vendor that isn't preferrerd if another vendor is available? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> Cur...
among the vendors with an average credit rating, what is the overall total due amount of purchases made by the company to the vendor that isn't preferrerd if another vendor is available?
works_cycles
select t3.name from shift as t1 inner join employeedepartmenthistory as t2 on t1.shiftid = t2.shiftid inner join department as t3 on t2.departmentid = t3.departmentid group by t2.departmentid order by count(t1.name = 'night') desc limit 1
Question: which department has the most number of night shifts? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Pe...
which department has the most number of night shifts?
works_cycles
select 2 * (t1.listprice - t1.standardcost) from product as t1 inner join productsubcategory as t2 on t1.productsubcategoryid = t2.productsubcategoryid where t1.class = 'h' and t1.color = 'black' and t1.size = 58 and t2.name = 'road bikes'
Question: how much profit can the company gained from selling two high class black road bikes with a size of 58? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyC...
how much profit can the company gained from selling two high class black road bikes with a size of 58?
works_cycles
select t2.firstname, t2.middlename, t2.lastname from employee as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where t1.jobtitle like 'production technician%' and t1.gender = 'm' and t1.maritalstatus = 'm' order by t1.birthdate desc limit 10
Question: what are the full names of the 10 youngest married male production technicians? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Pers...
what are the full names of the 10 youngest married male production technicians?
works_cycles
select t2.name, t2.creditrating from productvendor as t1 inner join vendor as t2 on t1.businessentityid = t2.businessentityid where t1.averageleadtime = 60 order by t1.lastreceiptcost - t1.standardprice desc limit 1
Question: among the products with an average lead time of 60, which vendor has the highest profit on net? indicate the credit rating of such vendor. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurr...
among the products with an average lead time of 60, which vendor has the highest profit on net? indicate the credit rating of such vendor.
works_cycles
select t1.lastreceiptcost - t1.standardprice, t2.name from productvendor as t1 inner join vendor as t2 on t1.businessentityid = t2.businessentityid where t1.maxorderqty = 200
Question: what is the profit on net of the products that have exactly 200 maximum order quantity? indicate the name of the vendors to which these products were purchased from. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, Modi...
what is the profit on net of the products that have exactly 200 maximum order quantity? indicate the name of the vendors to which these products were purchased from.
works_cycles
select t2.firstname, t2.lastname from purchaseorderheader as t1 inner join person as t2 on t1.employeeid = t2.businessentityid where t2.persontype = 'em' and t1.status = 3 group by t2.firstname, t2.lastname order by count(t1.purchaseorderid) desc limit 1
Question: what is the full name of the non-sales employee who made the most number of rejected purchase orders? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCo...
what is the full name of the non-sales employee who made the most number of rejected purchase orders?
works_cycles
select t2.name from productvendor as t1 inner join vendor as t2 on t1.businessentityid = t2.businessentityid order by t1.maxorderqty asc limit 1, 1
Question: what are the names of the vendor with the second lowest minimum order quantity? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Pers...
what are the names of the vendor with the second lowest minimum order quantity?
works_cycles
select t2.minorderqty from vendor as t1 inner join productvendor as t2 on t1.businessentityid = t2.businessentityid where t1.activeflag = 0 order by t2.minorderqty limit 1
Question: how much are the minimum orders of the vendors that are no longer used by the company? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDat...
how much are the minimum orders of the vendors that are no longer used by the company?
works_cycles
select strftime('%y', t1.hiredate) - strftime('%y', t1.birthdate), t2.firstname, t2.middlename, t2.lastname from employee as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where t1.vacationhours <= 10 order by strftime('%y', t1.hiredate) - strftime('%y', t1.birthdate) desc limit 1
Question: of the employees whose vacation hours are no more than 10, what is the age of the oldest employee at the time he/she was hired? indicate his/her full name. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. ...
of the employees whose vacation hours are no more than 10, what is the age of the oldest employee at the time he/she was hired? indicate his/her full name.
works_cycles
select t2.persontype from employee as t1 inner join person as t2 on t1.businessentityid = t2.businessentityid where t1.gender = 'f' and t1.maritalstatus = 's' and strftime('%y-%m-%d', t1.hiredate) between '2008-1-1' and '2008-12-31' group by t2.persontype order by count(t2.persontype) desc limit 1
Question: what is the primary type of all single female employees hired between 1/1/2008 to 12/31/2008? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, Modi...
what is the primary type of all single female employees hired between 1/1/2008 to 12/31/2008?
works_cycles
select t2.listprice - t2.standardcost from productreview as t1 inner join product as t2 on t1.productid = t2.productid where t1.reviewername = 'david' order by t1.rating desc limit 1
Question: what is the company's profit on the product that was rated second-highest by david? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. ...
what is the company's profit on the product that was rated second-highest by david?
works_cycles
select t3.'group', t2.name from salestaxrate as t1 inner join stateprovince as t2 on t1.stateprovinceid = t2.stateprovinceid inner join salesterritory as t3 on t2.territoryid = t3.territoryid order by t1.taxrate limit 1, 1
Question: which geographic area does the city with the second lowest tax rate belongs to? indicate the name of the state or province as well. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency ->...
which geographic area does the city with the second lowest tax rate belongs to? indicate the name of the state or province as well.
works_cycles
select avg(t1.listprice - t1.standardcost), count(distinct t1.size) , count(distinct t1.style) from product as t1 inner join productsubcategory as t2 on t1.productsubcategoryid = t2.productsubcategoryid where t1.class = 'l' and t2.name = 'road frames' group by t1.class, t1.color
Question: what is the average profit of all the low class universal road frames? indicate how many variety of sizes are there and the available colors. | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionC...
what is the average profit of all the low class universal road frames? indicate how many variety of sizes are there and the available colors.
works_cycles
select discountpct from specialoffer where description = 'll road frame sale'
Question: what is the discount percentage of 'll road frame sale'? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID,...
what is the discount percentage of 'll road frame sale'?
works_cycles
select count(specialofferid) from specialoffer where type = 'excess inventory'
Question: how many discount are of the type 'excess inventory'? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntityID, Pe...
how many discount are of the type 'excess inventory'?
works_cycles
select description from specialoffer where type = 'seasonal discount' order by discountpct desc limit 1
Question: which seasonal discount had the highest discount percentage? | Tables: CountryRegion -> CountryRegionCode, Name, ModifiedDate. Culture -> CultureID, Name, ModifiedDate. Currency -> CurrencyCode, Name, ModifiedDate. CountryRegionCurrency -> CountryRegionCode, CurrencyCode, ModifiedDate. Person -> BusinessEntit...
which seasonal discount had the highest discount percentage?