Database schema:

CREATE TABLE "Address" (
	"AddressID" INTEGER -- example: ['23192', '18089'],
	"AddressLine1" TEXT NOT NULL -- example: ["#500-75 O'Connor Street", '#9900 2700 Production Way'],
	"AddressLine2" TEXT -- example: ['Unit B-105', 'Space 55'],
	"City" TEXT NOT NULL -- example: ['Burnaby', 'Ottawa'],
	"StateProvinceID" INTEGER NOT NULL -- example: ['7', '57'],
	"PostalCode" TEXT NOT NULL -- example: ['V5A 4X1', 'K4B 1S2'],
	"SpatialLocation" TEXT -- example: ['0x00000000010100000067A89189898A5EC0AE8BFC28BCE447', '0x000000000101000000BC262A0A03905EC0D6FA851AE6D747'],
	rowguid TEXT NOT NULL -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2007-12-04 00:00:00', '2008-11-30 00:00:00'],
	PRIMARY KEY ("AddressID"), 
	CONSTRAINT fk_address_stateprovince FOREIGN KEY("StateProvinceID") REFERENCES "StateProvince" ("StateProvinceID"),
	UNIQUE ("AddressLine1", "AddressLine2", "City", "StateProvinceID", "PostalCode")
)


CREATE TABLE "AddressType" (
	"AddressTypeID" INTEGER -- example: ['2', '4'],
	"Name" TEXT NOT NULL -- example: ['Archive', 'Billing'],
	rowguid TEXT NOT NULL -- example: ['41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2', '24CB3088-4345-47C4-86C5-17B535133D1E'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("AddressTypeID")
)


CREATE TABLE "BillOfMaterials" (
	"BillOfMaterialsID" INTEGER -- example: ['271', '893'],
	"ProductAssemblyID" INTEGER -- example: ['316', '3'],
	"ComponentID" INTEGER NOT NULL -- example: ['749', '750'],
	"StartDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2010-05-26 00:00:00', '2010-03-04 00:00:00'],
	"EndDate" DATETIME -- example: ['2010-05-17 00:00:00', '2010-05-03 00:00:00'],
	"UnitMeasureCode" TEXT NOT NULL -- example: ['IN', 'EA'],
	"BOMLevel" INTEGER NOT NULL -- example: ['2', '1'],
	"PerAssemblyQty" REAL DEFAULT (1.00) NOT NULL -- example: ['1.0', '3.0'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2010-02-18 00:00:00', '2010-04-20 00:00:00'],
	PRIMARY KEY ("BillOfMaterialsID"), 
	CONSTRAINT fk_billofmaterials_unitmeasure FOREIGN KEY("UnitMeasureCode") REFERENCES "UnitMeasure" ("UnitMeasureCode"),
	CONSTRAINT fk_billofmaterials_product FOREIGN KEY("ComponentID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_billofmaterials_product FOREIGN KEY("ProductAssemblyID") REFERENCES "Product" ("ProductID"),
	UNIQUE ("ProductAssemblyID", "ComponentID", "StartDate")
)


CREATE TABLE "BusinessEntity" (
	"BusinessEntityID" INTEGER -- example: ['8722', '4079'],
	rowguid TEXT NOT NULL -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2017-12-13 13:20:24', '2017-12-13 13:20:25'],
	PRIMARY KEY ("BusinessEntityID")
)


CREATE TABLE "BusinessEntityAddress" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['2', '1'],
	"AddressID" INTEGER NOT NULL -- example: ['293', '249'],
	"AddressTypeID" INTEGER NOT NULL -- example: ['2', '3'],
	rowguid TEXT NOT NULL -- example: ['0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53', '00013363-E32F-4615-9439-AFF156D480AE'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2014-09-12 11:15:06', '2011-08-01 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "AddressID", "AddressTypeID"), 
	CONSTRAINT fk_businessentityaddress_address FOREIGN KEY("AddressID") REFERENCES "Address" ("AddressID"),
	CONSTRAINT fk_businessentityaddress_addresstype FOREIGN KEY("AddressTypeID") REFERENCES "AddressType" ("AddressTypeID"),
	CONSTRAINT fk_businessentityaddress_businessentity FOREIGN KEY("BusinessEntityID") REFERENCES "BusinessEntity" ("BusinessEntityID")
)


CREATE TABLE "BusinessEntityContact" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['292', '294'],
	"PersonID" INTEGER NOT NULL -- example: ['291', '293'],
	"ContactTypeID" INTEGER NOT NULL -- example: ['14', '11'],
	rowguid TEXT NOT NULL -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2017-12-13 13:21:03', '2017-12-13 13:21:02'],
	PRIMARY KEY ("BusinessEntityID", "PersonID", "ContactTypeID"), 
	CONSTRAINT fk_businessentitycontact_businessentity FOREIGN KEY("BusinessEntityID") REFERENCES "BusinessEntity" ("BusinessEntityID"),
	CONSTRAINT fk_businessentitycontact_contacttype FOREIGN KEY("ContactTypeID") REFERENCES "ContactType" ("ContactTypeID"),
	CONSTRAINT fk_businessentitycontact_person FOREIGN KEY("PersonID") REFERENCES "Person" ("BusinessEntityID")
)


CREATE TABLE "ContactType" (
	"ContactTypeID" INTEGER -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['Accounting Manager', 'Assistant Sales Agent'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ContactTypeID")
)


CREATE TABLE "CountryRegion" (
	"CountryRegionCode" TEXT NOT NULL, 
	"Name" TEXT NOT NULL, 
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL, 
	PRIMARY KEY ("CountryRegionCode")
)


CREATE TABLE "CountryRegionCurrency" (
	"CountryRegionCode" TEXT NOT NULL -- example: ['AE', 'AR'],
	"CurrencyCode" TEXT NOT NULL -- example: ['AED', 'ARS'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00', '2014-02-08 10:17:21'],
	PRIMARY KEY ("CountryRegionCode", "CurrencyCode"), 
	CONSTRAINT fk_countryregioncurrency_countryregion FOREIGN KEY("CountryRegionCode") REFERENCES "CountryRegion" ("CountryRegionCode"),
	CONSTRAINT fk_countryregioncurrency_currency FOREIGN KEY("CurrencyCode") REFERENCES "Currency" ("CurrencyCode")
)


CREATE TABLE "CreditCard" (
	"CreditCardID" INTEGER -- example: ['12094', '11935'],
	"CardType" TEXT NOT NULL -- example: ['Distinguish', 'SuperiorCard'],
	"CardNumber" TEXT NOT NULL -- example: ['11111000471254', '11111002034157'],
	"ExpMonth" INTEGER NOT NULL -- example: ['8', '11'],
	"ExpYear" INTEGER NOT NULL -- example: ['2005', '2006'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2013-07-29 00:00:00', '2013-12-05 00:00:00'],
	PRIMARY KEY ("CreditCardID")
)


CREATE TABLE "Culture" (
	"CultureID" TEXT NOT NULL -- example: ['', 'ar'],
	"Name" TEXT NOT NULL -- example: ['Arabic', 'Chinese'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("CultureID")
)


CREATE TABLE "Currency" (
	"CurrencyCode" TEXT NOT NULL -- example: ['AED', 'AFA'],
	"Name" TEXT NOT NULL -- example: ['Afghani', 'Algerian Dinar'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("CurrencyCode")
)


CREATE TABLE "CurrencyRate" (
	"CurrencyRateID" INTEGER -- example: ['2', '1'],
	"CurrencyRateDate" DATETIME NOT NULL -- example: ['2011-05-31 00:00:00', '2011-06-01 00:00:00'],
	"FromCurrencyCode" TEXT NOT NULL -- example: ['USD'],
	"ToCurrencyCode" TEXT NOT NULL -- example: ['AUD', 'ARS'],
	"AverageRate" REAL NOT NULL -- example: ['1.0', '1.5491'],
	"EndOfDayRate" REAL NOT NULL -- example: ['1.55', '1.0002'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2011-05-31 00:00:00', '2011-06-01 00:00:00'],
	PRIMARY KEY ("CurrencyRateID"), 
	CONSTRAINT fk_currencyrate_currency FOREIGN KEY("ToCurrencyCode") REFERENCES "Currency" ("CurrencyCode"),
	CONSTRAINT fk_currencyrate_currency FOREIGN KEY("FromCurrencyCode") REFERENCES "Currency" ("CurrencyCode"),
	UNIQUE ("CurrencyRateDate", "FromCurrencyCode", "ToCurrencyCode")
)


CREATE TABLE "Customer" (
	"CustomerID" INTEGER, 
	"PersonID" INTEGER, 
	"StoreID" INTEGER, 
	"TerritoryID" INTEGER, 
	"AccountNumber" TEXT NOT NULL, 
	rowguid TEXT NOT NULL, 
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL, 
	PRIMARY KEY ("CustomerID"), 
	CONSTRAINT fk_customer_person FOREIGN KEY("PersonID") REFERENCES "Person" ("BusinessEntityID"),
	CONSTRAINT fk_customer_salesterritory FOREIGN KEY("TerritoryID") REFERENCES "SalesTerritory" ("TerritoryID"),
	CONSTRAINT fk_customer_store FOREIGN KEY("StoreID") REFERENCES "Store" ("BusinessEntityID")
)


CREATE TABLE "Department" (
	"DepartmentID" INTEGER -- example: ['1', '12'],
	"Name" TEXT NOT NULL -- example: ['Document Control', 'Engineering'],
	"GroupName" TEXT NOT NULL -- example: ['Sales and Marketing', 'Research and Development'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("DepartmentID")
)


CREATE TABLE "Document" (
	"DocumentNode" TEXT NOT NULL -- example: ['/1/', '/'],
	"DocumentLevel" INTEGER -- example: ['0', '1'],
	"Title" TEXT NOT NULL -- example: ['Overview', 'Documents'],
	"Owner" INTEGER NOT NULL -- example: ['217', '219'],
	"FolderFlag" INTEGER DEFAULT 0 NOT NULL -- example: ['0', '1'],
	"FileName" TEXT NOT NULL -- example: ['Overview', 'Documents'],
	"FileExtension" TEXT NOT NULL -- example: ['', '.doc'],
	"Revision" TEXT NOT NULL -- example: ['0', '4'],
	"ChangeNumber" INTEGER DEFAULT 0 NOT NULL -- example: ['0', '28'],
	"Status" INTEGER NOT NULL -- example: ['2', '1'],
	"DocumentSummary" TEXT -- example: ['It is important that you maintain your bicycle and', 'Guidelines and recommendations for lubricating the'],
	"Document" BLOB -- example: ['0xD0CF11E0A1B11AE100000000000000000000000000000000'],
	rowguid TEXT NOT NULL -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2013-05-30 00:00:00', '2017-12-13 13:58:03'],
	PRIMARY KEY ("DocumentNode"), 
	CONSTRAINT fk_document_employee FOREIGN KEY("Owner") REFERENCES "Employee" ("BusinessEntityID"),
	UNIQUE ("DocumentLevel", "DocumentNode")
)


CREATE TABLE "EmailAddress" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['2', '1'],
	"EmailAddressID" INTEGER -- example: ['2', '1'],
	"EmailAddress" TEXT -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com'],
	rowguid TEXT NOT NULL -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-01-24 00:00:00', '2009-01-07 00:00:00'],
	PRIMARY KEY ("EmailAddressID", "BusinessEntityID"), 
	CONSTRAINT fk_emailaddress_person FOREIGN KEY("BusinessEntityID") REFERENCES "Person" ("BusinessEntityID")
)


CREATE TABLE "Employee" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['170', '151'],
	"NationalIDNumber" TEXT NOT NULL -- example: ['10708100', '109272464'],
	"LoginID" TEXT NOT NULL -- example: ['adventure-works\\alejandro0', 'adventure-works\\alan0'],
	"OrganizationNode" TEXT -- example: ['/1/', '/1/1/'],
	"OrganizationLevel" INTEGER -- example: ['2', '1'],
	"JobTitle" TEXT NOT NULL -- example: ['Chief Executive Officer', 'Vice President of Engineering'],
	"BirthDate" DATE NOT NULL -- example: ['1969-01-29', '1971-08-01'],
	"MaritalStatus" TEXT NOT NULL -- example: ['S', 'M'],
	"Gender" TEXT NOT NULL -- example: ['M', 'F'],
	"HireDate" DATE NOT NULL -- example: ['2008-01-31', '2009-01-14'],
	"SalariedFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"VacationHours" INTEGER DEFAULT 0 NOT NULL -- example: ['1', '99'],
	"SickLeaveHours" INTEGER DEFAULT 0 NOT NULL -- example: ['20', '69'],
	"CurrentFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['1'],
	rowguid TEXT NOT NULL -- example: ['01B119A2-2AF3-4775-818E-B421FECB07A7', '00027A8C-C2F8-4A31-ABA8-8A203638B8F1'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2014-06-30 00:00:00', '2014-12-26 09:17:08'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_employee_person FOREIGN KEY("BusinessEntityID") REFERENCES "Person" ("BusinessEntityID")
)


CREATE TABLE "EmployeeDepartmentHistory" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['2', '1'],
	"DepartmentID" INTEGER NOT NULL -- example: ['1', '16'],
	"ShiftID" INTEGER NOT NULL -- example: ['1', '3'],
	"StartDate" DATE NOT NULL -- example: ['2008-01-31', '2009-01-14'],
	"EndDate" DATE -- example: ['2010-05-30', '2009-07-14'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2009-01-13 00:00:00', '2008-01-30 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "StartDate", "DepartmentID", "ShiftID"), 
	CONSTRAINT fk_employeedepartmenthistory_shift FOREIGN KEY("ShiftID") REFERENCES "Shift" ("ShiftID"),
	CONSTRAINT fk_employeedepartmenthistory_department FOREIGN KEY("DepartmentID") REFERENCES "Department" ("DepartmentID"),
	CONSTRAINT fk_employeedepartmenthistory_employee FOREIGN KEY("BusinessEntityID") REFERENCES "Employee" ("BusinessEntityID")
)


CREATE TABLE "EmployeePayHistory" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['2', '1'],
	"RateChangeDate" DATETIME NOT NULL -- example: ['2009-01-14 00:00:00', '2008-01-31 00:00:00'],
	"Rate" REAL NOT NULL -- example: ['125.5', '63.4615'],
	"PayFrequency" INTEGER NOT NULL -- example: ['2', '1'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2014-06-30 00:00:00', '2007-11-21 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "RateChangeDate"), 
	CONSTRAINT fk_employeepayhistory_employee FOREIGN KEY("BusinessEntityID") REFERENCES "Employee" ("BusinessEntityID")
)


CREATE TABLE "JobCandidate" (
	"JobCandidateID" INTEGER -- example: ['2', '3'],
	"BusinessEntityID" INTEGER -- example: ['212', '274'],
	"Resume" TEXT -- example: ['<ns:Resume xmlns:ns="http://schemas.microsoft.com/'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2007-06-23 00:00:00', '2013-12-22 18:32:21'],
	PRIMARY KEY ("JobCandidateID"), 
	CONSTRAINT fk_jobcandidate_employee FOREIGN KEY("BusinessEntityID") REFERENCES "Employee" ("BusinessEntityID")
)


CREATE TABLE "Location" (
	"LocationID" INTEGER -- example: ['30', '60'],
	"Name" TEXT NOT NULL -- example: ['Final Assembly', 'Debur and Polish'],
	"CostRate" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0', '22.5'],
	"Availability" REAL DEFAULT (0.00) NOT NULL -- example: ['0.0', '96.0'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("LocationID")
)


CREATE TABLE "Password" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['2', '1'],
	"PasswordHash" TEXT NOT NULL -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hccfM=', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAudm0='],
	"PasswordSalt" TEXT NOT NULL -- example: ['EjJaC3U=', 'bE3XiWw='],
	rowguid TEXT NOT NULL -- example: ['A4C82398-7466-4FE6-B9EE-CEC34D116F68', '329EACBE-C883-4F48-B8B6-17AA4627EFFF'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-01-24 00:00:00', '2009-01-07 00:00:00'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_password_person FOREIGN KEY("BusinessEntityID") REFERENCES "Person" ("BusinessEntityID")
)


CREATE TABLE "Person" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['14617', '18779'],
	"PersonType" TEXT NOT NULL -- example: ['SP', 'EM'],
	"NameStyle" INTEGER DEFAULT 0 NOT NULL -- example: ['0'],
	"Title" TEXT -- example: ['Ms.', 'Mr.'],
	"FirstName" TEXT NOT NULL -- example: ['Ken', 'Terri'],
	"MiddleName" TEXT -- example: ['Lee', 'J'],
	"LastName" TEXT NOT NULL -- example: ['Duffy', 'Sánchez'],
	"Suffix" TEXT -- example: ['Jr.', 'III'],
	"EmailPromotion" INTEGER DEFAULT 0 NOT NULL -- example: ['0', '1'],
	"AdditionalContactInfo" TEXT -- example: ['<AdditionalContactInfo xmlns="http://schemas.micro'],
	"Demographics" TEXT -- example: ['<IndividualSurvey xmlns="http://schemas.microsoft.'],
	rowguid TEXT NOT NULL -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2008-01-24 00:00:00', '2009-01-07 00:00:00'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_person_businessentity FOREIGN KEY("BusinessEntityID") REFERENCES "BusinessEntity" ("BusinessEntityID")
)


CREATE TABLE "PersonCreditCard" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['293', '295'],
	"CreditCardID" INTEGER NOT NULL -- example: ['17038', '15369'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2013-07-31 00:00:00', '2011-08-01 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "CreditCardID"), 
	CONSTRAINT fk_personcreditcard_creditcard FOREIGN KEY("CreditCardID") REFERENCES "CreditCard" ("CreditCardID"),
	CONSTRAINT fk_personcreditcard_person FOREIGN KEY("BusinessEntityID") REFERENCES "Person" ("BusinessEntityID")
)


CREATE TABLE "PhoneNumberType" (
	"PhoneNumberTypeID" INTEGER -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['Home', 'Cell'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2017-12-13 13:19:22'],
	PRIMARY KEY ("PhoneNumberTypeID")
)


CREATE TABLE "Product" (
	"ProductID" INTEGER -- example: ['921', '351'],
	"Name" TEXT NOT NULL -- example: ['Adjustable Race', 'AWC Logo Cap'],
	"ProductNumber" TEXT NOT NULL -- example: ['AR-5381', 'BA-8327'],
	"MakeFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"FinishedGoodsFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"Color" TEXT -- example: ['Black', 'Silver'],
	"SafetyStockLevel" INTEGER NOT NULL -- example: ['800', '1000'],
	"ReorderPoint" INTEGER NOT NULL -- example: ['750', '600'],
	"StandardCost" REAL NOT NULL -- example: ['0.0', '98.77'],
	"ListPrice" REAL NOT NULL -- example: ['133.34', '0.0'],
	"Size" TEXT -- example: ['58', 'M'],
	"SizeUnitMeasureCode" TEXT -- example: ['CM'],
	"WeightUnitMeasureCode" TEXT -- example: ['LB', 'G'],
	"Weight" REAL -- example: ['450.0', '435.0'],
	"DaysToManufacture" INTEGER NOT NULL -- example: ['0', '1'],
	"ProductLine" TEXT -- example: ['R', 'S'],
	"Class" TEXT -- example: ['L', 'M'],
	"Style" TEXT -- example: ['U', 'W'],
	"ProductSubcategoryID" INTEGER -- example: ['14', '31'],
	"ProductModelID" INTEGER -- example: ['33', '6'],
	"SellStartDate" DATETIME NOT NULL -- example: ['2011-05-31 00:00:00', '2008-04-30 00:00:00'],
	"SellEndDate" DATETIME -- example: ['2012-05-29 00:00:00', '2013-05-29 00:00:00'],
	"DiscontinuedDate" DATETIME, 
	rowguid TEXT NOT NULL -- example: ['01C901E3-4323-48ED-AB9E-9BFDA28BDEF6', '01A8C3FC-ED52-458E-A634-D5B6E2ACCFED'],
	"ModifiedDate" DATETIME DEFAULT current_timestamp NOT NULL -- example: ['2014-02-08 10:01:36', '2014-02-08 10:03:55'],
	PRIMARY KEY ("ProductID"), 
	CONSTRAINT fk_product_productmodel FOREIGN KEY("ProductModelID") REFERENCES "ProductModel" ("ProductModelID"),
	CONSTRAINT fk_product_productsubcategory FOREIGN KEY("ProductSubcategoryID") REFERENCES "ProductSubcategory" ("ProductSubcategoryID"),
	CONSTRAINT fk_product_unitmeasure FOREIGN KEY("WeightUnitMeasureCode") REFERENCES "UnitMeasure" ("UnitMeasureCode"),
	CONSTRAINT fk_product_unitmeasure FOREIGN KEY("SizeUnitMeasureCode") REFERENCES "UnitMeasure" ("UnitMeasureCode")
)


CREATE TABLE "ProductCategory" (
	"ProductCategoryID" INTEGER -- example: ['4', '3'],
	"Name" TEXT NOT NULL -- example: ['Accessories', 'Bikes'],
	rowguid TEXT NOT NULL -- example: ['2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6', '10A7C342-CA82-48D4-8A38-46A2EB089B74'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ProductCategoryID")
)


CREATE TABLE "ProductCostHistory" (
	"ProductID" INTEGER NOT NULL, 
	"StartDate" DATE NOT NULL, 
	"EndDate" DATE, 
	"StandardCost" REAL NOT NULL, 
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY ("ProductID", "StartDate"), 
	CONSTRAINT fk_productcosthistory_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "ProductDescription" (
	"ProductDescriptionID" INTEGER -- example: ['1954', '1370'],
	"Description" TEXT NOT NULL -- example: ['Aluminum alloy cups; large diameter spindle.', 'Chromoly steel.'],
	rowguid TEXT NOT NULL -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-04-30 00:00:00', '2014-02-08 10:32:17'],
	PRIMARY KEY ("ProductDescriptionID")
)


CREATE TABLE "ProductDocument" (
	"ProductID" INTEGER NOT NULL -- example: ['318', '317'],
	"DocumentNode" TEXT NOT NULL -- example: ['/3/1/', '/2/1/'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-12-29 13:51:58'],
	PRIMARY KEY ("ProductID", "DocumentNode"), 
	CONSTRAINT fk_productdocument_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_productdocument_document FOREIGN KEY("DocumentNode") REFERENCES "Document" ("DocumentNode")
)


CREATE TABLE "ProductInventory" (
	"ProductID" INTEGER NOT NULL -- example: ['2', '1'],
	"LocationID" INTEGER NOT NULL -- example: ['1', '6'],
	"Shelf" TEXT NOT NULL -- example: ['A', 'B'],
	"Bin" INTEGER NOT NULL -- example: ['5', '1'],
	"Quantity" INTEGER DEFAULT 0 NOT NULL -- example: ['324', '408'],
	rowguid TEXT NOT NULL -- example: ['D4544D7D-CAF5-46B3-AB22-5718DCC26B5E', '47A24246-6C43-48EB-968F-025738A8A410'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2014-08-08 00:00:00', '2008-03-31 00:00:00'],
	PRIMARY KEY ("ProductID", "LocationID"), 
	CONSTRAINT fk_productinventory_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_productinventory_location FOREIGN KEY("LocationID") REFERENCES "Location" ("LocationID")
)


CREATE TABLE "ProductListPriceHistory" (
	"ProductID" INTEGER NOT NULL, 
	"StartDate" DATE NOT NULL, 
	"EndDate" DATE, 
	"ListPrice" REAL NOT NULL, 
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY ("ProductID", "StartDate"), 
	CONSTRAINT fk_productlistpricehistory_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "ProductModel" (
	"ProductModelID" INTEGER -- example: ['82', '57'],
	"Name" TEXT NOT NULL -- example: ['Bike Wash', 'All-Purpose Bike Stand'],
	"CatalogDescription" TEXT -- example: ['<?xml-stylesheet href="ProductDescription.xsl" typ'],
	"Instructions" TEXT -- example: ['<root xmlns="http://schemas.microsoft.com/sqlserve'],
	rowguid TEXT NOT NULL -- example: ['02200AA0-C369-4D77-A67C-75973EFDA81B', '00CE9171-8944-4D49-BA37-485C1D122F5C'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-04-30 00:00:00', '2011-05-01 00:00:00'],
	PRIMARY KEY ("ProductModelID")
)


CREATE TABLE "ProductModelProductDescriptionCulture" (
	"ProductModelID" INTEGER NOT NULL -- example: ['2', '1'],
	"ProductDescriptionID" INTEGER NOT NULL -- example: ['1199', '1467'],
	"CultureID" TEXT NOT NULL -- example: ['ar', 'en'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-04-30 00:00:00'],
	PRIMARY KEY ("ProductModelID", "ProductDescriptionID", "CultureID"), 
	CONSTRAINT fk_productmodelproductdescriptionculture_productmodel FOREIGN KEY("ProductModelID") REFERENCES "ProductModel" ("ProductModelID"),
	CONSTRAINT fk_productmodelproductdescriptionculture_productdescription FOREIGN KEY("ProductDescriptionID") REFERENCES "ProductDescription" ("ProductDescriptionID"),
	CONSTRAINT fk_productmodelproductdescriptionculture_culture FOREIGN KEY("CultureID") REFERENCES "Culture" ("CultureID")
)


CREATE TABLE "ProductPhoto" (
	"ProductPhotoID" INTEGER -- example: ['70', '69'],
	"ThumbNailPhoto" BLOB -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3F5F6FE303D', '0x47494638396150003100F70000E3E3FCEBECF3F5F6FE999B'],
	"ThumbnailPhotoFileName" TEXT -- example: ['racer02_black_small.gif', 'racer02_black_f_small.gif'],
	"LargePhoto" BLOB -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE86878ADBDC', '0x474946383961F0009500F7000086878AECEDFED7D8E7D3D3'],
	"LargePhotoFileName" TEXT -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00', '2012-10-19 09:56:38'],
	PRIMARY KEY ("ProductPhotoID")
)


CREATE TABLE "ProductProductPhoto" (
	"ProductID" INTEGER NOT NULL -- example: ['2', '1'],
	"ProductPhotoID" INTEGER NOT NULL -- example: ['1', '160'],
	"Primary" INTEGER DEFAULT 0 NOT NULL -- example: ['1'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-01 00:00:00', '2008-03-31 00:00:00'],
	PRIMARY KEY ("ProductID", "ProductPhotoID"), 
	CONSTRAINT fk_productproductphoto_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_productproductphoto_productphoto FOREIGN KEY("ProductPhotoID") REFERENCES "ProductPhoto" ("ProductPhotoID")
)


CREATE TABLE "ProductReview" (
	"ProductReviewID" INTEGER -- example: ['2', '1'],
	"ProductID" INTEGER NOT NULL -- example: ['937', '709'],
	"ReviewerName" TEXT NOT NULL -- example: ['David', 'John Smith'],
	"ReviewDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-09-18 00:00:00', '2013-11-13 00:00:00'],
	"EmailAddress" TEXT NOT NULL -- example: ['david@graphicdesigninstitute.com', 'john@fourthcoffee.com'],
	"Rating" INTEGER NOT NULL -- example: ['5', '4'],
	"Comments" TEXT -- example: ['A little on the heavy side, but overall the entry/', "I can't believe I'm singing the praises of a pair "],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-09-18 00:00:00', '2013-11-13 00:00:00'],
	PRIMARY KEY ("ProductReviewID"), 
	CONSTRAINT fk_productreview_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "ProductSubcategory" (
	"ProductSubcategoryID" INTEGER -- example: ['2', '3'],
	"ProductCategoryID" INTEGER NOT NULL -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['Bike Racks', 'Bib-Shorts'],
	rowguid TEXT NOT NULL -- example: ['02C5061D-ECDC-4274-B5F1-E91D76BC3F37', '000310C0-BCC8-42C4-B0C3-45AE611AF06B'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ProductSubcategoryID"), 
	CONSTRAINT fk_productsubcategory_productcategory FOREIGN KEY("ProductCategoryID") REFERENCES "ProductCategory" ("ProductCategoryID")
)


CREATE TABLE "ProductVendor" (
	"ProductID" INTEGER NOT NULL -- example: ['2', '1'],
	"BusinessEntityID" INTEGER NOT NULL -- example: ['1688', '1580'],
	"AverageLeadTime" INTEGER NOT NULL -- example: ['17', '19'],
	"StandardPrice" REAL NOT NULL -- example: ['47.87', '39.92'],
	"LastReceiptCost" REAL -- example: ['50.2635', '41.916'],
	"LastReceiptDate" DATETIME -- example: ['2011-08-29 00:00:00', '2011-08-25 00:00:00'],
	"MinOrderQty" INTEGER NOT NULL -- example: ['1', '100'],
	"MaxOrderQty" INTEGER NOT NULL -- example: ['5', '1000'],
	"OnOrderQty" INTEGER -- example: ['300', '3'],
	"UnitMeasureCode" TEXT NOT NULL -- example: ['CS', 'CTN'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-08-29 00:00:00', '2011-08-25 00:00:00'],
	PRIMARY KEY ("ProductID", "BusinessEntityID"), 
	CONSTRAINT fk_productvendor_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_productvendor_vendor FOREIGN KEY("BusinessEntityID") REFERENCES "Vendor" ("BusinessEntityID"),
	CONSTRAINT fk_productvendor_unitmeasure FOREIGN KEY("UnitMeasureCode") REFERENCES "UnitMeasure" ("UnitMeasureCode")
)


CREATE TABLE "PurchaseOrderDetail" (
	"PurchaseOrderID" INTEGER NOT NULL -- example: ['2', '1'],
	"PurchaseOrderDetailID" INTEGER -- example: ['2', '1'],
	"DueDate" DATETIME NOT NULL -- example: ['2011-04-30 00:00:00', '2011-05-14 00:00:00'],
	"OrderQty" INTEGER NOT NULL -- example: ['4', '3'],
	"ProductID" INTEGER NOT NULL -- example: ['1', '359'],
	"UnitPrice" REAL NOT NULL -- example: ['45.0', '50.0'],
	"LineTotal" REAL NOT NULL -- example: ['201.0', '135.0'],
	"ReceivedQty" REAL NOT NULL -- example: ['550.0', '3.0'],
	"RejectedQty" REAL NOT NULL -- example: ['1.0', '0.0'],
	"StockedQty" REAL NOT NULL -- example: ['550.0', '3.0'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-23 00:00:00', '2011-05-07 00:00:00'],
	PRIMARY KEY ("PurchaseOrderDetailID"), 
	CONSTRAINT fk_purchaseorderdetail_purchaseorderheader FOREIGN KEY("PurchaseOrderID") REFERENCES "PurchaseOrderHeader" ("PurchaseOrderID"),
	CONSTRAINT fk_purchaseorderdetail_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "PurchaseOrderHeader" (
	"PurchaseOrderID" INTEGER -- example: ['2', '1'],
	"RevisionNumber" INTEGER DEFAULT 0 NOT NULL -- example: ['5', '4'],
	"Status" INTEGER DEFAULT 1 NOT NULL -- example: ['1', '4'],
	"EmployeeID" INTEGER NOT NULL -- example: ['254', '258'],
	"VendorID" INTEGER NOT NULL -- example: ['1496', '1580'],
	"ShipMethodID" INTEGER NOT NULL -- example: ['5', '3'],
	"OrderDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-30 00:00:00', '2011-04-16 00:00:00'],
	"ShipDate" DATETIME -- example: ['2011-04-25 00:00:00', '2011-05-09 00:00:00'],
	"SubTotal" REAL DEFAULT (0.0000) NOT NULL -- example: ['272.1015', '201.04'],
	"TaxAmt" REAL DEFAULT (0.0000) NOT NULL -- example: ['21.7681', '16.0832'],
	"Freight" REAL DEFAULT (0.0000) NOT NULL -- example: ['6.8025', '5.026'],
	"TotalDue" REAL NOT NULL -- example: ['222.1492', '300.6721'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-25 00:00:00', '2011-05-09 00:00:00'],
	PRIMARY KEY ("PurchaseOrderID"), 
	CONSTRAINT fk_purchaseorderheader_employee FOREIGN KEY("EmployeeID") REFERENCES "Employee" ("BusinessEntityID"),
	CONSTRAINT fk_purchaseorderheader_vendor FOREIGN KEY("VendorID") REFERENCES "Vendor" ("BusinessEntityID"),
	CONSTRAINT fk_purchaseorderheader_shipmethod FOREIGN KEY("ShipMethodID") REFERENCES "ShipMethod" ("ShipMethodID")
)


CREATE TABLE "SalesOrderDetail" (
	"SalesOrderID" INTEGER NOT NULL -- example: ['43660', '43659'],
	"SalesOrderDetailID" INTEGER -- example: ['90855', '54351'],
	"CarrierTrackingNumber" TEXT -- example: ['6431-4D57-83', '4911-403C-98'],
	"OrderQty" INTEGER NOT NULL -- example: ['1', '3'],
	"ProductID" INTEGER NOT NULL -- example: ['776', '777'],
	"SpecialOfferID" INTEGER NOT NULL -- example: ['2', '1'],
	"UnitPrice" REAL NOT NULL -- example: ['2025.0', '2040.0'],
	"UnitPriceDiscount" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0'],
	"LineTotal" REAL NOT NULL -- example: ['2025.0', '6075.0'],
	rowguid TEXT NOT NULL -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-31 00:00:00', '2011-06-01 00:00:00'],
	PRIMARY KEY ("SalesOrderDetailID"), 
	CONSTRAINT fk_salesorderdetail_salesorderheader FOREIGN KEY("SalesOrderID") REFERENCES "SalesOrderHeader" ("SalesOrderID"),
	CONSTRAINT fk_salesorderdetail_specialofferproduct FOREIGN KEY("SpecialOfferID", "ProductID") REFERENCES "SpecialOfferProduct" ("SpecialOfferID", "ProductID")
)


CREATE TABLE "SalesOrderHeader" (
	"SalesOrderID" INTEGER -- example: ['44088', '71821'],
	"RevisionNumber" INTEGER DEFAULT 0 NOT NULL -- example: ['9', '8'],
	"OrderDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-31 00:00:00', '2011-06-01 00:00:00'],
	"DueDate" DATETIME NOT NULL -- example: ['2011-06-13 00:00:00', '2011-06-12 00:00:00'],
	"ShipDate" DATETIME -- example: ['2011-06-07 00:00:00', '2011-06-08 00:00:00'],
	"Status" INTEGER DEFAULT 1 NOT NULL -- example: ['5'],
	"OnlineOrderFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"SalesOrderNumber" TEXT NOT NULL -- example: ['SO43659', 'SO43660'],
	"PurchaseOrderNumber" TEXT -- example: ['PO18850127500', 'PO522145787'],
	"AccountNumber" TEXT -- example: ['10-4020-000676', '10-4020-000117'],
	"CustomerID" INTEGER NOT NULL -- example: ['29825', '29672'],
	"SalesPersonID" INTEGER -- example: ['279', '282'],
	"TerritoryID" INTEGER -- example: ['5', '6'],
	"BillToAddressID" INTEGER NOT NULL -- example: ['921', '985'],
	"ShipToAddressID" INTEGER NOT NULL -- example: ['921', '985'],
	"ShipMethodID" INTEGER NOT NULL -- example: ['5', '1'],
	"CreditCardID" INTEGER -- example: ['16281', '5618'],
	"CreditCardApprovalCode" TEXT -- example: ['115213Vi29411', '105041Vi84182'],
	"CurrencyRateID" INTEGER -- example: ['8', '4'],
	"SubTotal" REAL DEFAULT (0.0000) NOT NULL -- example: ['1294.2529', '20565.6206'],
	"TaxAmt" REAL DEFAULT (0.0000) NOT NULL -- example: ['124.2483', '1971.5149'],
	"Freight" REAL DEFAULT (0.0000) NOT NULL -- example: ['38.8276', '616.0984'],
	"TotalDue" REAL NOT NULL -- example: ['1457.3288', '23153.2339'],
	"Comment" TEXT, 
	rowguid TEXT NOT NULL -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-06-07 00:00:00', '2011-06-08 00:00:00'],
	PRIMARY KEY ("SalesOrderID"), 
	CONSTRAINT fk_salesorderheader_currencyrate FOREIGN KEY("CurrencyRateID") REFERENCES "CurrencyRate" ("CurrencyRateID"),
	CONSTRAINT fk_salesorderheader_creditcard FOREIGN KEY("CreditCardID") REFERENCES "CreditCard" ("CreditCardID"),
	CONSTRAINT fk_salesorderheader_address FOREIGN KEY("ShipMethodID") REFERENCES "Address" ("AddressID"),
	CONSTRAINT fk_salesorderheader_address FOREIGN KEY("ShipToAddressID") REFERENCES "Address" ("AddressID"),
	CONSTRAINT fk_salesorderheader_address FOREIGN KEY("BillToAddressID") REFERENCES "Address" ("AddressID"),
	CONSTRAINT fk_salesorderheader_salesterritory FOREIGN KEY("TerritoryID") REFERENCES "SalesTerritory" ("TerritoryID"),
	CONSTRAINT fk_salesorderheader_salesperson FOREIGN KEY("SalesPersonID") REFERENCES "SalesPerson" ("BusinessEntityID"),
	CONSTRAINT fk_salesorderheader_customer FOREIGN KEY("CustomerID") REFERENCES "Customer" ("CustomerID")
)


CREATE TABLE "SalesOrderHeaderSalesReason" (
	"SalesOrderID" INTEGER NOT NULL -- example: ['43702', '43697'],
	"SalesReasonID" INTEGER NOT NULL -- example: ['5', '9'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-31 00:00:00', '2011-06-01 00:00:00'],
	PRIMARY KEY ("SalesOrderID", "SalesReasonID"), 
	CONSTRAINT fk_salesorderheadersalesreason_salesorderheader FOREIGN KEY("SalesOrderID") REFERENCES "SalesOrderHeader" ("SalesOrderID"),
	CONSTRAINT fk_salesorderheadersalesreason_salesreason FOREIGN KEY("SalesReasonID") REFERENCES "SalesReason" ("SalesReasonID")
)


CREATE TABLE "SalesPerson" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['275', '287'],
	"TerritoryID" INTEGER -- example: ['2', '4'],
	"SalesQuota" REAL -- example: ['300000.0', '250000.0'],
	"Bonus" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0', '4100.0'],
	"CommissionPct" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0', '0.012'],
	"SalesYTD" REAL DEFAULT (0.0000) NOT NULL -- example: ['559697.5639', '3763178.1787'],
	"SalesLastYear" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0', '1750406.4785'],
	rowguid TEXT NOT NULL -- example: ['1E0A7274-3064-4F58-88EE-4C6586C87169', '1DD1F689-DF74-4149-8600-59555EEF154B'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-24 00:00:00', '2010-12-28 00:00:00'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_salesperson_employee FOREIGN KEY("BusinessEntityID") REFERENCES "Employee" ("BusinessEntityID"),
	CONSTRAINT fk_salesperson_salesterritory FOREIGN KEY("TerritoryID") REFERENCES "SalesTerritory" ("TerritoryID")
)


CREATE TABLE "SalesPersonQuotaHistory" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['275', '274'],
	"QuotaDate" DATETIME NOT NULL -- example: ['2011-05-31 00:00:00', '2011-08-31 00:00:00'],
	"SalesQuota" REAL NOT NULL -- example: ['7000.0', '28000.0'],
	rowguid TEXT NOT NULL -- example: ['0103899F-618C-4478-90BB-815B20856F35', '00F2F9F8-5158-4436-B134-7E0C462289E5'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-07-17 00:00:00', '2011-04-16 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "QuotaDate"), 
	CONSTRAINT fk_salespersonquotahistory_salesperson FOREIGN KEY("BusinessEntityID") REFERENCES "SalesPerson" ("BusinessEntityID")
)


CREATE TABLE "SalesReason" (
	"SalesReasonID" INTEGER -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['On Promotion', 'Price'],
	"ReasonType" TEXT NOT NULL -- example: ['Other', 'Promotion'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("SalesReasonID")
)


CREATE TABLE "SalesTaxRate" (
	"SalesTaxRateID" INTEGER -- example: ['1', '4'],
	"StateProvinceID" INTEGER NOT NULL -- example: ['1', '6'],
	"TaxType" INTEGER NOT NULL -- example: ['2', '1'],
	"TaxRate" REAL DEFAULT (0.0000) NOT NULL -- example: ['14.25', '14.0'],
	"Name" TEXT NOT NULL -- example: ['Canadian GST + Ontario Provincial Tax', 'Canadian GST + Alberta Provincial Tax'],
	rowguid TEXT NOT NULL -- example: ['06DF529D-EB11-446F-9570-9EE97B8EA1BF', '05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("SalesTaxRateID"), 
	CONSTRAINT fk_salestaxrate_stateprovince FOREIGN KEY("StateProvinceID") REFERENCES "StateProvince" ("StateProvinceID"),
	UNIQUE ("StateProvinceID", "TaxType")
)


CREATE TABLE "SalesTerritory" (
	"TerritoryID" INTEGER -- example: ['2', '10'],
	"Name" TEXT NOT NULL -- example: ['Australia', 'Canada'],
	"CountryRegionCode" TEXT NOT NULL -- example: ['CA', 'US'],
	"Group" TEXT NOT NULL -- example: ['Europe', 'North America'],
	"SalesYTD" REAL DEFAULT (0.0000) NOT NULL -- example: ['7887186.7882', '2402176.8476'],
	"SalesLastYear" REAL DEFAULT (0.0000) NOT NULL -- example: ['3298694.4938', '3607148.9371'],
	"CostYTD" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0'],
	"CostLastYear" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0'],
	rowguid TEXT NOT NULL -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("TerritoryID"), 
	CONSTRAINT fk_salesterritory_countryregion FOREIGN KEY("CountryRegionCode") REFERENCES "CountryRegion" ("CountryRegionCode")
)


CREATE TABLE "SalesTerritoryHistory" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['275', '276'],
	"TerritoryID" INTEGER NOT NULL -- example: ['2', '3'],
	"StartDate" DATETIME NOT NULL -- example: ['2011-05-31 00:00:00', '2012-11-30 00:00:00'],
	"EndDate" DATETIME -- example: ['2012-09-29 00:00:00', '2012-11-29 00:00:00'],
	rowguid TEXT NOT NULL -- example: ['132E4721-32DD-4A73-B556-1837F3A2B9AE', '009F7660-44A6-4ADF-BD4B-A5D1B79993F5'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2012-11-22 00:00:00', '2012-11-23 00:00:00'],
	PRIMARY KEY ("BusinessEntityID", "StartDate", "TerritoryID"), 
	CONSTRAINT fk_salesterritoryhistory_salesperson FOREIGN KEY("BusinessEntityID") REFERENCES "SalesPerson" ("BusinessEntityID"),
	CONSTRAINT fk_salesterritoryhistory_salesterritory FOREIGN KEY("TerritoryID") REFERENCES "SalesTerritory" ("TerritoryID")
)


CREATE TABLE "ScrapReason" (
	"ScrapReasonID" INTEGER -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['Brake assembly not as ordered', 'Color incorrect'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ScrapReasonID")
)


CREATE TABLE "Shift" (
	"ShiftID" INTEGER -- example: ['2', '1'],
	"Name" TEXT NOT NULL -- example: ['Evening', 'Day'],
	"StartTime" TEXT NOT NULL -- example: ['07:00:00', '15:00:00'],
	"EndTime" TEXT NOT NULL -- example: ['23:00:00', '15:00:00'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ShiftID"), 
	UNIQUE ("StartTime", "EndTime")
)


CREATE TABLE "ShipMethod" (
	"ShipMethodID" INTEGER -- example: ['4', '3'],
	"Name" TEXT NOT NULL -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST'],
	"ShipBase" REAL DEFAULT (0.0000) NOT NULL -- example: ['9.95', '3.95'],
	"ShipRate" REAL DEFAULT (0.0000) NOT NULL -- example: ['1.99', '0.99'],
	rowguid TEXT NOT NULL -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("ShipMethodID")
)


CREATE TABLE "ShoppingCartItem" (
	"ShoppingCartItemID" INTEGER -- example: ['2', '4'],
	"ShoppingCartID" TEXT NOT NULL -- example: ['20621', '14951'],
	"Quantity" INTEGER DEFAULT 1 NOT NULL -- example: ['4', '3'],
	"ProductID" INTEGER NOT NULL -- example: ['881', '862'],
	"DateCreated" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-11-09 17:54:07'],
	PRIMARY KEY ("ShoppingCartItemID"), 
	CONSTRAINT fk_shoppingcartitem_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "SpecialOffer" (
	"SpecialOfferID" INTEGER -- example: ['15', '1'],
	"Description" TEXT NOT NULL -- example: ['No Discount', 'Volume Discount 11 to 14'],
	"DiscountPct" REAL DEFAULT (0.0000) NOT NULL -- example: ['0.0'],
	"Type" TEXT NOT NULL -- example: ['No Discount', 'Volume Discount'],
	"Category" TEXT NOT NULL -- example: ['No Discount', 'Reseller'],
	"StartDate" DATETIME NOT NULL -- example: ['2011-05-31 00:00:00', '2011-05-01 00:00:00'],
	"EndDate" DATETIME NOT NULL -- example: ['2014-05-30 00:00:00', '2014-11-30 00:00:00'],
	"MinQty" INTEGER DEFAULT 0 NOT NULL -- example: ['0', '11'],
	"MaxQty" INTEGER -- example: ['24', '14'],
	rowguid TEXT NOT NULL -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-01 00:00:00', '2011-04-01 00:00:00'],
	PRIMARY KEY ("SpecialOfferID")
)


CREATE TABLE "SpecialOfferProduct" (
	"SpecialOfferID" INTEGER NOT NULL -- example: ['2', '1'],
	"ProductID" INTEGER NOT NULL -- example: ['706', '680'],
	rowguid TEXT NOT NULL -- example: ['00365938-3422-494E-B92E-C00AFD691469', '0020931C-087C-42F8-B441-EBE3D3B5F51E'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-05-01 00:00:00', '2011-04-01 00:00:00'],
	PRIMARY KEY ("SpecialOfferID", "ProductID"), 
	CONSTRAINT fk_specialofferproduct_specialoffer FOREIGN KEY("SpecialOfferID") REFERENCES "SpecialOffer" ("SpecialOfferID"),
	CONSTRAINT fk_specialofferproduct_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "StateProvince" (
	"StateProvinceID" INTEGER -- example: ['101', '103'],
	"StateProvinceCode" TEXT NOT NULL -- example: ['01', '02'],
	"CountryRegionCode" TEXT NOT NULL -- example: ['FR', 'CA'],
	"IsOnlyStateProvinceFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"Name" TEXT NOT NULL -- example: ['Aisne', 'Ain'],
	"TerritoryID" INTEGER NOT NULL -- example: ['1', '6'],
	rowguid TEXT NOT NULL -- example: ['01CEC802-20CE-4F96-B475-2AD263CEA9D0', '00723E00-C976-401D-A92B-E582DF3D6E01'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00', '2014-02-08 10:17:21'],
	PRIMARY KEY ("StateProvinceID"), 
	CONSTRAINT fk_stateprovince_salesterritory FOREIGN KEY("TerritoryID") REFERENCES "SalesTerritory" ("TerritoryID"),
	CONSTRAINT fk_stateprovince_countryregion FOREIGN KEY("CountryRegionCode") REFERENCES "CountryRegion" ("CountryRegionCode"),
	UNIQUE ("StateProvinceCode", "CountryRegionCode")
)


CREATE TABLE "Store" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['956', '630'],
	"Name" TEXT NOT NULL -- example: ['Next-Door Bike Store', 'Professional Sales and Service'],
	"SalesPersonID" INTEGER -- example: ['279', '276'],
	"Demographics" TEXT -- example: ['<StoreSurvey xmlns="http://schemas.microsoft.com/s'],
	rowguid TEXT NOT NULL -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2014-09-12 11:15:07'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_store_businessentity FOREIGN KEY("BusinessEntityID") REFERENCES "BusinessEntity" ("BusinessEntityID"),
	CONSTRAINT fk_store_salesperson FOREIGN KEY("SalesPersonID") REFERENCES "SalesPerson" ("BusinessEntityID")
)


CREATE TABLE "TransactionHistory" (
	"TransactionID" INTEGER -- example: ['100000', '100001'],
	"ProductID" INTEGER NOT NULL -- example: ['794', '784'],
	"ReferenceOrderID" INTEGER NOT NULL -- example: ['41590', '41591'],
	"ReferenceOrderLineID" INTEGER DEFAULT 0 NOT NULL -- example: ['0', '1'],
	"TransactionDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-07-31 00:00:00', '2013-08-01 00:00:00'],
	"TransactionType" TEXT NOT NULL -- example: ['S', 'W'],
	"Quantity" INTEGER NOT NULL -- example: ['2', '1'],
	"ActualCost" REAL NOT NULL -- example: ['6.0', '0.0'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2013-07-31 00:00:00', '2013-08-01 00:00:00'],
	PRIMARY KEY ("TransactionID"), 
	CONSTRAINT fk_transactionhistory_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID")
)


CREATE TABLE "TransactionHistoryArchive" (
	"TransactionID" INTEGER NOT NULL -- example: ['2', '1'],
	"ProductID" INTEGER NOT NULL -- example: ['1', '359'],
	"ReferenceOrderID" INTEGER NOT NULL -- example: ['2', '1'],
	"ReferenceOrderLineID" INTEGER DEFAULT 0 NOT NULL -- example: ['2', '1'],
	"TransactionDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-30 00:00:00', '2011-04-16 00:00:00'],
	"TransactionType" TEXT NOT NULL -- example: ['S', 'P'],
	"Quantity" INTEGER NOT NULL -- example: ['4', '3'],
	"ActualCost" REAL NOT NULL -- example: ['45.0', '50.0'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-30 00:00:00', '2011-04-16 00:00:00'],
	PRIMARY KEY ("TransactionID")
)


CREATE TABLE "UnitMeasure" (
	"UnitMeasureCode" TEXT NOT NULL -- example: ['BOX', 'BTL'],
	"Name" TEXT NOT NULL -- example: ['Boxes', 'Bottle'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2008-04-30 00:00:00'],
	PRIMARY KEY ("UnitMeasureCode")
)


CREATE TABLE "Vendor" (
	"BusinessEntityID" INTEGER NOT NULL -- example: ['1596', '1496'],
	"AccountNumber" TEXT NOT NULL -- example: ['ADVANCED0001', 'ADATUM0001'],
	"Name" TEXT NOT NULL -- example: ['Allenson Cycles', 'Australia Bike Retailer'],
	"CreditRating" INTEGER NOT NULL -- example: ['2', '1'],
	"PreferredVendorStatus" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"ActiveFlag" INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	"PurchasingWebServiceURL" TEXT -- example: ['www.litwareinc.com/', 'www.treyresearch.net/'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-04-25 00:00:00', '2011-12-23 00:00:00'],
	PRIMARY KEY ("BusinessEntityID"), 
	CONSTRAINT fk_vendor_businessentity FOREIGN KEY("BusinessEntityID") REFERENCES "BusinessEntity" ("BusinessEntityID")
)


CREATE TABLE "WorkOrder" (
	"WorkOrderID" INTEGER -- example: ['2', '1'],
	"ProductID" INTEGER NOT NULL -- example: ['722', '725'],
	"OrderQty" INTEGER NOT NULL -- example: ['15', '8'],
	"StockedQty" INTEGER NOT NULL -- example: ['15', '8'],
	"ScrappedQty" INTEGER NOT NULL -- example: ['0', '1'],
	"StartDate" DATETIME NOT NULL -- example: ['2011-06-04 00:00:00', '2011-06-03 00:00:00'],
	"EndDate" DATETIME -- example: ['2011-06-13 00:00:00', '2011-06-19 00:00:00'],
	"DueDate" DATETIME NOT NULL -- example: ['2011-06-15 00:00:00', '2011-06-14 00:00:00'],
	"ScrapReasonID" INTEGER -- example: ['7', '11'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-06-13 00:00:00', '2011-06-19 00:00:00'],
	PRIMARY KEY ("WorkOrderID"), 
	CONSTRAINT fk_workorder_product FOREIGN KEY("ProductID") REFERENCES "Product" ("ProductID"),
	CONSTRAINT fk_workorder_scrapreason FOREIGN KEY("ScrapReasonID") REFERENCES "ScrapReason" ("ScrapReasonID")
)


CREATE TABLE "WorkOrderRouting" (
	"WorkOrderID" INTEGER NOT NULL -- example: ['14', '13'],
	"ProductID" INTEGER NOT NULL -- example: ['747', '748'],
	"OperationSequence" INTEGER NOT NULL -- example: ['2', '1'],
	"LocationID" INTEGER NOT NULL -- example: ['20', '10'],
	"ScheduledStartDate" DATETIME NOT NULL -- example: ['2011-06-04 00:00:00', '2011-06-03 00:00:00'],
	"ScheduledEndDate" DATETIME NOT NULL -- example: ['2011-06-15 00:00:00', '2011-06-14 00:00:00'],
	"ActualStartDate" DATETIME -- example: ['2011-06-09 00:00:00', '2011-06-03 00:00:00'],
	"ActualEndDate" DATETIME -- example: ['2011-06-15 00:00:00', '2011-06-19 00:00:00'],
	"ActualResourceHrs" REAL -- example: ['3.5', '4.1'],
	"PlannedCost" REAL NOT NULL -- example: ['87.5', '92.25'],
	"ActualCost" REAL -- example: ['87.5', '92.25'],
	"ModifiedDate" DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL -- example: ['2011-06-15 00:00:00', '2011-06-19 00:00:00'],
	PRIMARY KEY ("WorkOrderID", "ProductID", "OperationSequence"), 
	CONSTRAINT fk_workorderrouting_workorder FOREIGN KEY("WorkOrderID") REFERENCES "WorkOrder" ("WorkOrderID"),
	CONSTRAINT fk_workorderrouting_location FOREIGN KEY("LocationID") REFERENCES "Location" ("LocationID")
)

Question: Based on the lastet payrate of each employee, calculate the average hourly payrate for each department.
Evidence: latest payrate refers to max(RateChangeDate); average hourly payrate = divide(sum(Rate), count(BusinessEntityID)) for each DepartmentID

SQL:
SELECT AVG(T1.Rate) FROM EmployeePayHistory AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.RateChangeDate = ( SELECT MAX(T1.RateChangeDate) FROM EmployeePayHistory AS T1 INNER JOIN Department AS T2 ON T1.BusinessEntityID = T2.DepartmentID )