Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Note: sales of previous year refers to saleslastyear; salesytd refers to year to date sales; increase in sales = DIVIDE(SUBTRACT(salesytd, saleslastyear), saleslastyear)*100;
Question: List the name of the rates that apply to the provinces that are in the territory that obtained the greatest increase in sales with respect to the previous year.
SQL: SELECT stateprovince.name FROM salesterritory INNER JOIN stateprovince ON salesterritory.countryregioncode = stateprovince.countryregioncode INNER JOIN salestaxrate ON stateprovince.stateprovinceid = salestaxrate.stateprovinceid ORDER BY (salesterritory.salesytd - salesterritory.saleslastyear) / salesterritory.saleslastyear DESC LIMIT 1
Database: works_cycles
Note: employee refers to businessentityid; salaries on a monthly basis refers to payfrequency = 1; hourly rate more than 50 refers to rate > 50;
Question: How many employees earn their salaries on a monthly basis at an hourly rate of more than 50?
SQL: SELECT count(businessentityid) FROM employeepayhistory WHERE rate * payfrequency > 50
Database: works_cycles
Note: company number 1 refers to businessentityid = 1; employee refers to persontype = 'EM'; full name refers to firstname + middlename + lastname;
Question: What is the employee of company number 1's full name?
SQL: SELECT firstname, middlename, lastname FROM person WHERE businessentityid = 1 AND persontype = 'EM'
Database: works_cycles
Note: supplier number 1492 refers to businessentityid = 1492; name of the supplier = name from vendor;
Question: What is the name of the supplier number 1492?
SQL: SELECT name FROM vendor WHERE businessentityid = 1492
Database: works_cycles
Note: vendor refers to businessentityid; 500 to 15000 piece order refers to minorderqty > 500 and maxorderqty < 15000;
Question: How many vendors only consented to move on with the 500 to 15000 piece order in terms of quality?
SQL: SELECT count(*) FROM productvendor WHERE minorderqty > 500 AND maxorderqty < 15000
Database: works_cycles
Note: department refers to name where groupname = 'Executive General and Administration';
Question: Please list the departments that are part of the Executive General and Administration group.
SQL: SELECT name FROM department WHERE groupname = 'Executive General and Administration'
Database: works_cycles
Note: family names refers to Last name; employee refers to persontype = 'EM'; middlename starts with 'C';
Question: Please list the family names of any employees whose middle names begin with C.
SQL: SELECT lastname FROM person WHERE persontype = 'EM' AND middlename LIKE 'C%'
Database: works_cycles
Note: vendors refers to distinct businessentityid; average delivery time of 25 days refers to averageleadtime = 25 and onorderqty > 0;
Question: How many vendors are having their products ordered with an average delivery time of 25 days?
SQL: SELECT count(DISTINCT businessentityid) FROM productvendor WHERE averageleadtime = 25
Database: works_cycles
Note: product number = productid;
Question: Please list any 3 product numbers with the lowest standard cost.
SQL: SELECT productid FROM productcosthistory ORDER BY standardcost ASC LIMIT 3
Database: works_cycles
Note: cannot be sold means product is not a salable item which refers to finishedgoodsflag = 0;
Question: How many black-colored products are there that cannot be sold?
SQL: SELECT count(productid) FROM product WHERE finishedgoodsflag = 0 AND color = 'Black'
Database: works_cycles
Note: employees refers to businessentityid; most unused sick leave refers to MAX(sickleavehours); position title refers to jobtitle;
Question: Please list the top three employees with the most unused sick leave along with their position titles.
SQL: SELECT jobtitle FROM employee ORDER BY sickleavehours DESC LIMIT 3
Database: works_cycles
Note: address number refers to addressid; full address refers to addressline1 + addressline2;
Question: What is the full address of address number 11906?
SQL: SELECT addressline1, addressline2 FROM address WHERE addressid = 11906
Database: works_cycles
Note: business number 1580 refers to businessentityid = 1580; Net profit = SUBTRACT(lastreceiptcost,standardprice);
Question: What is business number 1580's net profit?
SQL: SELECT lastreceiptcost - standardprice FROM productvendor WHERE businessentityid = 1580
Database: works_cycles
Note: business number 1580 refers to businessentityid = 1580; Net profit = SUBTRACT(lastreceiptcost,standardprice);
Question: What is the sales revenue for item number 740?
SQL: SELECT listprice - standardcost FROM product WHERE productid = 740
Database: works_cycles
Note: customers' name refers to reviewername; best possible ratings means the highest rating = 5;
Question: How many customers gave a product the best possible rating? Please list their names.
SQL: SELECT reviewername FROM productreview WHERE rating = 5
Database: works_cycles
Note: poor credit rating means bad credit; creditrating = 5; Business number refers to businessentityid;
Question: What are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.
SQL: SELECT businessentityid FROM vendor WHERE creditrating = ( SELECT creditrating FROM vendor ORDER BY creditrating DESC LIMIT 1 )
Database: works_cycles
Note: person number 18 refers to businessentityid = 18; forename refers to firstname;
Question: What is the forename and birthdate of person number 18?
SQL: SELECT person.firstname, employee.birthdate FROM person INNER JOIN employee ON person.businessentityid = employee.businessentityid WHERE person.businessentityid = 18
Database: works_cycles
Note: person number 322 refers to personid = 18; job is the name of contacttype;
Question: What job is person number 322 currently holding?
SQL: SELECT contacttype.name FROM contacttype INNER JOIN businessentitycontact ON contacttype.contacttypeid = businessentitycontact.contacttypeid WHERE businessentitycontact.businessentityid = 332
Database: works_cycles
Note: business along with their IDs = businessentityid; Cellphones refers to phonenumbertype.name = ‘cell’;
Question: Please list 3 businesses along with their IDs that use cellphones.
SQL: SELECT personphone.businessentityid FROM phonenumbertype INNER JOIN personphone ON phonenumbertype.phonenumbertypeid = personphone.phonenumbertypeid WHERE phonenumbertype.name = 'Cell' LIMIT 3
Database: works_cycles
Question: What is the currency of Brazil?
SQL: SELECT currency.name FROM currency INNER JOIN countryregioncurrency ON currency.currencycode = countryregioncurrency.currencycode INNER JOIN countryregion ON countryregioncurrency.countryregioncode = countryregion.countryregioncode WHERE countryregion.name = 'Brazil'
Database: works_cycles
Question: How many people work in the finance department?
SQL: SELECT count(employeedepartmenthistory.businessentityid) FROM department INNER JOIN employeedepartmenthistory ON department.departmentid = employeedepartmenthistory.departmentid WHERE department.name = 'Finance'
Database: works_cycles
Note: business number refers to businessentityid where businessentityid = 1496; how long does it take refers to averageleadtime;
Question: How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?
SQL: SELECT productvendor.averageleadtime, vendor.name FROM productvendor INNER JOIN vendor USING (businessentityid) WHERE vendor.businessentityid = 1496 GROUP BY productvendor.averageleadtime, vendor.name
Database: works_cycles
Note: SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore'));
Question: How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
SQL: SELECT sum(iif(address.city = 'Bothell', 1, 0)) - sum(iif(address.city = 'Kenmore', 1, 0)) , stateprovincecode FROM address INNER JOIN stateprovince ON address.stateprovinceid = stateprovince.stateprovinceid GROUP BY stateprovincecode
Database: works_cycles
Note: Saved in English refers to product description written in English where culture.name = 'English';
Question: Which chromoly steel product model has AdventureWorks saved in English?
SQL: SELECT productmodelproductdescriptionculture.productmodelid FROM productmodelproductdescriptionculture INNER JOIN culture USING (cultureid) INNER JOIN productdescription USING (productdescriptionid) WHERE productdescription.description LIKE 'Chromoly steel%' AND culture.name = 'English'
Database: works_cycles
Note: geographical location refers to group from salesperson; ComissionPct refers to commission percentage where ComissionPct >= 0.018;
Question: Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.
SQL: SELECT salesperson.businessentityid, salesterritory.'Group' FROM salesperson INNER JOIN salesterritory USING (territoryid) WHERE salesperson.commissionpct >= 0.018
Database: works_cycles
Question: Please list the various phone number types in the following order, from most to least common among businesses.
SQL: SELECT phonenumbertype.name FROM personphone INNER JOIN phonenumbertype ON personphone.phonenumbertypeid = phonenumbertype.phonenumbertypeid GROUP BY phonenumbertype.name ORDER BY count(phonenumbertype.name) DESC
Database: works_cycles
Note: Most common contact among businesses refers to businessentitycontact with the most name;
Question: Which role has the most common contact among businesses?
SQL: SELECT contacttype.name FROM contacttype INNER JOIN businessentitycontact ON contacttype.contacttypeid = businessentitycontact.contacttypeid GROUP BY contacttype.name ORDER BY count(contacttype.name) DESC LIMIT 1
Database: works_cycles
Note: Salespeople refers to persontype = 'SP';
Question: What are the salespeople's email addresses?
SQL: SELECT emailaddress.emailaddress FROM person INNER JOIN emailaddress ON person.businessentityid = emailaddress.businessentityid WHERE person.persontype = 'SP'
Database: works_cycles
Note: position refers to jobtitle;
Question: Which position does Suchitra hold?
SQL: SELECT employee.jobtitle FROM person INNER JOIN employee ON person.businessentityid = employee.businessentityid WHERE person.firstname = 'Suchitra'
Database: works_cycles
Note: employees refer to persontype = 'EM'; Single refers to maritalstatus = 's';
Question: How many employees work for AdvertureWorks that is single?
SQL: SELECT count(person.businessentityid) FROM person INNER JOIN employee ON person.businessentityid = employee.businessentityid WHERE person.persontype = 'EM' AND employee.maritalstatus = 'S'
Database: works_cycles
Note: Data saved in English refers to the name of the language where culture.name = 'English'; data saved in Arabic refers to the name of the language where culture.name = 'Arabic';   SUBTRACT(count(name = 'English'), count(name = 'Bothell'));
Question: How much do the works data saved in English and Arabic differ from one another?
SQL: SELECT sum(CASE WHEN culture.name = 'English' THEN 1 ELSE 0 END) - sum(CASE WHEN culture.name = 'Arabic' THEN 1 ELSE 0 END) FROM culture INNER JOIN productmodelproductdescriptionculture ON culture.cultureid = productmodelproductdescriptionculture.cultureid WHERE culture.name = 'English' OR culture.name = 'Arabic'
Database: works_cycles
Note: location refers to addressline1; business number refers to the businessentityid where businessentityid = 1;
Question: What is the location of business number 1?
SQL: SELECT address.addressline1 FROM address INNER JOIN businessentityaddress USING (addressid) WHERE businessentityaddress.businessentityid = 1
Database: works_cycles
Note: Business along with their numbers refers to the businessentityid; located in Duvall refers to city = 'Duvall';
Question: Please list the businesses along with their numbers that have their accounts located in Duvall.
SQL: SELECT businessentityaddress.businessentityid FROM address INNER JOIN businessentityaddress ON address.addressid = businessentityaddress.addressid WHERE address.city = 'Duvall'
Database: works_cycles
Note: percentage = DIVIDE(culture.name = 'Thai', count(ALL culture.name))*100%;
Question: What percentage of the AdventureWorks data is in Thai?
SQL: SELECT cast(sum(CASE WHEN culture.name = 'Thai' THEN 1 ELSE 0 END) AS REAL) * 100 / count(culture.cultureid) FROM culture INNER JOIN productmodelproductdescriptionculture ON culture.cultureid = productmodelproductdescriptionculture.cultureid
Database: works_cycles
Note: male refers to gender = 'M'; employee refers to persontype = 'EM'; percentage = DIVIDE(COUNT(gender = 'M'), COUNT(persontype = 'MY'))*100%;
Question: What percentage of AdventureWorks employees are men?
SQL: SELECT cast(sum(CASE WHEN employee.gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / count(person.businessentityid) FROM person INNER JOIN employee ON person.businessentityid = employee.businessentityid WHERE person.persontype = 'EM'
Database: works_cycles
Note: address number 15873 refers to addressid = '15873'; IsOnlystateprovincecode = '0' refers to stateprovincecode exists; IsOnlystateprovincecode = '1' refers to stateprovincecode unavailable;
Question: Where is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?
SQL: SELECT address.city, stateprovince.name, stateprovince.isonlystateprovinceflag FROM stateprovince INNER JOIN address ON stateprovince.stateprovinceid = address.stateprovinceid WHERE address.addressid = 15873
Database: works_cycles
Note: Full address refers to addressline1+addressline2; business number 24 refers to businessentityid = '24';
Question: What is the full address of business number 24?
SQL: SELECT address.addressline1, address.addressline2 FROM address INNER JOIN businessentityaddress ON address.addressid = businessentityaddress.addressid WHERE businessentityaddress.businessentityid = 24
Database: works_cycles
Note: Expiration year refers to expyear;
Question: Which year is credit card No.9648's Expiration Year?
SQL: SELECT expyear FROM creditcard WHERE creditcardid = 9648
Database: works_cycles
Question: What's Emma H Harris's Business Entity ID number?
SQL: SELECT businessentityid FROM person WHERE firstname = 'Emma' AND lastname = 'Harris'
Database: works_cycles
Note: Debur and Polish is name of manufacturing location;
Question: What is the location id for Debur and Polish?
SQL: SELECT locationid FROM LOCATION WHERE name = 'Debur and Polish'
Database: works_cycles
Note: Sales and Marketing is group name of a department;
Question: What are the Department ids under the Sales and Marketing Group?
SQL: SELECT departmentid FROM department WHERE groupname = 'Sales and Marketing'
Database: works_cycles
Question: Which sales person made the sale of 1635823.3967 last year? Give the Business Entity ID.
SQL: SELECT businessentityid FROM salesperson WHERE saleslastyear = '1635823.3967'
Database: works_cycles
Question: What is the Shift start time for Shift ID No.2?
SQL: SELECT starttime FROM shift WHERE shiftid = '2'
Database: works_cycles
Question: What is contact Type ID No.16 represent for?
SQL: SELECT name FROM contacttype WHERE contacttypeid = '16'
Database: works_cycles
Note: Minimum shipping charge refers to shipbase; OVERSEAS - DELUXE is name of shipping company;
Question: What is the minimum shipping charge for "OVERSEAS - DELUXE"?
SQL: SELECT shipbase FROM shipmethod WHERE name = 'OVERSEAS - DELUXE'
Database: works_cycles
Note: tell the meaning is to find the name of culture;
Question: Please tell the meaning of CultureID "fr".
SQL: SELECT name FROM culture WHERE cultureid = 'fr'
Database: works_cycles
Note: Mauritius Rupee is name of currency;
Question: Give the Mauritius Rupee's currency code.
SQL: SELECT currencycode FROM currency WHERE name = 'Mauritius Rupee'
Database: works_cycles
Note: Cellphone refers to name = 'Cell';
Question: Name cellphone number's Type ID?
SQL: SELECT phonenumbertypeid FROM phonenumbertype WHERE name = 'Cell'
Database: works_cycles
Note: Oldest production technician refers to MIN(birthdate) where jobtitle = 'production Technician';
Question: For the older production technician who was hired in 2008/12/7, what's his/her birthday?
SQL: SELECT birthdate FROM employee WHERE hiredate = '2008-12-07'
Database: works_cycles
Question: What is the product ID No.793's model name?
SQL: SELECT product.name FROM product INNER JOIN productmodel ON product.productmodelid = productmodel.productmodelid WHERE product.productid = 793
Database: works_cycles
Question: What are the unit measure codes for product ID No.762?
SQL: SELECT unitmeasure.unitmeasurecode FROM product INNER JOIN unitmeasure ON product.sizeunitmeasurecode = unitmeasure.unitmeasurecode OR product.weightunitmeasurecode = unitmeasure.unitmeasurecode WHERE product.productid = 762 GROUP BY product.productid, unitmeasure.unitmeasurecode
Database: works_cycles
Note: Located refers to the total address of the entity that comprises city, addressline1, addressline2;
Question: Where is Business Entity ID No.4 located at? Give the address down to street.
SQL: SELECT addressline1, addressline2 FROM address WHERE addressid IN ( SELECT addressid FROM businessentityaddress WHERE businessentityid = 4 )
Database: works_cycles
Note: On going assembly item means the assembly item haven't been finished, therefore enddate is null;
Question: For the on going assembly item Component ID No. 494, what's the Unit measure for it?
SQL: SELECT unitmeasure.name FROM billofmaterials INNER JOIN unitmeasure ON billofmaterials.unitmeasurecode = unitmeasure.unitmeasurecode WHERE billofmaterials.componentid = 494 AND billofmaterials.enddate IS NULL GROUP BY unitmeasure.name
Database: works_cycles
Note: document Control Assistant refers to the jobtitle = 'document Control Assistant'; born on 1975/12/25 refers to birthdate = '1975-12-25'; private documents indicate that documentsummary is null;
Question: For the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?
SQL: SELECT count(employee.businessentityid) FROM document INNER JOIN employee ON document.owner = employee.businessentityid WHERE employee.jobtitle = 'Document Control Assistant' AND employee.birthdate = '1975-12-25' AND document.documentsummary IS NULL
Database: works_cycles
Note: Profit as 82.41 = SUTRACT(listprice, standardcost); May of 2012 refers to startdate = '2012-05';
Question: To the products which could make the profit as 21.9037, what were their list price after October of 2012?
SQL: SELECT product.listprice FROM product INNER JOIN productlistpricehistory ON product.productid = productlistpricehistory.productid WHERE product.listprice - product.standardcost > 21.9037 AND strftime('%Y-%m-%d', productlistpricehistory.startdate) >= '2012-10-01'
Database: works_cycles
Question: What is the size of the photo of product id No.1?
SQL: SELECT productphoto.thumbnailphoto FROM productphoto INNER JOIN productproductphoto ON productphoto.productphotoid = productproductphoto.productphotoid WHERE productproductphoto.productid = 1
Database: works_cycles
Note: Catherine Ward refers to the name of businessentityid; how many letters in password for the e-mail account refers to LENGTH(passwordhash);
Question: How many letters are there in Catherine Ward's e-mail account passwords?
SQL: SELECT length(password.passwordhash) FROM person INNER JOIN password ON person.businessentityid = password.businessentityid WHERE person.firstname = 'Catherine' AND person.lastname = 'Ward'
Database: works_cycles
Note: Jill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product;
Question: What rating did Jill give for HL Mountain Pedal?
SQL: SELECT productreview.rating FROM productreview INNER JOIN product ON productreview.productid = product.productid WHERE productreview.reviewername = 'Jill' AND product.name = 'HL Mountain Pedal'
Database: works_cycles
Note: SUBTRACT(lastreceiptcost, standardprice) for productid where name = 'Freewheel';
Question: What's the profit for the Freewheel?
SQL: SELECT productvendor.lastreceiptcost - productvendor.standardprice FROM productvendor INNER JOIN product ON productvendor.productid = product.productid WHERE product.name = 'Freewheel'
Database: works_cycles
Note: Complete sales task refers to meeting sales quota; if bonus = 0, it means this salesperson doesn't meet quota and vice versa;
Question: Did Rachel Valdez complete her sales task?
SQL: SELECT salesperson.bonus FROM salesperson INNER JOIN person ON salesperson.businessentityid = person.businessentityid WHERE person.firstname = 'Rachel' AND person.lastname = 'Valdez'
Database: works_cycles
Note: If name = "+" in the value from salestaxrate, it means this sales are charged by multiple types of tax; Quebec refers to the name of State Province;
Question: How many types of tax did the sales happen in Quebec have?
SQL: SELECT count(DISTINCT salestaxrate.name) FROM salestaxrate INNER JOIN stateprovince ON salestaxrate.stateprovinceid = stateprovince.stateprovinceid WHERE stateprovince.name = 'Quebec'
Database: works_cycles
Question: What's Kevin A Wright's email address?
SQL: SELECT emailaddress.emailaddress FROM person INNER JOIN emailaddress ON person.businessentityid = emailaddress.businessentityid WHERE person.firstname = 'Kevin' AND person.middlename = 'A' AND person.lastname = 'Wright'
Database: works_cycles
Note: Doesn't have a State Province Code refers to isonlystateprovinceflag = 1 where stateprovincecode is unavailable;
Question: What is the number of State Province of France that doesn't have a State Province Code?
SQL: SELECT stateprovince.countryregioncode FROM stateprovince INNER JOIN countryregion ON stateprovince.countryregioncode = countryregion.countryregioncode WHERE countryregion.name = 'France' AND stateprovince.isonlystateprovinceflag = 1
Database: works_cycles
Note: transactiontype = 'w' means 'workorder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to transactiondate;
Question: What kind of transaction type for the "HL Road Frame - Black, 48" order happened in 2012/12/13?
SQL: SELECT transactionhistory.transactiontype FROM transactionhistory INNER JOIN product ON transactionhistory.productid = product.productid WHERE product.name = 'HL Road Frame - Black, 48' AND strftime('%Y-%m-%d',transactionhistory.transactiondate) = '2013-07-31'
Database: works_cycles
Note: transactiontype = 'w' means 'workorder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to transactiondate;
Question: Which type of transaction was it for the "LL Road Handlebars" order happened in 2012/11/3?
SQL: SELECT transactionhistoryarchive.transactiontype FROM transactionhistoryarchive INNER JOIN product ON transactionhistoryarchive.productid = product.productid WHERE product.name = 'LL Road Handlebars' AND strftime('%Y-%m-%d',transactionhistoryarchive.transactiondate) = '2012-11-03'
Database: works_cycles
Note: creditrating = 1 means 'Superior'; creditrating = 2 means 'Excellent'; creditrating = 3 means 'Above average'; creditrating = 4 means 'Superior'; creditrating = 5 means 'Below average';
Question: How is the Credit Rating for company whose rowguid is "33671A4E-DF2B-4879-807B-E3F930DD5C0C"?
SQL: SELECT vendor.creditrating FROM vendor INNER JOIN businessentity ON vendor.businessentityid = businessentity.businessentityid WHERE businessentity.rowguid = '33671A4E-DF2B-4879-807B-E3F930DD5C0C'
Database: works_cycles
Note: preferredvendorstatus = 1 means 'Do not use if another vendor is available'; creditrating = 2 means 'Preferred over other vendors supplying the same product';
Question: What is the PreferredVendorStatus for the company which has the rowguid of "684F328D-C185-43B9-AF9A-37ACC680D2AF"?
SQL: SELECT vendor.preferredvendorstatus FROM vendor INNER JOIN businessentity ON vendor.businessentityid = businessentity.businessentityid WHERE businessentity.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'
Database: works_cycles
Note: activeflag = 1 means 'vendor no longer used'; activeflag = 2 means 'vendor is actively used;
Question: For person id No.2054, is his/her vendor still active?
SQL: SELECT vendor.activeflag FROM vendor INNER JOIN businessentitycontact ON vendor.businessentityid = businessentitycontact.businessentityid WHERE businessentitycontact.personid = 2054