db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the name of the subcategory to which the gray product with the lowest safety stock level belongs?
SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 USING (ProductSubcategoryID) WHERE T2.Color = 'Grey' GROUP BY T1.Name
gray is color of product
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the product cost end date with the highest weight in grams?
SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1
in grams refers to WeightUnitMeasureCode = 'G'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the percentage of the total products ordered were not rejected by Drill size?
SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10
rejected quantity refers to ScrappedQty; rejected by Drill size refers to Name in ('Drill size too small','Drill size too large'); percentage = DIVIDE(SUM(ScrappedQty) where Name in('Drill size too small','Drill size too large'), OrderQty)
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Calculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.
SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID
shipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
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.
SELECT T2.Name FROM SalesTerritory AS T1 INNER JOIN StateProvince AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode INNER JOIN SalesTaxRate AS T3 ON T2.StateProvinceID = T3.StateProvinceID ORDER BY (T1.SalesYTD - T1.SalesLastYear) / T1.SalesLastYear DESC LIMIT 1
sales of previous year refers to SalesLastYear; SalesYTD refers to year to date sales; increase in sales = DIVIDE(SUBTRACT(SalesYTD, SalesLastYear), SalesLastYear)*100
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many employees earn their salaries on a monthly basis at an hourly rate of more than 50?
SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50
employee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the employee of company number 1's full name?
SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'
company number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the name of the supplier number 1492?
SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492
supplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many vendors only consented to move on with the 500 to 15000 piece order in terms of quality?
SELECT COUNT(*) FROM ProductVendor WHERE MinOrderQty > 500 AND MaxOrderQty < 15000
Vendor refers to BusinessEntityId; 500 to 15000 piece order refers to MinOrderQty > 500 and MaxOrderQty < 15000
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the departments that are part of the Executive General and Administration group.
SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'
Department refers to Name where GroupName = 'Executive General and Administration'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the family names of any employees whose middle names begin with C.
SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'
family names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many vendors are having their products ordered with an average delivery time of 25 days?
SELECT COUNT(DISTINCT BusinessEntityID) FROM ProductVendor WHERE AverageLeadTime = 25
vendors refers to distinct BusinessEntityID; average delivery time of 25 days refers to AverageLeadTime = 25 and onOrderQty > 0
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list any 3 product numbers with the lowest standard cost.
SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3
product number = productID
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many black-colored products are there that cannot be sold?
SELECT COUNT(ProductID) FROM Product WHERE FinishedGoodsFlag = 0 AND Color = 'Black'
cannot be sold means product is not a salable item which refers to FinishedGoodsFlag = 0
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the top three employees with the most unused sick leave along with their position titles.
SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3
employees refers to BusinessEntityID; most unused sick leave refers to MAX(SickLeaveHours); position title refers to JobTitle
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the full address of address number 11906?
SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906
address number refers to AddressID; full address refers to AddressLine1 + AddressLine2
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is business number 1580's net profit?
SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the sales revenue for item number 740?
SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many customers gave a product the best possible rating? Please list their names.
SELECT ReviewerName FROM ProductReview WHERE Rating = 5
customers' name refers to ReviewerName; best possible ratings means the highest rating = 5
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.
SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )
poor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the forename and birthdate of person number 18?
SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18
person number 18 refers to BusinessEntityID = 18; forename refers to FirstName
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What job is person number 322 currently holding?
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332
person number 322 refers to PersonID = 18; job is the name of contacttype
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list 3 businesses along with their IDs that use cellphones.
SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3
business along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the currency of Brazil?
SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many people work in the finance department?
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?
SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name
business number refers to BusinessEntityID where BusinessEntityID = 1496; how long does it take refers to AverageLeadTime
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode
SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore'))
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which chromoly steel product model has AdventureWorks saved in English?
SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'
Saved in English refers to product description written in English where Culture.name = 'English'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.
SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018
geographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the various phone number types in the following order, from most to least common among businesses.
SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID GROUP BY T2.Name ORDER BY COUNT(T2.Name) DESC
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which role has the most common contact among businesses?
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID GROUP BY T1.Name ORDER BY COUNT(T1.Name) DESC LIMIT 1
Most common contact among businesses refers to BusinessEntityContact with the most name
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the salespeople's email addresses?
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'
Salespeople refers to PersonType = 'SP'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which position does Suchitra hold?
SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Suchitra'
position refers to JobTitle
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many employees work for AdvertureWorks that is single?
SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'
Employees refer to PersonType = 'EM'; Single refers to MaritalStatus = 's'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How much do the works data saved in English and Arabic differ from one another?
SELECT SUM(CASE WHEN T1.Name = 'English' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID WHERE T1.Name = 'English' OR T1.Name = 'Arabic'
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'))
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the location of business number 1?
SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1
Location refers to AddressLine1; business number refers to the BusinessEntityID where BusinessEntityID = 1
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please list the businesses along with their numbers that have their accounts located in Duvall.
SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Duvall'
Business along with their numbers refers to the BusinessEntityID; located in Duvall refers to City = 'Duvall'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What percentage of the AdventureWorks data is in Thai?
SELECT CAST(SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CultureID) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID
percentage = DIVIDE(Culture.Name = 'Thai', count(ALL Culture.Name))*100%
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What percentage of AdventureWorks employees are men?
SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'
male refers to Gender = 'M'; employee refers to PersonType = 'EM'; percentage = DIVIDE(COUNT(Gender = 'M'), COUNT(PersonType = 'MY'))*100%;
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Where is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?
SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873
Address number 15873 refers to AddressID = '15873'; IsOnlyStateProvinceCode = '0' refers to StateProvinceCode exists; IsOnlyStateProvinceCode = '1' refers to StateProvinceCode unavailable;
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the full address of business number 24?
SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24
Full address refers to AddressLine1+AddressLine2; business number 24 refers to BusinessEntityID = '24'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which year is credit card No.9648's Expiration Year?
SELECT ExpYear FROM CreditCard WHERE CreditCardID = 9648
Expiration year refers to ExpYear
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What's Emma H Harris's Business Entity ID number?
SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the location id for Debur and Polish?
SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'
Debur and Polish is name of manufacturing location
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the Department ids under the Sales and Marketing Group?
SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'
Sales and Marketing is group name of a department
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which sales person made the sale of 1635823.3967 last year? Give the Business Entity ID.
SELECT BusinessEntityID FROM SalesPerson WHERE SalesLastYear = '1635823.3967'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the Shift start time for Shift ID No.2?
SELECT StartTime FROM Shift WHERE ShiftID = '2'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is contact Type ID No.16 represent for?
SELECT Name FROM ContactType WHERE ContactTypeID = '16'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the minimum shipping charge for "OVERSEAS - DELUXE"?
SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'
Minimum shipping charge refers to ShipBase; OVERSEAS - DELUXE is name of shipping company
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Please tell the meaning of CultureID "fr".
SELECT Name FROM Culture WHERE CultureID = 'fr'
tell the meaning is to find the name of culture
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Give the Mauritius Rupee's currency code.
SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'
Mauritius Rupee is name of currency
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Name cellphone number's Type ID?
SELECT PhoneNumberTypeID FROM PhoneNumberType WHERE Name = 'Cell'
Cellphone refers to Name = 'Cell'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For the older production technician who was hired in 2008/12/7, what's his/her birthday?
SELECT BirthDate FROM Employee WHERE HireDate = '2008-12-07'
Oldest production technician refers to MIN(BirthDate) where JobTitle = 'Production Technician'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the product ID No.793's model name?
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the unit measure codes for product ID No.762?
SELECT T2.UnitMeasureCode FROM Product AS T1 INNER JOIN UnitMeasure AS T2 ON T1.SizeUnitMeasureCode = T2.UnitMeasureCode OR T1.WeightUnitMeasureCode = T2.UnitMeasureCode WHERE T1.ProductID = 762 GROUP BY T1.ProductID, T2.UnitMeasureCode
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Where is Business Entity ID No.4 located at? Give the address down to street.
SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )
Located refers to the total address of the entity that comprises city, addressline1, addressline2
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For the on going assembly item Component ID No. 494, what's the Unit measure for it?
SELECT T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.ComponentID = 494 AND T1.EndDate IS NULL GROUP BY T2.name
On going assembly item means the assembly item haven't been finished, therefore EndDate is null
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?
SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL
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
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
To the products which could make the profit as 21.9037, what were their list price after October of 2012?
SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'
Profit as 82.41 = SUTRACT(ListPrice, StandardCost); May of 2012 refers to StartDate = '2012-05'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the size of the photo of product id No.1?
SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 1
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many letters are there in Catherine Ward's e-mail account passwords?
SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'
Catherine Ward refers to the name of BusinessEntityID; how many letters in password for the e-mail account refers to LENGTH(PasswordHash)
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What rating did Jill give for HL Mountain Pedal?
SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'
Jill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What's the profit for the Freewheel?
SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'
SUBTRACT(LastReceiptCost, StandardPrice) for ProductID where name = 'Freewheel'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Did Rachel Valdez complete her sales task?
SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'
Complete sales task refers to meeting sales quota; if Bonus = 0, it means this salesperson doesn't meet quota and vice versa
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many types of tax did the sales happen in Quebec have?
SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'
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
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What's Kevin A Wright's email address?
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Kevin' AND T1.MiddleName = 'A' AND T1.LastName = 'Wright'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the number of State Province of France that doesn't have a State Province Code?
SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1
Doesn't have a State Province Code refers to IsOnlyStateProvinceFlag = 1 where StateProvinceCode is unavailable
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What kind of transaction type for the "HL Road Frame - Black, 48" order happened in 2012/12/13?
SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'
Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which type of transaction was it for the "LL Road Handlebars" order happened in 2012/11/3?
SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'
Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How is the Credit Rating for company whose rowguid is "33671A4E-DF2B-4879-807B-E3F930DD5C0C"?
SELECT T1.CreditRating FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '33671A4E-DF2B-4879-807B-E3F930DD5C0C'
CreditRating = 1 means 'Superior'; CreditRating = 2 means 'Excellent'; CreditRating = 3 means 'Above average'; CreditRating = 4 means 'Superior'; CreditRating = 5 means 'Below average'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the PreferredVendorStatus for the company which has the rowguid of "684F328D-C185-43B9-AF9A-37ACC680D2AF"?
SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'
PreferredVendorStatus = 1 means 'Do not use if another vendor is available'; CreditRating = 2 means 'Preferred over other vendors supplying the same product'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For person id No.2054, is his/her vendor still active?
SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054
ActiveFlag = 1 means 'Vendor no longer used'; ActiveFlag = 2 means 'Vendor is actively used
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Show me the phone number of Gerald Patel's.
SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Gerald' AND T1.LastName = 'Patel'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which is Business Entity ID No.13626's phone number type?
SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 USING (PhoneNumberTypeID) WHERE T1.BusinessEntityID = 13626
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What's Lynn N Tsoflias's job title?
SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the number of the sub categories for bikes?
SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'
Bike refers to the name of the product category, therefore ProductCategoryID = 1
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For the document Control Assistant who was hired on 2009/1/22, what is the percentage of private documents did he/she have?
SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'
Document Control Assistant refers  to the  JobTitle = 'Document Control Assistant'; hired on 2009/1/22 means the person's hiring date is HireDate = '2009-01-22'; private documents indicate that DocumentSummary is null; DIVIDE(COUNT(DocumentSummary is null), COUNT(DocumentSummary))*100
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How much is HL Grip Tape's profit ratio?
SELECT (T1.LastReceiptCost - T1.StandardPrice) / T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Grip Tape'
HL Grip Tape refers to the product name; DIVIDE(SUBTRACT(LastReceiptCost, StandardPrice)), (StandardPrice) as profit_ratio
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
For all phone numbers, what percentage of the total is cell phone?
SELECT CAST(SUM(CASE WHEN T2.Name = 'Cell' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Name) FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID
Cellphone referes to the name of the phone type, therefore PhoneNumberTypeID = 1; DIVIDE(COUNT(PhoneNumberTypeID = 1), (COUNT(PhoneNumberTypeID)) as percentage
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the product assembly ID that come with unit measure code EA and BOM level of 2, at the same time have per assembly quantity of more than 10?
SELECT ProductAssemblyID FROM BillOfMaterials WHERE UnitMeasureCode = 'EA' AND BOMLevel = 2 AND PerAssemblyQty > 10
Per assembly quantity of more than 10 is expresses as PerAssemblyQty>10
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many location IDs have actual resource hours of 2?
SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2
actual resource hours of 2 refers to ActualResourceHrs = 2
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the stocked quantity of products manufactured from location ID 40?
SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40
Stocked quantity refers to StockedQty
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?
SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name
Pre assembly quantity refers to PerAssemblyQty
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which product ID do not have any work order ID?
SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )
Do not have any work order ID means WorkOrderID is null
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the name of product purchased with transaction type P?
SELECT ProductID FROM Product WHERE ProductID IN ( SELECT ProductID FROM TransactionHistory WHERE TransactionType = 'P' )
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
State the full name of accountants in the company.
SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Accountant'
Accountants refers to JobTitle = 'Accountant'; full name includes FirstName, LastName, and MiddleName
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the job position currently occupied by Ken J Sánchez?
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Ken' AND T2.MiddleName = 'J' AND T2.LastName = 'Sánchez'
Job position refers to JobTitle
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many male employees do not wish to receive e-mail promotion?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0 AND T1.Gender = 'M'
Male refers to Gender = 'M'; employees do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Who is the top sales person who achived highest percentage of projected sales quota in 2013?
SELECT BusinessEntityID FROM SalesPerson WHERE BusinessEntityID IN ( SELECT BusinessEntityID FROM SalesPersonQuotaHistory WHERE STRFTIME('%Y', QuotaDate) = '2013' ) ORDER BY CAST(SalesLastYear AS REAL) / SalesQuota DESC LIMIT 1
2013 refers to QuotaDate = '2013'; DIVIDE(SalesLastYear), (SUM(SalesQuota where YEAR(QuotaDate) = 2013)) as percentage
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many of the non-sales employees are married?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'EM' AND T1.MaritalStatus = 'M'
Married refers to MaritalStatus = 'M';  non-sales employees refer to PersonType = 'EM'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Among the Production Technicians who are single, how many of them are vendor contact?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T1.MaritalStatus = 'S' AND T2.PersonType = 'VC'
Production Technicians refer to the  JobTitle = 'Production Technician%'; single refers to MaritalStatus = 'S'; Vendor contact refers to PersonType = 'VC'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the total sick leave hours of employees who do not wish to receive any e-mail promotion?
SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0
Employees who do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Among the sales people, who are hired prior to 2010?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' AND SUBSTR(T1.HireDate, 0, 4) < 2010
Sales people refer to PersonType = 'SP'; hired prior to 2010 means the person's hiring date was before 2010, therefore year(HireDate)<2010
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Which sales person achieved the highest sales YTD? What is the projected yearly sales quota in 2011 for this person?
SELECT T1.BusinessEntityID, SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2011' GROUP BY T1.BusinessEntityID ORDER BY SUM(T1.SalesYTD) DESC LIMIT 1
Sales people refer to PersonType = 'SP'; projected yearly sales refers to SalesQuota
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many people with the name Alex are single and occupying organization level of 1?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Alex' AND T1.MaritalStatus = 'S' AND T1.OrganizationLevel = 1
Alex refers to FirstName = 'Alex'; single refers to MaritalStatus = 'S'
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
What is the average vacation hours taken by Sales person?
SELECT CAST(SUM(T1.VacationHours) AS REAL) / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'
Store Contact refers PersonType = 'SC'; AVG(VacationHours
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
State the last name and job title of owner for document "Crank Arm and Tire Maintenance".
SELECT T1.LastName, T3.JobTitle FROM Person AS T1 INNER JOIN Document AS T2 ON T1.BusinessEntityID = T2.Owner INNER JOIN Employee AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Title = 'Crank Arm and Tire Maintenance'
The owner refers to BusinessEntityID
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
How many employees do not have any suffix and what are their organization level?
SELECT COUNT(T3.BusinessEntityID) FROM ( SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T2.Suffix IS NULL GROUP BY T1.BusinessEntityID ) AS T3
Do not have any suffix means Suffix is null
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Among the sales people who achieved projected sales quota 2013, is there any person from territory ID 1? If yes, state the business entity ID.
SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 1 AND STRFTIME('%Y', QuotaDate) = '2013'
projected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013;
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
【DB_ID】 works_cycles 【Schema】 # Table: main.Address [ (AddressID:INTEGER, Primary Key, Examples: [18089, 23192, 25702]), (AddressLine1:TEXT, Examples: [#500-75 O'Connor Street]), (AddressLine2:TEXT, Examples: [Space 55, Unit B-105, #3]), (City:TEXT, Examples: [Ottawa, Burnaby, Dunkerque]), (StateProvinceID:INTEGER, Exa...
Who are the employees that submitted resume to Human Resource Department and got hired? State the last name.
SELECT T3.LastName FROM Employee AS T1 INNER JOIN JobCandidate AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.BusinessEntityID IN (212, 274)
employees that submitted resume to Human Resource Department and got hired refers to BusinessEntittyID NOT null;