db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
1
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
works_cycles
For all the products, list the product name and its corresponding start date for the current standard cost.
The current standard cost refers to EndDate is NULL
SELECT T1.Name, T2.StartDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.EndDate IS NULL
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List the products whereby the standard cost is $80 more than previous standard cost in history.
SUBTRACT(product.StandardCost, CostHistory.StandardCost)>80
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Name all products and total quantity for each item for shopping cart ID 14951.
null
SELECT T1.Name, T2.Quantity FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 14951
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List the product name with more than 5 quantity in the shopping cart.
Product with more than 5 quantity refers to Quantity>5
SELECT T1.Name FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 5
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
For all the purchase order transactions, name all the products with low quality.
Low quality refers to the product's quality class, therefore Class = 'L'
SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'L' AND T2.TransactionType = 'P' ORDER BY T1.Name
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Provide all the transactions whereby the quantiy is more than 10,000 pieces. State the product name and the selling price.
Quantity more than 10,000 pieces refers to Quantity>10000; selling price refers to ListPrice
SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which is a high quality product but with the lowest transacted quantity?
High quality refers to the product's quality class, therefore Class = 'H'; the lowest transacted quantity refers to Quantity = 1
SELECT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'H' ORDER BY T2.Quantity ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many transactions are there for product under the Mountain line?
The Mountain line refers to the product line, therefore ProductLine = 'M'
SELECT COUNT(T2.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How much would be the total sales profit for shopping cart ID 20621 ?
Sales profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost; Quantity)), where ShoppingCartID = '20621'
SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List all product names that are high in quality. Please also state its selling price.
High quality refers to the product's quality class, therefore Class = 'H'
SELECT Name, ListPrice FROM Product WHERE Class = 'H'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which product line has the most products that are salable?
Saleable product refers to FinishedGoodsFlag = 1
SELECT ProductLine FROM Product WHERE FinishedGoodsFlag = 1 GROUP BY ProductLine ORDER BY COUNT(FinishedGoodsFlag) DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Provide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments.
reviewer whose name begin with letter 'J' = ReviewerName LIKE 'J%'
SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
State the product name, product line, rating and the selling price of product with the lowest rating.
Product with the lowest rating refers to the rating given by the reviewer where Rating = 1
SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Calculate the profit of each products. List all products with more than $100 in profit.
Profit = AVG(SUBTRACT(ListPrice, StandardCost)>100
SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List down the product name, reviewer name, rating and comments for product under the road line.
The Road line refers to the product line, therefore ProductLine = 'R'
SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many people reviewed for product named HL Mountain Pedal? What is the average rating?
AVG(Rating) = DIVIDE(SUM(rating), COUNT(ReviewerName))
SELECT COUNT(T1.ProductID), AVG(T2.Rating) FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Mountain Pedal'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List the purchase order whereby all received quantity were rejected? Name those product.
Rejected refers rejected product in which to RejectedQty = 1
SELECT T1.Name FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = T2.ReceivedQty AND T2.RejectedQty <> 0
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among all products without any rejected quantity, which product has the highest line total? State the product name and unit price.
Product without any rejected quantity refers to RejectedQty = 0
SELECT T1.Name, T2.UnitPrice FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = 0 ORDER BY T2.LineTotal DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List all product names and its product line for all purchase order with order quantity of 5000 or more.
Purchase order with order quantity of 5000 or more refers to OrderQty> = 5000
SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the total ordered quantity for products under the 'Touring' line?
The Touring line refers to the product line, therefore ProductLine = 'T'
SELECT SUM(T2.OrderQty) FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'T'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the low quality product, which product has the highest line total? List the product name and its line total?
Low quality refers to the product's quality class, therefore Class = 'L'
SELECT T1.Name, T2.LineTotal FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE Class = 'L' ORDER BY OrderQty * UnitPrice DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which product has the highest profit on net? State the product name.
Profit on net = SUBTRACT(LastReceiptCost, StandardPrice)
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List all products with minimum order quantity of 100 and order them by product name in descending order.
miinimum order quantity refers to MinOrderQty = 100
SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List the name and calculate its profit for product with the highest rating in review.
Profit = SUBTRACT(ListPrice, StandardCost); the highest rating in review refers to Rating = 5
SELECT T1.Name, T1.ListPrice - T1.StandardCost FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the total profit all transactions with product ID 827?
Profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity))
SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which currency pair's average exchange rate for the day is the highest?
currency pair refers to FromCurrencyCode/ToCurrencyCode
SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many products with the highest unit price were ordered?
number of products refers to OrderQty
SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?
United States refers to CountryRegionCode = 'US';
SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the full name of the Document Control Manager who is in charge of all Level 1 approved documents?
full Name = FirstName+MiddleName+Last Name; approved document refers to Status = 2;
SELECT T1.FirstName, T1.MiddleName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Document AS T3 ON T3.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Manager' AND T3.DocumentLevel = 1 AND T3.Status = 2 GROUP BY T1.FirstName, T1.MiddleName, T1.LastName
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which customer has the highest subtotal amount of sales orders whose assigned to the salesperson with the highest bonus?
highest subtotal amount of sales order refers to max(SubTotal);
SELECT T1.CustomerID FROM SalesOrderHeader AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID ORDER BY T1.SubTotal DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the total price of Sales Order ID 46625 with Volume Discount 11 to 14 and Product ID 716?
total price = multiply(UnitPrice, OrderQty);
SELECT T2.UnitPrice * T2.OrderQty FROM SpecialOffer AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.Description = 'Volume Discount 11 to 14' AND T1.SpecialOfferID = 2 AND T2.ProductID = 716 AND T2.SalesOrderID = 46625
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Of the products that has a reorder inventory point of no more than 600, how many manufactured in-house products that takes 1 day to manufacture with BOM Level 4 are there?
ReorderPoint<600; product is manufactured in-house refers to Makeflag = 1;
SELECT COUNT(T1.ProductID) FROM Product AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.ProductID = T2.ProductAssemblyID WHERE T1.MakeFlag = 1 AND T1.DaysToManufacture = 1 AND T2.BOMLevel = 4 AND T1.ReorderPoint <= 600
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the highest amount of bonus earned by the sales person in Canada?
Canada is name of a sales territory
SELECT T2.Bonus FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.CountryRegionCode = 'CA' ORDER BY T2.SalesQuota DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What are the names of the product that has the lowest rating?
lowest rating refers to Rating = 1;
SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating ASC LIMIT 1 )
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many of the workers who started working in 2009 are from the Production Department?
StartDate BETWEEN '2009-01-01' AND '2009-12-31';
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.StartDate >= '2009-01-01' AND T2.StartDate < '2010-01-01' AND T1.Name = 'Production'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Who is the company's highest-paid single female employee? Include her full name and job title.
full name = FirstName+MiddleName+LastName; highest-paid refers to max(Rate); single refers to Status = 'S'; female refers to Gender = 'F';
SELECT T3.FirstName, T3.MiddleName, T3.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'F' ORDER BY T2.Rate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Who is the Vice President of Engineering and when did he join the company? Indicate his/her full name.
full name = FirstName+MiddleName+LastName; HiredDate refers to the date the person joins the company;
SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.HireDate FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Vice President of Engineering'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many active employees whose payrate is equal or below 30 per hour.
active employee refers to CurrentFlag = 1; Rate< = 30;
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Rate <= 30
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which department has a worker who just recently started working?
recently started working refers to latest StartDate;
SELECT T1.Name FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID ORDER BY T2.StartDate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which store sales person was reently hired? Indicate his/her full name and gender.
SC is an abbreviation for Store Contact; store contact person refers to PersonType = 'SC'; recently hired refers to latest StartDate;
SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.Gender FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How frequently do the employee with the least number of sick leave hours get paid?
least number of sick leave refers to min(SickLeaveHours); PayFrequency = 1 means ‘Salary received monthly’; PayFrequency = 2 means ‘Salary received biweekly';
SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Which job title has the lowest pay?
lowest pay refers to min(Rate);
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the total number of employees that worked in the Finance department?
null
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the profit of the product with the highest list price and of the product with the lowest list price other than 0? Indicates the depth the component is from its parent.
profit = subtract(ListPrice, StandardCost); the depth the component from its parent refers to BOMLevel;
SELECT ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice DESC LIMIT 1 ) , ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice LIMIT 1 )
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the companies to which Adventure Works Cycles purchases parts or other goods, what is the profit on net obtained from the vendor who has an above average credit rating? Kindly indicate each names of the vendor and the corresponding net profits.
above average credit rating refers to CreditRating = 3; profit on net = subtract(LastReceiptCost, StandardPrice);
SELECT T2.Name, T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CreditRating = 3
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many accounts have an address that is too long?
address that is too long refers to AddressLine2! = null
SELECT COUNT(*) FROM Address WHERE AddressLine2 <> ''
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the postal code of the street address of the account that is latest updated?
account latest updated refers to year(ModifiedDate) = 2022 and month(ModifiedDate) = 10
SELECT PostalCode FROM Address ORDER BY ModifiedDate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the longest assembly item duration for bicycles?
longest assembly item duration = max(subtract(EndDate,StartDate))
SELECT JULIANDAY(EndDate) - JULIANDAY(StartDate) FROM BillOfMaterials ORDER BY JULIANDAY(EndDate) - JULIANDAY(StartDate) DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many assembly items for bicycles aren't finished?
assembly lines that are not finished refers to EndDate = null
SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please list the unit measure code of the component that is of the greatest need in quantity to create the assembly.
greatest need in quantity refers to max(PerAssemblyQty)
SELECT UnitMeasureCode FROM BillOfMaterials ORDER BY PerAssemblyQty DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many product maintenance documents are private?
product maintenance documents are private refers to DocumentSummary = null
SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please list the titles of the documents that are pending approval.
documents pending approval refers to Status = 1
SELECT Title FROM Document WHERE Status = 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please list the job titles of the employees who has a document that has been approved.
document has been approved refers to Status = 2
SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the pay frequency of the oldest employee?
oldest employee refers to min(BirthDate); PayFrequency = 1 refers to ‘Salary received monthly’; PayFrequency = 2 refers to ‘Salary received biweekly'
SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the employees whose pay frequencies are the highest, how many of them are married?
married refers to MaritalStatus = M; highest pay frequency refers to PayFrequency = 2
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T1.PayFrequency = ( SELECT PayFrequency FROM EmployeePayHistory ORDER BY PayFrequency DESC LIMIT 1 )
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
For the employee who has been hired the latest, what is his or her pay rate?
hired the latest refers to max(HireDate)
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.HireDate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the employees who have a pay rate of above 40, how many of them are male?
pay rate above 40 refers to Rate>40; male employee refers to Gender = M
SELECT SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate > 40
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the highest pay rate of the employees who are exempt from collective bargaining?
employee exempt from collective bargaining refers to SalariedFlag = 1; highest pay rate refers to max(Rate)
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SalariedFlag = 1 ORDER BY T1.Rate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
For the employees who have the highest pay frequency, please list their vacation hours.
highest pay frequency refers to PayFrequency = 2
SELECT T2.VacationHours FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.BusinessEntityID = ( SELECT BusinessEntityID FROM EmployeePayHistory ORDER BY Rate DESC LIMIT 1 )
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the pay rate of the employee who has the longest vacation hours?
longest vacation hour refers to max(VacationHours)
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.VacationHours DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many employees with a pay rate of over 35 have more than 10 sick leave hours?
more than 10 sick leave hours refers to SickLeaveHours>10; pay rate over 35 refers to Rate>35;
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SickLeaveHours > 10 AND T1.Rate > 35
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the active male employees, how many of them are paid with the highest frequency?
active status of employees refers to CurrentFlag = 1; Male refers to Gender = 'M'; highest frequency refers to PayFrequency = 2;
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many male employees have the job position of sales person?
Sales person refers to PersonType = 'SP'; Male refers to Gender = 'M';
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T2.PersonType = 'SP'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the job position of the oldest employee?
Oldest employee refers to Max ( Subtract((now())-BirthDate));
SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the name style of the employee with the lowest pay rate?
lowest pay rate refers to Min(Rate);
SELECT T2.NameStyle FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate IS NOT NULL ORDER BY T1.Rate ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the employees who are married, how many of them have a western name style?
married refers to MaritalStatus = 'M'; western name style refers to NameStyle = '0';
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.MaritalStatus = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the employees who have more than 10 hours of sick leave, how many of them wish to receive e-mail promotions?
Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 10 hours of sick leave refer to SickLeaveHours >10;
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.SickLeaveHours > 10
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please list the employees who have more than 20 vacations hours and wish to receive e-mail promotions.
Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 20 vacations hours refers to VacationHours>20
SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.VacationHours > 20
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please give the additional contact information of the oldest employee with the jod position of sales person.
Sales person refers to PersonType = 'SP'; oldest employee refers to Max (Subtract((now())-BirthDate));
SELECT T2.AdditionalContactInfo FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE PersonType = 'SP' ORDER BY T1.BirthDate ASC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the first name of the male employee who has a western name style?
western name style refers to NameStyle = 0; Male refers to Gender = 'M';
SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.Gender = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the active employees, how many of them have a courtesy title of "Mr"?
active status of employees refers to CurrentFlag = 1;
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please give the personal information of the married employee who has the highest pay rate.
married refers to MaritalStatus = 'M'; Highest pay rate refers to Max(Rate)
SELECT T2.Demographics FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' ORDER BY T3.Rate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the surname suffix of the employee who works as a store contact and has the longest sick leave hours?
store contact refers to PersonType = 'SC';
SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the married employees with the highest pay frequency, how many of them have an eastern name style?
married refers to MaritalStatus = 'M'; Eastern name style refers to NameStyle = 1;
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' AND T2.NameStyle = 1 AND T3.Rate = ( SELECT Rate FROM EmployeePayHistory ORDER BY Rate DESC LIMIT 1 )
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many active employees do not wish to receive e-mail promotions?
active status of employees refers to CurrentFlag = 1; the employee does not wish to receive an e-mail promotion refers to EmailPromotion = 0;
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.EmailPromotion = 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Please list the credit card IDs of the employees who work as store contact.
store contact refers to PersonType = 'SC';
SELECT T2.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many vacation hours do the male employees have on average?
employee refers to PersonType = 'EM'; Male refers to Gender = 'M'; Average = Divide( SUM(VacationHours(PersonType = 'EM'& Gender = 'M')),Count(BusinessEntityID(PersonType = 'EM' & Gender = 'M')));
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 T1.Gender = 'M' AND T2.PersonType = 'EM'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the employees who are married and wish to receive e-mail promotions, how much higher is their highest pay rate from the average pay rate?
married refers to MaritalStatus = 'M'; Contact does wish to receive e-mail promotions from Adventure Works refers to EmailPromotion = 1; Average = Divide (Sum(Rate (MaritalStatus = 'M' & EmailPromotion = 1))), Count (BusinessEntityID (MaritalStatus = 'M' & EmailPromotion = 1)); MAX(Rate (MaritalStatus = 'M' & EmailPromotion = 1) - Average;
SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
If a married employee has a western name style, what is the probability of him or her working as a store contact?
married refers to MaritalStatus = 'M'; western name style refers to NameStyle = 0; store contact refers to PersonType = 'SC'; probability = Divide (Count (BusinessEntityID( PersonType = 'SC' & MaritalStatus = 'M')), Count (BusinessEntityID ( PersonType) & MariatlStatus = 'M'))
SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Among the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?
CurrentFlag = 1 refers to the active status of employees; Percentage = Divide (Count (BusinessEntityID (CurrentFlag = 1 & VacationHours >20 & SickLeaveHours > 10)), Count (BusinessEntityID (CurrentFlag = 1 & SickLeaveHours>10))) * 100;
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
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Average of the last receipt cost of the products whose average lead time is 60 days.
average = DIVIDE(SUM(lastreceiptcost), COUNT(OnorderQty)) where AverageLeadTime = 60
SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Average cost of purchase orders made during the first six months of 2012.
purchase orders refers to TransactionType = 'P'; first six months of 2012 refers to TransactionDate bewteen '2012-01-01'and '2012-06-30'; average = DIVIDE(ActualCost where TransactionType = 'P', count(TransactionID))
SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What percentage of male employees hired throughout the years 2009 are married?
male refers to Gender = 'M'; hired throughout the years 2009 refers to Year(HireDate) = 2009; married refers to MaritalStatus = 'M'; percentage = DIVIDE(count(BusinessEntityID(Gender = 'M'& Year(HireDate) = '2009& MaritalStatus = 'M')), count(BusinessEntityID(Gender = 'M'& Year(HireDate) = 2009)))
SELECT CAST(SUM(CASE WHEN MaritalStatus = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee WHERE SUBSTR(HireDate, 1, 4) = '2009' AND Gender = 'M'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What percentage of people named Mary who wants Receive Email promotions of AdventureWorks and selected partners are store contacts?
wants Receive Email promotions of AdventureWorks and selected partners refers to EmailPromotion = 2; store contact refers to PersonType = 'SC'; percentage = DIVIDE(count(BusinessEntityID(FirstName = 'Marry'&EmailPromotion = '2')),count(BusinessEntityID)))
SELECT CAST(SUM(CASE WHEN EmailPromotion = 2 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN PersonType = 'SC' THEN 1 ELSE 0 END) FROM Person WHERE FirstName = 'Mary'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List, by ProductID, all products whose profit, relative to the standard price, is negative.
Profit = SUBTRACT(StandardPrice, LastRecipeCost)
SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 0
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the average total due price of products with approved status?
approved refers to Status = 2 , average total due price = AVG( DIVIDE(TotalDue, SUM(Status = 2 )))
SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?
quantities not greater than 3 refers to OrderQty<3; discount of 0.2 refers to UnitPriceDiscount = 0.2; percentage = DIVIDE(count(SalesOrderID(OrderQty<3 & UnitPriceDiscount = 0.2)), count(SalesOrderID))*100%
SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Lists all companies by BusinessEntityID that increased their current year sales by more than 60% over last year's sales and have a bonus greater than 3,000.
increased their current year sales by more than 60% refers to DIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6
SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Add the number of businesses that indicate their home address as their address and those whose address corresponds to the shipping address.
their home address as their address refers to AddressTypeID = 2; address corresponds to the shipping address refers to AddressTypeID = 5
SELECT SUM(CASE WHEN T2.Name = 'Home' THEN 1 ELSE 0 END) , SUM(CASE WHEN T2.Name = 'Shipping' THEN 1 ELSE 0 END) FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Identifies the ID number of the customer whose sales order for 32 units had a unit price of 35.
sales order for 32 units refers to OrderQty = 32
SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What company has a Colonial Voice card that expired in March 2005?
Colonial Voice card refers to CardType = 'ColonialVoice' ; expired in March 2005 refers to ExpMonth = 3, ExpYear = 2005
SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardType = 'ColonialVoice' AND T1.ExpMonth = 3 AND T1.ExpYear = 2005
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the credit rating of the company whose average lead time is 16 days for a standard price of 18.9900 and whose last receipt date is August 27, 2011?
last receipt date is August 17, 2011 refers to LastReceiptDate> = '2011-08-17 00:00:00' and LastReceiptDate < '2011-08-18 00:00:00';
SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Calculate the number of products if we add the products of the accessories and components categories.
null
SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What is the job title of the newest employee in department 12?
newest employee refers to MAX(StartDate)
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.DepartmentID = 12 ORDER BY T2.StartDate DESC LIMIT 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
List the first and last name of all unmarried male Production Supervisors.
unmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title
SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
How many products are there if we add all those located in the Subassembly category?
located in the Subassembly category refers to Name = 'Subassembly'
SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Sum the total number of products rejected for having a trim length that is too long.
number of product rejected refers to ScrapedQty; trim length that is too long refers to scrap reason where Name = 'Trim length too long'
SELECT SUM(T2.ScrappedQty) FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Trim length too long'
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
Calculate the total quantity of purchased product that has been prepared by employee number 257 and is in pending shipment status.
employee number 257 refers to EmployeeID = 257; pending shipment status refers to Status = 3
SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
If we discount the products that do not have any type of offer, how many different products have been sold in an amount greater than 2 units per order?
do not have any type of offer refers to Description = 'No Discount'; sold in an amount greater than 2 refers to OrderQty>2
SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,
works_cycles
What type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units?
yellow product refers to Color = 'Yellow'; minimum inventory stock of 500 units refers to SafetyStockLevel = 500
SELECT DISTINCT T2.TransactionType FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Size = 62 AND T1.Color = 'Yellow' AND T1.SafetyStockLevel = 500
database name:db_id works_cycles CountryRegion table CountryRegion Cols: Country Region Code dtype text, Name dtype text, modified date dtype datetime, Culture table Culture Cols: Culture ID dtype text, Name dtype text, modified date dtype datetime, Currency table Currency Cols: Currency Code dtype text, Name dtype text, modified date dtype datetime, CountryRegionCurrency table CountryRegionCurrency Cols: Country Region Code dtype text, Currency Code dtype text, modified date dtype datetime, Person table Person Cols: Business Entity ID dtype integer, Person Type dtype text, Name Style dtype integer, Title dtype text, First Name dtype text, Middle Name dtype text, Last Name dtype text, Suffix dtype text, Email Promotion dtype integer, Additional Contact Info dtype text, Demographics dtype text, rowguid dtype text, modified date dtype datetime, BusinessEntityContact table BusinessEntityContact Cols: Business Entity ID dtype integer, Person ID dtype integer, Contact Type ID dtype integer, rowguid dtype text, modified date dtype datetime, EmailAddress table EmailAddress Cols: Business Entity ID dtype integer, Email Address ID dtype integer, Email Address dtype text, rowguid dtype text, modified date dtype datetime, Employee table Employee Cols: Business Entity ID dtype integer, National ID Number dtype text, Login ID dtype text, Organization Node dtype text, Organization Level dtype integer, Job Title dtype text, Birth Date dtype date, Marital Status dtype text, Gender dtype text, Hire Date dtype date, Salaried Flag dtype integer, Vacation Hours dtype integer, Sick Leave Hours dtype integer, Current Flag dtype integer, rowguid dtype text, modified date dtype datetime, Password table Password Cols: Business Entity ID dtype integer, Password Hash dtype text, Password Salt dtype text, rowguid dtype text, modified date dtype datetime, PersonCreditCard table PersonCreditCard Cols: Business Entity ID dtype integer, Credit Card ID dtype integer, modified date dtype datetime, ProductCategory table ProductCategory Cols: Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, ProductDescription table ProductDescription Cols: Product Description ID dtype integer, Description dtype text, rowguid dtype text, modified date dtype datetime, ProductModel table ProductModel Cols: Product Model ID dtype integer, Name dtype text, Catalog Description dtype text, Instructions dtype text, rowguid dtype text, modified date dtype datetime, ProductModelProductDescriptionCulture table ProductModelProductDescriptionCulture Cols: Product Model ID dtype integer, Product Description ID dtype integer, Culture ID dtype text, modified date dtype datetime, ProductPhoto table ProductPhoto Cols: Product Photo ID dtype integer, Thumb Nail Photo dtype blob, Thumbnail Photo File Name dtype text, large photo dtype blob, Large Photo File Name dtype text, Modified Date dtype datetime, ProductSubcategory table ProductSubcategory Cols: Product Subcategory ID dtype integer, Product Category ID dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, SalesReason table SalesReason Cols: SalesReasonID dtype integer, Name dtype text, ReasonType dtype text, modified date dtype datetime, SalesTerritory table SalesTerritory Cols: TerritoryID dtype integer, Name dtype text, Country Region Code dtype text, Group dtype text, Sales Year to Date dtype real, Sales Last Year dtype real, Cost Year to Date dtype real, Cost Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPerson table SalesPerson Cols: Business Entity ID dtype integer, Territory ID dtype integer, Sales Quota dtype real, Bonus dtype real, Commission percentage dtype real, sales year to date dtype real, Sales Last Year dtype real, rowguid dtype text, modified date dtype datetime, SalesPersonQuotaHistory table SalesPersonQuotaHistory Cols: Business Entity ID dtype integer, Quota Date dtype datetime, Sales Quota dtype real, rowguid dtype text, modified date dtype datetime, SalesTerritoryHistory table SalesTerritoryHistory Cols: Business Entity ID dtype integer, Territory ID dtype integer, Start Date dtype datetime, End Date dtype datetime, rowguid dtype text, modified date dtype datetime, ScrapReason table ScrapReason Cols: Scrap Reason ID dtype integer, Name dtype text, modified date dtype datetime, Shift table Shift Cols: ShiftID dtype integer, Name dtype text, Start Time dtype text, End Time dtype text, modified date dtype datetime, ShipMethod table ShipMethod Cols: Ship Method ID dtype integer, Name dtype text, Ship Base dtype real, Ship Rate dtype real, rowguid dtype text, modified date dtype datetime, SpecialOffer table SpecialOffer Cols: Special Offer ID dtype integer, Description dtype text, Discount precentage dtype real, Type dtype text, Category dtype text, Start Date dtype datetime, End Date dtype datetime, Min Quality dtype integer, Max Quality dtype integer, rowguid dtype text, modified date dtype datetime, BusinessEntityAddress table BusinessEntityAddress Cols: Business Entity ID dtype integer, Address ID dtype integer, Address Type ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesTaxRate table SalesTaxRate Cols: Sales Tax Rate ID dtype integer, State Province ID dtype integer, Tax Type dtype integer, Tax Rate dtype real, Name dtype text, rowguid dtype text, modified date dtype datetime, Store table Store Cols: Business Entity ID dtype integer, Name dtype text, Sales Person ID dtype integer, Demographics dtype text, rowguid dtype text, modified date dtype datetime, SalesOrderHeaderSalesReason table SalesOrderHeaderSalesReason Cols: Sales Order ID dtype integer, Sales Reason ID dtype integer, modified date dtype datetime, TransactionHistoryArchive table TransactionHistoryArchive Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, UnitMeasure table UnitMeasure Cols: Unit Measure Code dtype text, Name dtype text, modified date dtype datetime, ProductCostHistory table ProductCostHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, Standard Cost dtype real, modified date dtype datetime, ProductDocument table ProductDocument Cols: Product ID dtype integer, Document Node dtype text, modified date dtype datetime, ProductInventory table ProductInventory Cols: Product ID dtype integer, Location ID dtype integer, Shelf dtype text, Bin dtype integer, Quantity dtype integer, rowguid dtype text, modified date dtype datetime, ProductProductPhoto table ProductProductPhoto Cols: Product ID dtype integer, Product Photo ID dtype integer, Primary dtype integer, Modified Date dtype datetime, ProductReview table ProductReview Cols: Product Review ID dtype integer, Product ID dtype integer, Reviewer Name dtype text, Review Date dtype datetime, Email Address dtype text, Rating dtype integer, Comments dtype text, modified date dtype datetime, ShoppingCartItem table ShoppingCartItem Cols: Shopping CartItem ID dtype integer, Shopping Cart ID dtype text, Quantity dtype integer, Product ID dtype integer, Date Created dtype datetime, modified date dtype datetime, SpecialOfferProduct table SpecialOfferProduct Cols: Special Offer ID dtype integer, Product ID dtype integer, rowguid dtype text, modified date dtype datetime, SalesOrderDetail table SalesOrderDetail Cols: SalesOrderID dtype integer, SalesOrderDetailID dtype integer, CarrierTrackingNumber dtype text, OrderQty dtype integer, ProductID dtype integer, SpecialOfferID dtype integer, UnitPrice dtype real, UnitPriceDiscount dtype real, LineTotal dtype real, rowguid dtype text, ModifiedDate dtype datetime, TransactionHistory table TransactionHistory Cols: Transaction ID dtype integer, Product ID dtype integer, Reference Order ID dtype integer, Reference Order Line ID dtype integer, Transaction Date dtype datetime, Transaction Type dtype text, Quantity dtype integer, Actual Cost dtype real, modified date dtype datetime, Vendor table Vendor Cols: BusinessEntityID dtype integer, AccountNumber dtype text, Name dtype text, CreditRating dtype integer, Preferred Vendor Status dtype integer, Active Flag dtype integer, PurchasingWebServiceURL dtype text, modified date dtype datetime, ProductVendor table ProductVendor Cols: Product ID dtype integer, Business Entity ID dtype integer, Average Lead Time dtype integer, Standard Price dtype real, Last Receipt Cost dtype real, Last Receipt Date dtype datetime, Min Order Quantity dtype integer, Max Order Quantity dtype integer, On Order Quantity dtype integer, Unit Measure Code dtype text, modified date dtype datetime, PurchaseOrderHeader table PurchaseOrderHeader Cols: Purchase Order ID dtype integer, Revision Number dtype integer, Status dtype integer, Employee ID dtype integer, Vendor ID dtype integer, Ship Method ID dtype integer, Order Date dtype datetime, Ship Date dtype datetime, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, modified date dtype datetime, PurchaseOrderDetail table PurchaseOrderDetail Cols: Purchase Order ID dtype integer, Purchase Orde rDetail ID dtype integer, Due Date dtype datetime, Order Quantity dtype integer, Product ID dtype integer, Unit Price dtype real, Line Total dtype real, ReceivedQty dtype real, RejectedQty dtype real, StockedQty dtype real, ModifiedDate dtype datetime, WorkOrder table WorkOrder Cols: Work Order ID dtype integer, Product ID dtype integer, Order Quantity dtype integer, Stocked Quantity dtype integer, Scrapped Quantity dtype integer, Start Date dtype datetime, End Date dtype datetime, Due Date dtype datetime, Scrap Reason ID dtype integer, modified date dtype datetime, WorkOrderRouting table WorkOrderRouting Cols: WorkOrderID dtype integer, ProductID dtype integer, Operation Sequence dtype integer, Location ID dtype integer, Scheduled Start Date dtype datetime, Scheduled End Date dtype datetime, Actual Start Date dtype datetime, ActualEndDate dtype datetime, Actual Resource Hours dtype real, Planned Cost dtype real, ActualCost dtype real, modified date dtype datetime, Customer table Customer Cols: Customer ID dtype integer, Person ID dtype integer, Store ID dtype integer, Territory ID dtype integer, Account Number dtype text, rowguid dtype text, modified date dtype datetime, ProductListPriceHistory table ProductListPriceHistory Cols: Product ID dtype integer, Start Date dtype date, End Date dtype date, ListPrice dtype real, modified date dtype datetime, Address table Address Cols: address id dtype integer, address line 1 dtype text, address line 2 dtype text, City dtype text, state province id dtype integer, postal code dtype text, spatial location dtype text, rowguid dtype text, modified date dtype datetime, AddressType table AddressType Cols: address type id dtype integer, Name dtype text, rowguid dtype text, modified date dtype datetime, BillOfMaterials table BillOfMaterials Cols: bill of materials id dtype integer, product assembly id dtype integer, component ID dtype integer, start date dtype datetime, end date dtype datetime, unit measure code dtype text, bill of materials level dtype integer, per assembly quantity dtype real, modified date dtype datetime, BusinessEntity table BusinessEntity Cols: business entity id dtype integer, rowguid dtype text, modified date dtype datetime, ContactType table ContactType Cols: Contact Type ID dtype integer, Name dtype text, modified date dtype datetime, CurrencyRate table CurrencyRate Cols: Currency Rate ID dtype integer, Currency Rate Date dtype datetime, From Currency Code dtype text, ToCurrencyCode dtype text, Average Rate dtype real, End Of Day Rate dtype real, modified date dtype datetime, Department table Department Cols: Department ID dtype integer, Name dtype text, Group Name dtype text, modified date dtype datetime, EmployeeDepartmentHistory table EmployeeDepartmentHistory Cols: Business Entity ID dtype integer, DepartmentI D dtype integer, Shift ID dtype integer, Start Date dtype date, End Date dtype date, modified date dtype datetime, EmployeePayHistory table EmployeePayHistory Cols: Business Entity ID dtype integer, Rate Change Date dtype datetime, Rate dtype real, Pay Frequency dtype integer, modified date dtype datetime, JobCandidate table JobCandidate Cols: Job Candidate ID dtype integer, Business Entity ID dtype integer, Resume dtype text, modified date dtype datetime, Location table Location Cols: Location ID dtype integer, Name dtype text, Cost Rate dtype real, Availability dtype real, modified date dtype datetime, PhoneNumberType table PhoneNumberType Cols: Phone Number Type ID dtype integer, Phone Number dtype text, modified date dtype datetime, Product table Product Cols: Product ID dtype integer, Name dtype text, Product Number dtype text, Make Flag dtype integer, Finished Goods Flag dtype integer, Color dtype text, Safety Stock Level dtype integer, Reorder Point dtype integer, Standard Cost dtype real, List Price dtype real, Size dtype text, Size Unit Measure Code dtype text, Weight Unit Measure Code dtype text, Weight dtype real, Days To Manufacture dtype integer, Product Line dtype text, Class dtype text, Style dtype text, Product Subcategory ID dtype integer, Product Model ID dtype integer, Sell Start Date dtype datetime, Sell End Date dtype datetime, Discontinued Date dtype datetime, rowguid dtype text, modified date dtype datetime, Document table Document Cols: Document Node dtype text, Document Level dtype integer, Title dtype text, Owner dtype integer, Folder Flag dtype integer, File Name dtype text, File Extension dtype text, Revision dtype text, Change Number dtype integer, Status dtype integer, Document Summary dtype text, Document dtype blob, rowguid dtype text, modified date dtype datetime, StateProvince table StateProvince Cols: State Province ID dtype integer, State Province Code dtype text, Country Region Code dtype text, Is Only State Province Flag dtype integer, Name dtype text, Territory ID dtype integer, rowguid dtype text, modified date dtype datetime, CreditCard table CreditCard Cols: Credit Card ID dtype integer, Card Type dtype text, Card Number dtype text, Expiration Month dtype integer, Expiration Year dtype integer, modified date dtype datetime, SalesOrderHeader table SalesOrderHeader Cols: Sales Order ID dtype integer, RevisionNumber dtype integer, Order Date dtype datetime, DueDate dtype datetime, Ship Date dtype datetime, Status dtype integer, OnlineOrderFlag dtype integer, SalesOrderNumber dtype text, PurchaseOrderNumber dtype text, AccountNumber dtype text, CustomerID dtype integer, SalesPersonID dtype integer, TerritoryID dtype integer, BillToAddressID dtype integer, ShipToAddressID dtype integer, Ship Method ID dtype integer, CreditCardID dtype integer, CreditCardApprovalCode dtype text, CurrencyRateID dtype integer, SubTotal dtype real, Tax Amount dtype real, Freight dtype real, Total Due dtype real, Comment dtype text, rowguid dtype text, modified date dtype datetime,