CREATE TABLE CountryRegion
(
    CountryRegionCode TEXT                          not null
        primary key,
    Name              TEXT                        not null
            unique,
    ModifiedDate      DATETIME default current_timestamp not null
);
CountryRegion
CREATE TABLE Culture
(
    CultureID    TEXT                             not null
        primary key,
    Name         TEXT                        not null
            unique,
    ModifiedDate DATETIME default current_timestamp not null
);
Culture
CREATE TABLE Currency
(
    CurrencyCode TEXT                             not null
        primary key,
    Name         TEXT                        not null
            unique,
    ModifiedDate DATETIME default current_timestamp not null
);
Currency
CREATE TABLE CountryRegionCurrency
(
    CountryRegionCode TEXT                          not null,
    CurrencyCode      TEXT                             not null,
    ModifiedDate      DATETIME default current_timestamp not null,
    primary key (CountryRegionCode, CurrencyCode),
    foreign key (CountryRegionCode) references CountryRegion(CountryRegionCode),
    foreign key (CurrencyCode) references Currency(CurrencyCode)
);
CountryRegionCurrency
CREATE TABLE Person
(
    BusinessEntityID      INTEGER                                  not null
        primary key,
    PersonType            TEXT                              not null,
    NameStyle             INTEGER default 0                 not null,
    Title                 TEXT,
    FirstName             TEXT                         not null,
    MiddleName            TEXT,
    LastName              TEXT                         not null,
    Suffix                TEXT,
    EmailPromotion        INTEGER        default 0                 not null,
    AdditionalContactInfo TEXT,
    Demographics          TEXT,
    rowguid               TEXT                          not null
            unique,
    ModifiedDate          DATETIME  default current_timestamp not null,
    foreign key (BusinessEntityID) references BusinessEntity(BusinessEntityID)
);
Person
CREATE TABLE BusinessEntityContact
(
    BusinessEntityID INTEGER                                 not null,
    PersonID         INTEGER                                 not null,
    ContactTypeID    INTEGER                                 not null,
    rowguid         TEXT                         not null
            unique,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (BusinessEntityID, PersonID, ContactTypeID),
    foreign key (BusinessEntityID) references BusinessEntity(BusinessEntityID),
    foreign key (ContactTypeID) references ContactType(ContactTypeID),
    foreign key (PersonID) references Person(BusinessEntityID)
);
BusinessEntityContact
CREATE TABLE EmailAddress
(
    BusinessEntityID INTEGER                                 not null,
    EmailAddressID   INTEGER,
    EmailAddress     TEXT,
    rowguid          TEXT                         not null,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (EmailAddressID, BusinessEntityID),
    foreign key (BusinessEntityID) references Person(BusinessEntityID)
);
EmailAddress
CREATE TABLE Employee
(
    BusinessEntityID  INTEGER                                 not null
        primary key,
    NationalIDNumber  TEXT                          not null
            unique,
    LoginID           TEXT                         not null
            unique,
    OrganizationNode  TEXT,
    OrganizationLevel INTEGER,
    JobTitle          TEXT                          not null,
    BirthDate         DATE                                 not null,
    MaritalStatus     TEXT                                 not null,
    Gender            TEXT                                 not null,
    HireDate          DATE                                 not null,
    SalariedFlag      INTEGER default 1                 not null,
    VacationHours     INTEGER   default 0                 not null,
    SickLeaveHours    INTEGER   default 0                 not null,
    CurrentFlag       INTEGER default 1                 not null,
    rowguid           TEXT                          not null
            unique,
    ModifiedDate      DATETIME  default current_timestamp not null,
    foreign key (BusinessEntityID) references Person(BusinessEntityID)
);
Employee
CREATE TABLE Password
(
    BusinessEntityID INTEGER                                 not null
        primary key,
    PasswordHash     TEXT                        not null,
    PasswordSalt     TEXT                         not null,
    rowguid          TEXT                         not null,
    ModifiedDate     DATETIME default current_timestamp not null,
    foreign key (BusinessEntityID) references Person(BusinessEntityID)
);
Password
CREATE TABLE PersonCreditCard
(
    BusinessEntityID INTEGER                                 not null,
    CreditCardID     INTEGER                                 not null,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (BusinessEntityID, CreditCardID),
    foreign key (CreditCardID) references CreditCard(CreditCardID),
    foreign key (BusinessEntityID) references Person(BusinessEntityID)
);
PersonCreditCard
CREATE TABLE ProductCategory
(
    ProductCategoryID INTEGER
        primary key autoincrement,
    Name              TEXT                        not null
        unique,
    rowguid           TEXT                         not null
        unique,
    ModifiedDate      DATETIME default CURRENT_TIMESTAMP not null
);
ProductCategory
CREATE TABLE ProductDescription
(
    ProductDescriptionID INTEGER
        primary key autoincrement,
    Description          TEXT                        not null,
    rowguid              TEXT                         not null
        unique,
    ModifiedDate         DATETIME default CURRENT_TIMESTAMP not null
);
ProductDescription
CREATE TABLE ProductModel
(
    ProductModelID     INTEGER
        primary key autoincrement,
    Name               TEXT                        not null
        unique,
    CatalogDescription TEXT,
    Instructions       TEXT,
    rowguid            TEXT                         not null
        unique,
    ModifiedDate       DATETIME default CURRENT_TIMESTAMP not null
);
ProductModel
CREATE TABLE ProductModelProductDescriptionCulture
(
    ProductModelID       INTEGER                             not null,
    ProductDescriptionID INTEGER                             not null,
    CultureID            TEXT                             not null,
    ModifiedDate         DATETIME default CURRENT_TIMESTAMP not null,
    primary key (ProductModelID, ProductDescriptionID, CultureID),
    foreign key (ProductModelID) references ProductModel(ProductModelID),
    foreign key (ProductDescriptionID) references ProductDescription(ProductDescriptionID),
    foreign key (CultureID) references Culture(CultureID)
);
ProductModelProductDescriptionCulture
CREATE TABLE ProductPhoto
(
    ProductPhotoID         INTEGER
        primary key autoincrement,
    ThumbNailPhoto         BLOB,
    ThumbnailPhotoFileName TEXT,
    LargePhoto             BLOB,
    LargePhotoFileName     TEXT,
    ModifiedDate           DATETIME default CURRENT_TIMESTAMP not null
);
ProductPhoto
CREATE TABLE ProductSubcategory
(
    ProductSubcategoryID INTEGER
        primary key autoincrement,
    ProductCategoryID    INTEGER                             not null,
    Name                 TEXT                        not null
        unique,
    rowguid              TEXT                         not null
        unique,
    ModifiedDate        DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (ProductCategoryID) references ProductCategory(ProductCategoryID)
);
ProductSubcategory
CREATE TABLE SalesReason
(
    SalesReasonID INTEGER
        primary key autoincrement,
    Name          TEXT                        not null,
    ReasonType    TEXT                        not null,
    ModifiedDate  DATETIME default CURRENT_TIMESTAMP not null
);
SalesReason
CREATE TABLE SalesTerritory
(
    TerritoryID       INTEGER
        primary key autoincrement,
    Name              TEXT                             not null
        unique,
    CountryRegionCode TEXT                               not null,
    "Group"           TEXT                              not null,
    SalesYTD          REAL default 0.0000            not null,
    SalesLastYear     REAL default 0.0000            not null,
    CostYTD           REAL default 0.0000            not null,
    CostLastYear      REAL default 0.0000            not null,
    rowguid           TEXT                              not null
        unique,
    ModifiedDate      DATETIME      default CURRENT_TIMESTAMP not null,
    foreign key (CountryRegionCode) references CountryRegion(CountryRegionCode)
);
SalesTerritory
CREATE TABLE SalesPerson
(
    BusinessEntityID INTEGER                                  not null
        primary key,
    TerritoryID      INTEGER,
    SalesQuota       REAL,
    Bonus            REAL default 0.0000            not null,
    CommissionPct    REAL default 0.0000            not null,
    SalesYTD         REAL default 0.0000            not null,
    SalesLastYear    REAL default 0.0000            not null,
    rowguid          TEXT                              not null
        unique,
    ModifiedDate     DATETIME      default CURRENT_TIMESTAMP not null,
    foreign key (BusinessEntityID) references Employee(BusinessEntityID),
    foreign key (TerritoryID) references SalesTerritory(TerritoryID)
);
SalesPerson
CREATE TABLE SalesPersonQuotaHistory
(
    BusinessEntityID INTEGER                             not null,
    QuotaDate        DATETIME                            not null,
    SalesQuota       REAL                      not null,
    rowguid          TEXT                         not null
        unique,
    ModifiedDate     DATETIME default CURRENT_TIMESTAMP not null,
    primary key (BusinessEntityID, QuotaDate),
    foreign key (BusinessEntityID) references SalesPerson(BusinessEntityID)
);
SalesPersonQuotaHistory
CREATE TABLE SalesTerritoryHistory
(
    BusinessEntityID INTEGER                             not null,
    TerritoryID      INTEGER                             not null,
    StartDate        DATETIME                            not null,
    EndDate          DATETIME,
    rowguid          TEXT                         not null
        unique,
    ModifiedDate     DATETIME default CURRENT_TIMESTAMP not null,
    primary key (BusinessEntityID, StartDate, TerritoryID),
    foreign key (BusinessEntityID) references SalesPerson(BusinessEntityID),
    foreign key (TerritoryID) references SalesTerritory(TerritoryID)
);
SalesTerritoryHistory
CREATE TABLE ScrapReason
(
    ScrapReasonID INTEGER
        primary key autoincrement,
    Name          TEXT                        not null
        unique,
    ModifiedDate  DATETIME default CURRENT_TIMESTAMP not null
);
ScrapReason
CREATE TABLE Shift
(
    ShiftID      INTEGER
        primary key autoincrement,
    Name         TEXT                        not null
        unique,
    StartTime    TEXT                                not null,
    EndTime      TEXT                                not null,
    ModifiedDate DATETIME default CURRENT_TIMESTAMP not null,
    unique (StartTime, EndTime)
);
Shift
CREATE TABLE ShipMethod
(
    ShipMethodID INTEGER
        primary key autoincrement,
    Name         TEXT                             not null
        unique,
    ShipBase     REAL default 0.0000            not null,
    ShipRate    REAL default 0.0000            not null,
    rowguid      TEXT                              not null
        unique,
    ModifiedDate DATETIME      default CURRENT_TIMESTAMP not null
);
ShipMethod
CREATE TABLE SpecialOffer
(
    SpecialOfferID INTEGER
        primary key autoincrement,
    Description    TEXT                             not null,
    DiscountPct    REAL   default 0.0000            not null,
    Type           TEXT                             not null,
    Category       TEXT                             not null,
    StartDate      DATETIME                            not null,
    EndDate        DATETIME                            not null,
    MinQty         INTEGER   default 0                 not null,
    MaxQty         INTEGER,
    rowguid        TEXT                             not null
        unique,
    ModifiedDate   DATETIME default CURRENT_TIMESTAMP not null
);
SpecialOffer
CREATE TABLE BusinessEntityAddress
(
    BusinessEntityID INTEGER                                 not null,
    AddressID        INTEGER                                 not null,
    AddressTypeID    INTEGER                                 not null,
    rowguid          TEXT                         not null
            unique,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (BusinessEntityID, AddressID, AddressTypeID),
    foreign key (AddressID) references Address(AddressID),
    foreign key (AddressTypeID) references AddressType(AddressTypeID),
    foreign key (BusinessEntityID) references BusinessEntity(BusinessEntityID)
);
BusinessEntityAddress
CREATE TABLE SalesTaxRate
(
    SalesTaxRateID  INTEGER
        primary key autoincrement,
    StateProvinceID INTEGER                                  not null,
    TaxType         INTEGER                                  not null,
    TaxRate         REAL default 0.0000            not null,
    Name            TEXT                             not null,
    rowguid         TEXT                              not null
        unique,
    ModifiedDate    DATETIME      default CURRENT_TIMESTAMP not null,
    unique (StateProvinceID, TaxType),
    foreign key (StateProvinceID) references StateProvince(StateProvinceID)
);
SalesTaxRate
CREATE TABLE Store
(
    BusinessEntityID INTEGER                             not null
        primary key,
    Name             TEXT                        not null,
    SalesPersonID    INTEGER,
    Demographics     TEXT,
    rowguid          TEXT                             not null
        unique,
    ModifiedDate     DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (BusinessEntityID) references BusinessEntity(BusinessEntityID),
    foreign key (SalesPersonID) references SalesPerson(BusinessEntityID)
);
Store
CREATE TABLE SalesOrderHeaderSalesReason
(
    SalesOrderID  INTEGER                             not null,
    SalesReasonID INTEGER                             not null,
    ModifiedDate  DATETIME default CURRENT_TIMESTAMP not null,
    primary key (SalesOrderID, SalesReasonID),
    foreign key (SalesOrderID) references SalesOrderHeader(SalesOrderID),
    foreign key (SalesReasonID) references SalesReason(SalesReasonID)
);
SalesOrderHeaderSalesReason
CREATE TABLE TransactionHistoryArchive
(
    TransactionID        INTEGER                             not null
        primary key,
    ProductID            INTEGER                             not null,
    ReferenceOrderID     INTEGER                             not null,
    ReferenceOrderLineID INTEGER   default 0                 not null,
    TransactionDate      DATETIME default CURRENT_TIMESTAMP not null,
    TransactionType      TEXT                                not null,
    Quantity             INTEGER                             not null,
    ActualCost           REAL                             not null,
    ModifiedDate         DATETIME default CURRENT_TIMESTAMP not null
);
TransactionHistoryArchive
CREATE TABLE UnitMeasure
(
    UnitMeasureCode TEXT                             not null
        primary key,
    Name            TEXT                        not null
        unique,
    ModifiedDate    DATETIME default CURRENT_TIMESTAMP not null
);
UnitMeasure
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),
    foreign key (ProductID) references Product(ProductID)
);
ProductCostHistory
CREATE TABLE ProductDocument
(
    ProductID    INTEGER                             not null,
    DocumentNode TEXT                        not null,
    ModifiedDate DATETIME default CURRENT_TIMESTAMP not null,
    primary key (ProductID, DocumentNode),
    foreign key (ProductID) references Product(ProductID),
    foreign key (DocumentNode) references Document(DocumentNode)
);
ProductDocument
CREATE TABLE ProductInventory
(
    ProductID    INTEGER                             not null,
    LocationID   INTEGER                            not null,
    Shelf        TEXT                         not null,
    Bin          INTEGER                             not null,
    Quantity     INTEGER  default 0                 not null,
    rowguid      TEXT                         not null,
    ModifiedDate DATETIME default CURRENT_TIMESTAMP not null,
    primary key (ProductID, LocationID),
    foreign key (ProductID) references Product(ProductID),
    foreign key (LocationID) references Location(LocationID)
);
ProductInventory
CREATE TABLE ProductProductPhoto
(
    ProductID      INTEGER                             not null,
    ProductPhotoID INTEGER                             not null,
    "Primary"      INTEGER   default 0                 not null,
    ModifiedDate   DATETIME default CURRENT_TIMESTAMP not null,
    primary key (ProductID, ProductPhotoID),
    foreign key (ProductID) references Product(ProductID),
    foreign key (ProductPhotoID) references ProductPhoto(ProductPhotoID)
);
ProductProductPhoto
CREATE TABLE ProductReview
(
    ProductReviewID INTEGER
        primary key autoincrement,
    ProductID       INTEGER                             not null,
    ReviewerName   TEXT                        not null,
    ReviewDate      DATETIME default CURRENT_TIMESTAMP not null,
    EmailAddress    TEXT                         not null,
    Rating          INTEGER                             not null,
    Comments        TEXT,
    ModifiedDate    DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (ProductID) references Product(ProductID)
);
ProductReview
CREATE TABLE ShoppingCartItem
(
    ShoppingCartItemID INTEGER
        primary key autoincrement,
    ShoppingCartID     TEXT                         not null,
    Quantity           INTEGER   default 1                 not null,
    ProductID          INTEGER                             not null,
    DateCreated        DATETIME default CURRENT_TIMESTAMP not null,
    ModifiedDate       DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (ProductID) references Product(ProductID)
);
ShoppingCartItem
CREATE TABLE SpecialOfferProduct
(
    SpecialOfferID INTEGER                             not null,
    ProductID      INTEGER                             not null,
    rowguid        TEXT                             not null
        unique,
    ModifiedDate   DATETIME default CURRENT_TIMESTAMP not null,
    primary key (SpecialOfferID, ProductID),
    foreign key (SpecialOfferID) references SpecialOffer(SpecialOfferID),
    foreign key (ProductID) references Product(ProductID)
);
SpecialOfferProduct
CREATE TABLE SalesOrderDetail
(
    SalesOrderID          INTEGER                             not null,
    SalesOrderDetailID    INTEGER
        primary key autoincrement,
    CarrierTrackingNumber TEXT,
    OrderQty              INTEGER                             not null,
    ProductID             INTEGER                             not null,
    SpecialOfferID        INTEGER                             not null,
    UnitPrice             REAL                             not null,
    UnitPriceDiscount     REAL   default 0.0000            not null,
    LineTotal             REAL                             not null,
    rowguid               TEXT                             not null
        unique,
    ModifiedDate          DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (SalesOrderID) references SalesOrderHeader(SalesOrderID),
    foreign key (SpecialOfferID, ProductID) references SpecialOfferProduct(SpecialOfferID, ProductID)
);
SalesOrderDetail
CREATE TABLE TransactionHistory
(
    TransactionID        INTEGER
        primary key autoincrement,
    ProductID            INTEGER                             not null,
    ReferenceOrderID     INTEGER                             not null,
    ReferenceOrderLineID INTEGER   default 0                 not null,
    TransactionDate      DATETIME default CURRENT_TIMESTAMP not null,
    TransactionType      TEXT                                not null,
    Quantity             INTEGER                             not null,
    ActualCost           REAL                             not null,
    ModifiedDate         DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (ProductID) references Product(ProductID)
);
TransactionHistory
CREATE TABLE Vendor
(
    BusinessEntityID        INTEGER                             not null
        primary key,
    AccountNumber           TEXT                         not null
        unique,
    Name                    TEXT                        not null,
    CreditRating            INTEGER                             not null,
    PreferredVendorStatus   INTEGER   default 1                 not null,
    ActiveFlag              INTEGER   default 1                 not null,
    PurchasingWebServiceURL TEXT,
    ModifiedDate            DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (BusinessEntityID) references BusinessEntity(BusinessEntityID)
);
Vendor
CREATE TABLE ProductVendor
(
    ProductID        INTEGER                             not null,
    BusinessEntityID INTEGER                             not null,
    AverageLeadTime  INTEGER                             not null,
    StandardPrice    REAL                      not null,
    LastReceiptCost  REAL,
    LastReceiptDate  DATETIME,
    MinOrderQty      INTEGER                             not null,
    MaxOrderQty      INTEGER                             not null,
    OnOrderQty       INTEGER,
    UnitMeasureCode  TEXT                             not null,
    ModifiedDate     DATETIME default CURRENT_TIMESTAMP not null,
    primary key (ProductID, BusinessEntityID),
    foreign key (ProductID) references Product(ProductID),
    foreign key (BusinessEntityID) references Vendor(BusinessEntityID),
    foreign key (UnitMeasureCode) references UnitMeasure(UnitMeasureCode)
);
ProductVendor
CREATE TABLE PurchaseOrderHeader
(
    PurchaseOrderID INTEGER
        primary key autoincrement,
    RevisionNumber  INTEGER        default 0                 not null,
    Status          INTEGER        default 1                 not null,
    EmployeeID      INTEGER                                  not null,
    VendorID        INTEGER                                  not null,
    ShipMethodID    INTEGER                                  not null,
    OrderDate       DATETIME      default CURRENT_TIMESTAMP not null,
    ShipDate        DATETIME,
    SubTotal        REAL default 0.0000            not null,
    TaxAmt          REAL default 0.0000            not null,
    Freight         REAL default 0.0000            not null,
    TotalDue        REAL                          not null,
    ModifiedDate    DATETIME      default CURRENT_TIMESTAMP not null,
    foreign key (EmployeeID) references Employee(BusinessEntityID),
    foreign key (VendorID) references Vendor(BusinessEntityID),
    foreign key (ShipMethodID) references ShipMethod(ShipMethodID)
);
PurchaseOrderHeader
CREATE TABLE PurchaseOrderDetail
(
    PurchaseOrderID       INTEGER                            not null,
    PurchaseOrderDetailID INTEGER
        primary key autoincrement,
    DueDate               DATETIME                           not null,
    OrderQty              INTEGER                           not null,
    ProductID             INTEGER                            not null,
    UnitPrice             REAL                            not null,
    LineTotal             REAL                            not null,
    ReceivedQty           REAL                            not null,
    RejectedQty           REAL                            not null,
    StockedQty            REAL                            not null,
    ModifiedDate          DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (PurchaseOrderID) references PurchaseOrderHeader(PurchaseOrderID),
    foreign key (ProductID) references Product(ProductID)
);
PurchaseOrderDetail
CREATE TABLE WorkOrder
(
    WorkOrderID   INTEGER
        primary key autoincrement,
    ProductID     INTEGER                             not null,
    OrderQty      INTEGER                             not null,
    StockedQty    INTEGER                             not null,
    ScrappedQty   INTEGER                           not null,
    StartDate     DATETIME                            not null,
    EndDate       DATETIME,
    DueDate       DATETIME                            not null,
    ScrapReasonID INTEGER,
    ModifiedDate  DATETIME default CURRENT_TIMESTAMP not null,
    foreign key (ProductID) references Product(ProductID),
    foreign key (ScrapReasonID) references ScrapReason(ScrapReasonID)
);
WorkOrder
CREATE TABLE WorkOrderRouting
(
    WorkOrderID        INTEGER                             not null,
    ProductID          INTEGER                             not null,
    OperationSequence  INTEGER                             not null,
    LocationID         INTEGER                             not null,
    ScheduledStartDate DATETIME                            not null,
    ScheduledEndDate   DATETIME                            not null,
    ActualStartDate    DATETIME,
    ActualEndDate      DATETIME,
    ActualResourceHrs  REAL,
    PlannedCost        REAL                      not null,
    ActualCost         REAL,
    ModifiedDate       DATETIME default CURRENT_TIMESTAMP not null,
    primary key (WorkOrderID, ProductID, OperationSequence),
    foreign key (WorkOrderID) references WorkOrder(WorkOrderID),
    foreign key (LocationID) references Location(LocationID)
);
WorkOrderRouting
CREATE TABLE Customer
(
    CustomerID    INTEGER
        primary key,
    PersonID      INTEGER,
    StoreID       INTEGER,
    TerritoryID   INTEGER,
    AccountNumber TEXT                         not null
            unique,
    rowguid       TEXT                         not null
            unique,
    ModifiedDate  DATETIME default current_timestamp not null,
    foreign key (PersonID) references Person(BusinessEntityID),
    foreign key (TerritoryID) references SalesTerritory(TerritoryID),
    foreign key (StoreID) references Store(BusinessEntityID)
);
Customer
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),
    foreign key (ProductID) references Product(ProductID)
);
ProductListPriceHistory
CREATE TABLE "Address"
(
    AddressID       INTEGER
        primary key autoincrement,
    AddressLine1    TEXT                               not null,
    AddressLine2    TEXT,
    City            TEXT                               not null,
    StateProvinceID INTEGER                            not null
        references StateProvince,
    PostalCode      TEXT                               not null,
    SpatialLocation TEXT,
    rowguid         TEXT                               not null
        unique,
    ModifiedDate    DATETIME default current_timestamp not null,
    unique (AddressLine1, AddressLine2, City, StateProvinceID, PostalCode)
);
Address
CREATE TABLE "AddressType"
(
    AddressTypeID INTEGER
        primary key autoincrement,
    Name          TEXT                               not null
        unique,
    rowguid       TEXT                               not null
        unique,
    ModifiedDate  DATETIME default current_timestamp not null
);
AddressType
CREATE TABLE "BillOfMaterials"
(
    BillOfMaterialsID INTEGER
        primary key autoincrement,
    ProductAssemblyID INTEGER
        references Product,
    ComponentID       INTEGER                            not null
        references Product,
    StartDate         DATETIME default current_timestamp not null,
    EndDate           DATETIME,
    UnitMeasureCode   TEXT                               not null
        references UnitMeasure,
    BOMLevel          INTEGER                            not null,
    PerAssemblyQty    REAL     default 1.00              not null,
    ModifiedDate      DATETIME default current_timestamp not null,
    unique (ProductAssemblyID, ComponentID, StartDate)
);
BillOfMaterials
CREATE TABLE "BusinessEntity"
(
    BusinessEntityID INTEGER
        primary key autoincrement,
    rowguid          TEXT                               not null
        unique,
    ModifiedDate     DATETIME default current_timestamp not null
);
BusinessEntity
CREATE TABLE "ContactType"
(
    ContactTypeID INTEGER
        primary key autoincrement,
    Name          TEXT                               not null
        unique,
    ModifiedDate  DATETIME default current_timestamp not null
);
ContactType
CREATE TABLE "CurrencyRate"
(
    CurrencyRateID   INTEGER
        primary key autoincrement,
    CurrencyRateDate DATETIME                           not null,
    FromCurrencyCode TEXT                               not null
        references Currency,
    ToCurrencyCode   TEXT                               not null
        references Currency,
    AverageRate      REAL                               not null,
    EndOfDayRate     REAL                               not null,
    ModifiedDate     DATETIME default current_timestamp not null,
    unique (CurrencyRateDate, FromCurrencyCode, ToCurrencyCode)
);
CurrencyRate
CREATE TABLE "Department"
(
    DepartmentID INTEGER
        primary key autoincrement,
    Name         TEXT                               not null
        unique,
    GroupName    TEXT                               not null,
    ModifiedDate DATETIME default current_timestamp not null
);
Department
CREATE TABLE "EmployeeDepartmentHistory"
(
    BusinessEntityID INTEGER                            not null
        references Employee,
    DepartmentID     INTEGER                            not null
        references Department,
    ShiftID          INTEGER                            not null
        references Shift,
    StartDate        DATE                               not null,
    EndDate          DATE,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (BusinessEntityID, StartDate, DepartmentID, ShiftID)
);
EmployeeDepartmentHistory
CREATE TABLE "EmployeePayHistory"
(
    BusinessEntityID INTEGER                            not null
        references Employee,
    RateChangeDate   DATETIME                           not null,
    Rate             REAL                               not null,
    PayFrequency     INTEGER                            not null,
    ModifiedDate     DATETIME default current_timestamp not null,
    primary key (BusinessEntityID, RateChangeDate)
);
EmployeePayHistory
CREATE TABLE "JobCandidate"
(
    JobCandidateID   INTEGER
        primary key autoincrement,
    BusinessEntityID INTEGER
        references Employee,
    Resume           TEXT,
    ModifiedDate     DATETIME default current_timestamp not null
);
JobCandidate
CREATE TABLE "Location"
(
    LocationID   INTEGER
        primary key autoincrement,
    Name         TEXT                               not null
        unique,
    CostRate     REAL     default 0.0000            not null,
    Availability REAL     default 0.00              not null,
    ModifiedDate DATETIME default current_timestamp not null
);
Location
CREATE TABLE "PhoneNumberType"
(
    PhoneNumberTypeID INTEGER
        primary key autoincrement,
    Name              TEXT                               not null,
    ModifiedDate      DATETIME default current_timestamp not null
);
PhoneNumberType
CREATE TABLE "Product"
(
    ProductID             INTEGER
        primary key autoincrement,
    Name                  TEXT                               not null
        unique,
    ProductNumber         TEXT                               not null
        unique,
    MakeFlag              INTEGER  default 1                 not null,
    FinishedGoodsFlag     INTEGER  default 1                 not null,
    Color                 TEXT,
    SafetyStockLevel      INTEGER                            not null,
    ReorderPoint          INTEGER                            not null,
    StandardCost          REAL                               not null,
    ListPrice             REAL                               not null,
    Size                  TEXT,
    SizeUnitMeasureCode   TEXT
        references UnitMeasure,
    WeightUnitMeasureCode TEXT
        references UnitMeasure,
    Weight                REAL,
    DaysToManufacture     INTEGER                            not null,
    ProductLine           TEXT,
    Class                 TEXT,
    Style                 TEXT,
    ProductSubcategoryID  INTEGER
        references ProductSubcategory,
    ProductModelID        INTEGER
        references ProductModel,
    SellStartDate         DATETIME                           not null,
    SellEndDate           DATETIME,
    DiscontinuedDate      DATETIME,
    rowguid               TEXT                               not null
        unique,
    ModifiedDate          DATETIME default current_timestamp not null
);
Product
CREATE TABLE "Document"
(
    DocumentNode    TEXT                               not null
        primary key,
    DocumentLevel   INTEGER,
    Title           TEXT                               not null,
    Owner           INTEGER                            not null
        references Employee,
    FolderFlag      INTEGER  default 0                 not null,
    FileName        TEXT                               not null,
    FileExtension   TEXT                               not null,
    Revision        TEXT                               not null,
    ChangeNumber    INTEGER  default 0                 not null,
    Status          INTEGER                            not null,
    DocumentSummary TEXT,
    Document        BLOB,
    rowguid         TEXT                               not null
        unique,
    ModifiedDate    DATETIME default current_timestamp not null,
    unique (DocumentLevel, DocumentNode)
);
Document
CREATE TABLE "StateProvince"
(
    StateProvinceID         INTEGER
        primary key autoincrement,
    StateProvinceCode       TEXT                               not null,
    CountryRegionCode       TEXT                               not null
        references CountryRegion,
    IsOnlyStateProvinceFlag INTEGER  default 1                 not null,
    Name                    TEXT                               not null
        unique,
    TerritoryID             INTEGER                            not null
        references SalesTerritory,
    rowguid                 TEXT                               not null
        unique,
    ModifiedDate            DATETIME default CURRENT_TIMESTAMP not null,
    unique (StateProvinceCode, CountryRegionCode)
);
StateProvince
CREATE TABLE "CreditCard"
(
    CreditCardID INTEGER
        primary key autoincrement,
    CardType     TEXT                               not null,
    CardNumber   TEXT                               not null
        unique,
    ExpMonth     INTEGER                            not null,
    ExpYear      INTEGER                            not null,
    ModifiedDate DATETIME default current_timestamp not null
);
CreditCard
CREATE TABLE "SalesOrderHeader"
(
    SalesOrderID           INTEGER
        primary key autoincrement,
    RevisionNumber         INTEGER  default 0                 not null,
    OrderDate              DATETIME default CURRENT_TIMESTAMP not null,
    DueDate                DATETIME                           not null,
    ShipDate               DATETIME,
    Status                 INTEGER  default 1                 not null,
    OnlineOrderFlag        INTEGER  default 1                 not null,
    SalesOrderNumber       TEXT                               not null
        unique,
    PurchaseOrderNumber    TEXT,
    AccountNumber          TEXT,
    CustomerID             INTEGER                            not null
        references Customer,
    SalesPersonID          INTEGER
        references SalesPerson,
    TerritoryID            INTEGER
        references SalesTerritory,
    BillToAddressID        INTEGER                            not null
        references Address,
    ShipToAddressID        INTEGER                            not null
        references Address,
    ShipMethodID           INTEGER                            not null
        references Address,
    CreditCardID           INTEGER
        references CreditCard,
    CreditCardApprovalCode TEXT,
    CurrencyRateID         INTEGER
        references CurrencyRate,
    SubTotal               REAL     default 0.0000            not null,
    TaxAmt                 REAL     default 0.0000            not null,
    Freight                REAL     default 0.0000            not null,
    TotalDue               REAL                               not null,
    Comment                TEXT,
    rowguid                TEXT                               not null
        unique,
    ModifiedDate           DATETIME default CURRENT_TIMESTAMP not null
);
SalesOrderHeader
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,The unique id number identifying the product.,integer,
Name,,Name of the product.,text,
ProductNumber,Product Number,The unique product identification number.,text,
MakeFlag,Make Flag,The source of product make.,integer,"0 = Product is purchased, 1 = Product is manufactured in-house. Default: 1"
FinishedGoodsFlag,Finished Goods Flag,Whether the product is salable or not.,integer,0 = Product is not a salable item. 1 = Product is salable. Default: 1
Color,,Color,text,Product color.
SafetyStockLevel,Safety Stock Level,The minimum inventory quantity.,integer,
ReorderPoint,Reorder Point,Inventory level that triggers a purchase order or work order.,integer,
StandardCost,Standard Cost,Standard cost of the product.,real,
ListPrice,List Price,Selling price,real,"commonsense evidence: 
profit = ListPrice - StandardCost"
Size,,Product size,text,
SizeUnitMeasureCode,Size Unit Measure Code,Unit of measure for Size column.,text,
WeightUnitMeasureCode,Weight Unit Measure Code,Unit of measure for Weight column.,text,
Weight,,Product weight,real,
DaysToManufacture,Days To Manufacture,Number of days required to manufacture the product.,integer,
ProductLine,Product Line,Product Routine,text,"R = Road, M = Mountain, T = Touring, S = Standard"
Class,,Product quality class,text,"H = High, M = Medium, L = Low"
Style,,Style,text,"W = Womens, M = Mens, U = Universal"
ProductSubcategoryID,Product Subcategory ID,Product is a member of this product subcategory.,integer,
ProductModelID,Product Model ID,Product is a member of this product model.,integer,
SellStartDate,Sell Start Date,Date the product was available for sale.,datetime,
SellEndDate,Sell End Date,Date the product was no longer available for sale.,datetime,
DiscontinuedDate,Discontinued Date,Date the product was discontinued.,datetime,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Product
original_column_name,column_name,column_description,data_format,value_description
LocationID,Location ID,The unique id number identifying the job candidates.,integer,
Name,,Location description.,text,
CostRate,Cost Rate,Standard hourly cost of the manufacturing location.,real,Default: 0.00
Availability,,Work capacity (in hours) of the manufacturing location.,real,Default: 0.00
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Location
original_column_name,column_name,column_description,data_format,value_description
ProductPhotoID,Product Photo ID,unique id number identifying the products,integer,
ThumbNailPhoto,Thumb Nail Photo,Small image of the product.,blob,"The size of small images.
commonsense evidence:
""80x49 GIF image 3.07 kB"". ""3.07"" represents the size of images, ""GIF"" refers to type of images like JPEG, GIF, etc. "
ThumbnailPhotoFileName,Thumbnail Photo File Name,Small image file name,text,
LargePhoto,large photo,Large image of the product.,blob,
LargePhotoFileName,Large Photo File Name,Large image file name.,text,"commonsense evidence:
similar to ThumbNailPhoto"
ModifiedDate,Modified Date,Date and time the record was last updated.,datetime,
ProductPhoto
original_column_name,column_name,column_description,data_format,value_description
WorkOrderID,Work Order ID,The unique id number identifying work order.,integer,
ProductID,Product ID,Product identification number.,integer,
OrderQty,Order Quantity,Product quantity to build.,integer,
StockedQty,Stocked Quantity,Quantity built and put in inventory.,integer," Computed: isnull([OrderQty]-[ScrappedQty],(0))"
ScrappedQty,Scrapped Quantity,Quantity that failed inspection.,integer,
StartDate,Start Date,Work order start date.,datetime,
EndDate,End Date,Work order end date.,datetime,
DueDate,Due Date,Work order due date.,datetime,
ScrapReasonID,Scrap Reason ID,Reason for inspection failure.,integer,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
WorkOrder
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The id number identifying the person associated with this email address.,integer,
EmailAddressID,Email Address ID,The ID of this email address.,integer,
EmailAddress,Email Address,The E-mail address for the person.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
EmailAddress
original_column_name,column_name,column_description,data_format,value_description
SalesReasonID,,The unique number identifying SalesReason records.,integer,
Name,,Sales reason description,text,
ReasonType,,Category the sales reason belongs to.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesReason
original_column_name,column_name,column_description,data_format,value_description
ProductModelID,Product Model ID,The unique id number identifying the product model.,integer,
Name,,Product model description.,text,
CatalogDescription,Catalog Description,Detailed product catalog information in xml format.,text,
Instructions,,Manufacturing instructions in xml format.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductModel
original_column_name,column_name,column_description,data_format,value_description
BillOfMaterialsID,bill of materials id,The unique number identifying bill of materials.,integer,Primary key for BillOfMaterials records. Identity / Auto increment column.
ProductAssemblyID,product assembly id,Parent product identification number.,integer,
ComponentID,component ID,Component identification number.,integer,
StartDate,start date,Date the component started being used in the assembly item.,datetime,
EndDate,end date,Date the component stopped being used in the assembly item.,datetime,"commonsense evidence:
1. assembly item duration = (EndDate - StartDate) 
2. if EndDate is null, it means the assembly item doesn't finish (still going on)."
UnitMeasureCode,unit measure code,Standard code identifying the unit of measure for the quantity.,text,
BOMLevel,bill of materials level,Indicates the depth the component is from its parent (column2)(AssemblyID).,integer,
PerAssemblyQty,per assembly quantity,Quantity of the component needed to create the assembly.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
BillOfMaterials
original_column_name,column_name,column_description,data_format,value_description
CountryRegionCode,Country Region Code,The unique id number identifying Country Region ISO standard code for countries and regions.,text,
Name,,Country or region name.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
CountryRegion
original_column_name,column_name,column_description,data_format,value_description
AddressTypeID,address type id,Unique numbers identifying address type records.,integer,Primary key for AddressType records. Identity / Auto increment column.
Name,,Address type description. ,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
AddressType
original_column_name,column_name,column_description,data_format,value_description
CurrencyCode,Currency Code,The unique id string identifying the currency.,text,
Name,,Currency name.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Currency
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The id number identifying the employee.,integer,
NationalIDNumber,National ID Number,The national identification number such as a social security number.,text,
LoginID,Login ID,Network login.,text,
OrganizationNode,Organization Node,Where the employee is located in corporate hierarchy.,text,Default: newid()
OrganizationLevel,Organization Level,The depth of the employee in the corporate hierarchy.,integer,Computed: [OrganizationNode].[GetLevel]()
JobTitle,Job Title,Work title such as Buyer or Sales Representative.,text,
BirthDate,Birth Date,Date of birth.,date,
MaritalStatus,Marital Status,Whether this employee is married or not.,text,"M = Married, S = Single"
Gender,Gender,The gender of this employee.,text,"M = Male, F = Female"
HireDate,Hire Date,The employee was hired on this date.,date,
SalariedFlag,Salaried Flag,Job classification.,integer,"0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining."
VacationHours,Vacation Hours,The number of available vacation hours.,integer,
SickLeaveHours,Sick Leave Hours,The number of available sick leave hours.,integer,
CurrentFlag,Current Flag,Whether this employee is active or not,integer,"0 = Inactive, 1 = Active"
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Employee
original_column_name,column_name,column_description,data_format,value_description
ContactTypeID,Contact Type ID,The unique id number identifying the contact type ID.,integer,
Name,,Contact type description.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ContactType
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,The id number identifying the product.,integer,
StartDate,Start Date,Product cost start date,date,
EndDate,End Date,Product cost end date,date,
StandardCost,Standard Cost,Standard cost of the product.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductCostHistory
original_column_name,column_name,column_description,data_format,value_description
UnitMeasureCode,Unit Measure Code,The unique identifying numbers for measure.,text,
Name,Name,Unit of measure description.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
UnitMeasure
original_column_name,column_name,column_description,data_format,value_description
PurchaseOrderID,Purchase Order ID,Purchase order number.,integer,
PurchaseOrderDetailID,Purchase Orde rDetail ID,Unique purchase detail order.,integer,
DueDate,Due Date,Date the product is expected to be received.,datetime,
OrderQty,Order Quantity,Quantity ordered.,integer,
ProductID,Product ID,The id number identifying products.,integer,
UnitPrice,Unit Price,Vendor's selling price of a single product.,real,
LineTotal,Line Total,Per product subtotal,real,"Computed as OrderQty * UnitPrice. Computed: isnull([OrderQty]*[UnitPrice],(0.00))"
ReceivedQty,ReceivedQty,Quantity actually received from the vendor.,real,
RejectedQty,,,,
StockedQty,,,,
ModifiedDate,,,,
PurchaseOrderDetail
original_column_name,column_name,column_description,data_format,value_description
PhoneNumberTypeID,Phone Number Type ID,The id number identifying the telephone number type records.,integer,
Name,Phone Number,Name of the telephone number type.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
PhoneNumberType
original_column_name,column_name,column_description,data_format,value_description
TransactionID,Transaction ID,The unique id number identifying TransactionHistory records.,integer,
ProductID,Product ID,Product identification number.,integer,
ReferenceOrderID,Reference Order ID,"Purchase order, sales order, or work order identification number.",integer,
ReferenceOrderLineID,Reference Order Line ID,"Line number associated with the purchase order, sales order, or work order.",integer,
TransactionDate,Transaction Date,Date and time of the transaction.,datetime,
TransactionType,Transaction Type,Type of transaction records.,text,"commonsense evidence:
W = WorkOrder, S = SalesOrder, P = PurchaseOrder"
Quantity,,Product quantity.,integer,
ActualCost,Actual Cost,Product cost.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
TransactionHistory
original_column_name,column_name,column_description,data_format,value_description
SpecialOfferID,Special Offer ID,The unique id number identifying the special offer.,integer,
Description,,Discount description.,text,
DiscountPct,Discount precentage,Discount percentage.,real,
Type,,Discount type category.,text,
Category,,Group the discount applies to such as Reseller or Customer.,text,
StartDate,Start Date,Discount start date.,datetime,
EndDate,End Date,Discount end date.,datetime,"commonsense evidence:
promotion date = EndDate - StartDate"
MinQty,Min Quality,Minimum discount percent allowed.,integer,
MaxQty,Max Quality,Maximum discount percent allowed.,integer,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SpecialOffer
original_column_name,column_name,column_description,data_format,value_description,
SalesOrderID,,,integer,,
SalesOrderDetailID,,,integer,,
CarrierTrackingNumber,,,text,,
OrderQty,,,integer,,
ProductID,,,integer,,
SpecialOfferID,,,integer,,
UnitPrice,,,real,,
UnitPriceDiscount,,,real,,
LineTotal,,,real,,
rowguid,,,text,,
ModifiedDate,ModifiedDate,modified date,datetime,Date and time the record was last updated. ,Default: getdate()
SalesOrderDetail
original_column_name,column_name,column_description,data_format,value_description
StateProvinceID,State Province ID,The unique number for StateProvince records.,integer,
StateProvinceCode,State Province Code,ISO standard state or province code.,text,
CountryRegionCode,Country Region Code,ISO standard country or region code.,text,
IsOnlyStateProvinceFlag,Is Only State Province Flag,,integer,"0 = StateProvinceCode exists. 
1 = StateProvinceCode unavailable, using CountryRegionCode. 
Default: 1. 
commonsense evidence:
To ask whether the StateProvinceCode exists or not."
Name,,State or province description.,text,
TerritoryID,Territory ID,ID of the territory in which the state or province is located.,integer,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
StateProvince
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,The id number identifying the product.,integer,
DocumentNode,Document Node,The hierarchy id number identifying the Document node.,text,Document identification number
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductDocument
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The sales representative.,integer,
TerritoryID,Territory ID,Territory identification number.,integer,
StartDate,Start Date,Date the sales representive started work in the territory.,datetime,
EndDate,End Date,Date the sales representative left work in the territory.,datetime,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesTerritoryHistory
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The unique id number identifying the person.,integer,
PersonType,Person Type,The type of person.,text,"Primary type of person: SC = Store Contact, IN = Individual (retail) customer, SP = Sales person, EM = Employee (non-sales), VC = Vendor contact, GC = General contact"
NameStyle,Name Style,Name Style.,integer,"0 = The data in FirstName and LastName are stored in western style (first name, last name) order. 1 = Eastern style (last name, first name) order. Default: 0"
Title,,A courtesy title.,text,
FirstName,First Name,First name of the person.,text,Default: getdate()
MiddleName,Middle Name,Middle name or middle initial of the person.,text,
LastName,Last Name,Last name of the person.,text,
Suffix,,Surname suffix.,text,
EmailPromotion,Email Promotion,Email Promotion.,integer,"0 = Contact does not wish to receive e-mail promotions, 1 = Contact does wish to receive e-mail promotions from AdventureWorks, 2 = Contact does wish to receive e-mail promotions from AdventureWorks and selected partners. Default: 0"
AdditionalContactInfo,Additional Contact Info,Additional contact information about the person stored in xml format.,text,
Demographics,,"Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.",text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Person
original_column_name,column_name,column_description,data_format,value_description
ShiftID,ShiftID,The unique number identifying the shift.,integer,
Name,,Shift description.,text,
StartTime,Start Time,Shift start time.,text,
EndTime,End Time,Shift end time.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Shift
original_column_name,column_name,column_description,data_format,value_description
CurrencyRateID,Currency Rate ID,The unique id number identifying the currency rate record.,integer,
CurrencyRateDate,Currency Rate Date,Date and time the exchange rate was obtained.,datetime,
FromCurrencyCode,From Currency Code,Exchange rate was converted from this currency code.,text,
ToCurrencyCode,ToCurrencyCode,Exchange rate was converted to this currency code.,text,
AverageRate,Average Rate ,Average exchange rate for the day.,real,
EndOfDayRate,End Of Day Rate,Final exchange rate for the day.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
CurrencyRate
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The unique id number identifying the business entity.,integer,
TerritoryID,Territory ID,Territory currently assigned to.,integer,
SalesQuota,Sales Quota,Projected yearly sales,real,
Bonus,Bonus,Bonus due if quota is met.,real,"commonsense evidence:
if bonus is equal to 0, it means this salesperson doesn't meet quota. vice versa."
CommissionPct,Commission percentage,,real,Commission percent received per sale
SalesYTD,sales year to date,Sales total year to date,real,
SalesLastYear,Sales Last Year,Sales total of previous year.,real,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesPerson
original_column_name,column_name,column_description,data_format,value_description
JobCandidateID,Job Candidate ID,The unique id number identifying the job candidates.,integer,
BusinessEntityID,Business Entity ID,Employee identification number if applicant was hired.,integer,
Resume,,Résumé in XML format.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
JobCandidate
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The id number identifying the person.,integer,
CreditCardID,Credit Card ID,Credit card identification number.,integer,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
PersonCreditCard
original_column_name,column_name,column_description,data_format,value_description
ProductCategoryID,Product Category ID,The unique id number identifying the product category.,integer,
Name,,Category description,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductCategory
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,Product identification number.,integer,
StartDate,Start Date,List price start date.,date,
EndDate,End Date,List price end date.,date,
ListPrice,,Product list price.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductListPriceHistory
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,Employee identification number.,integer,
RateChangeDate,Rate Change Date,Date the change in pay is effective.,datetime,
Rate,,Salary hourly rate.,real,
PayFrequency,Pay Frequency,Pay Frequency.,integer,"1 = Salary received monthly, 2 = Salary received biweekly"
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
EmployeePayHistory
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The unique number identifying business entity.,integer,
Name,,Name of the store.,text,
SalesPersonID,Sales Person ID,ID of the sales person assigned to the customer.,integer,
Demographics,,"Demographic information about the store such as the number of employees, annual sales and store type.",text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Store
original_column_name,column_name,column_description,data_format,value_description
ProductDescriptionID,Product Description ID,The unique id number identifying the product description.,integer,
Description,,Description of the product.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductDescription
original_column_name,column_name,column_description,data_format,value_description
CultureID,Culture ID,The unique id string identifying the language in which AdventrueWorks data is stored.,text,
Name,,Name of the language.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Culture
original_column_name,column_name,column_description,data_format,value_description
CustomerID,Customer ID,The unique id number identifying the customer.,integer,
PersonID,Person ID,The id number identifying the person.,integer,
StoreID,Store ID,The id number identifying the store / bussiness entity.,integer,
TerritoryID,Territory ID,ID of the territory in which the customer is located.,integer,
AccountNumber,Account Number,Unique number identifying the customer assigned by the accounting system.,text,"Computed: isnull('AW'+[ufnLeadingZeros]([CustomerID]),'')"
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Customer
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,Product identification number.,integer,
LocationID,Location ID,Inventory location identification number.,integer,Document identification number
Shelf,,Storage compartment within an inventory location.,text,
Bin,,Storage container on a shelf in an inventory location.,integer,
Quantity,,Quantity of products in the inventory location.,integer,Default: 0
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductInventory
original_column_name,column_name,column_description,data_format,value_description
ProductModelID,Product Model ID,The id number identifying the product model.,integer,
ProductDescriptionID,Product Description ID,Product description identification number.,integer,
CultureID,Culture ID,Culture identification number.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductModelProductDescriptionCulture
original_column_name,column_name,column_description,data_format,value_description
SalesTaxRateID,Sales Tax Rate ID,Unique id number identifying sales tax records.,integer,
StateProvinceID,State Province ID,id number identifying state province.,integer,
TaxType,Tax Type,Tax Type,integer,"1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions"
TaxRate,Tax Rate,Tax rate amount,real,
Name,,Tax rate description,text,"commonsense evidence:
if there's ""+"" in the value, it means this sales are charged by multiple types of tax.
"
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesTaxRate
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,Number identifying the business entity.,integer ,
AddressID,Address ID,Number identifying the address.,integer,
AddressTypeID,Address Type ID,Number identifying the address type.,integer,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
BusinessEntityAddress
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,Product identification number.,integer,
ProductPhotoID,Product Photo ID,Product photo identification number.,integer,
Primary,,Whether this photo is the principal image or not.,integer,"0 = Photo is not the principal image. 
1 = Photo is the principal image. 
commonsense evidence:
staff can mention ""principal"" in the question in order to make the question more realistic."
ModifiedDate,Modified Date,,datetime,
ProductProductPhoto
original_column_name,column_name,column_description,data_format,value_description
AddressID,address id,Unique id number identifying the address.,integer,Primary key for Address records. Identity / Auto increment column.
AddressLine1,address line 1,First street address line.,text,
AddressLine2,address line 2,Second street address line.,text,"commonsense evidence:
1. total address = (AddressLine1+AddressLine2) 
2. if AddressLine2 is not null, it means the address is too long"
City,,Name of the city.,text,
StateProvinceID,state province id,Identification number for the state or province. ,integer,
PostalCode,postal code,Postal code for the street address.,text,
SpatialLocation,spatial location,Latitude and longitude of this address.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Address
original_column_name,column_name,column_description,data_format,value_description
TransactionID,Transaction ID,The unique id number identifying TransactionHistory records.,integer,
ProductID,Product ID,Product identification number.,integer,
ReferenceOrderID,Reference Order ID,"Purchase order, sales order, or work order identification number.",integer,
ReferenceOrderLineID,Reference Order Line ID,"Line number associated with the purchase order, sales order, or work order.",integer,
TransactionDate,Transaction Date,Date and time of the transaction.,datetime,
TransactionType,Transaction Type,Type of transaction records.,text,"commonsense evidence: 
W = WorkOrder, S = SalesOrder, P = PurchaseOrder"
Quantity,,Product quantity.,integer,
ActualCost,Actual Cost,Product cost.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
TransactionHistoryArchive
original_column_name,column_name,column_description,data_format,value_description
CountryRegionCode,Country Region Code,The id number identifying Country Region ISO standard code for countries and regions.,text,
CurrencyCode,Currency Code,ISO standard currency code.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
CountryRegionCurrency
original_column_name,column_name,column_description,data_format,value_description
CreditCardID,Credit Card ID,The unique id number identifying the credit card.,integer,
CardType,Card Type,Credit card name.,text,
CardNumber,Card Number,Credit card number.,text,
ExpMonth,Expiration Month,Credit card expiration month.,integer,
ExpYear,Expiration Year ,Credit card expiration year.,integer,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
CreditCard
original_column_name,column_name,column_description,data_format,value_description
ProductReviewID,Product Review ID,The unique id numbers identifying product reviews.,integer,
ProductID,Product ID,Product identification number.,integer,
ReviewerName,Reviewer Name,The name of reviewer.,text,
ReviewDate,Review Date,Date review was submitted. ,datetime,Default: getdate()
EmailAddress,Email Address,Reviewer's e-mail address.,text,
Rating,,Product rating given by the reviewer. ,integer,"commonsense evidence:
Scale is 1 to 5 with 5 as the highest rating."
Comments,,,,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductReview
original_column_name,column_name,column_description,data_format,value_description
WorkOrderID,WorkOrderID,The id number of work order.,integer,
ProductID,ProductID,The id number identifying products.,integer,
OperationSequence,Operation Sequence,Indicates the manufacturing process sequence.,integer,
LocationID,Location ID,Manufacturing location where the part is processed.,integer,
ScheduledStartDate,Scheduled Start Date,Planned manufacturing start date.,datetime,
ScheduledEndDate,Scheduled End Date,Planned manufacturing end date.,datetime,
ActualStartDate,Actual Start Date,Actual start date.,datetime,
ActualEndDate,ActualEndDate,Actual end date.,datetime,
ActualResourceHrs,Actual Resource Hours,Number of manufacturing hours used.,real,
PlannedCost,Planned Cost,Estimated manufacturing cost.,real,
ActualCost,ActualCost,Actual manufacturing cost.,real,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
WorkOrderRouting
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,Sales person identification number,integer,
QuotaDate,Quota Date,Sales quota date,datetime,
SalesQuota,Sales Quota,Sales quota amount,real,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesPersonQuotaHistory
original_column_name,column_name,column_description,data_format,value_description
DepartmentID,Department ID,The unique id number identifying the department.,integer,
Name,,Name of the department.,text,
GroupName,Group Name,Name of the group to which the department belongs.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Department
original_column_name,column_name,column_description,data_format,value_description
ScrapReasonID,Scrap Reason ID,The unique number identifying for ScrapReason records.,integer,
Name,Name,Failure description.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ScrapReason
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The unique id number identifying the person.,integer,
PasswordHash,Password Hash,Password for the e-mail account.,text,
PasswordSalt,Password Salt,Random value concatenated with the password string before the password is hashed.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Password
original_column_name,column_name,column_description,data_format,value_description
ProductID,Product ID,The id number identifying the products.,integer,
BusinessEntityID,Business Entity ID,The id number identifying the business entities.,integer,
AverageLeadTime,Average Lead Time,The average span of time between placing an order with the vendor and receiving the purchased product.,integer,in days
StandardPrice,Standard Price,The vendor's usual selling price.,real,
LastReceiptCost,Last Receipt Cost,The selling price when last purchased.,real,"commonsense evidence:
profit on net can be computed by LastReceiptCost - StandardPrice"
LastReceiptDate,Last Receipt Date,Date the product was last received by the vendor.,datetime,
MinOrderQty,Min Order Quantity,The maximum quantity that should be ordered.,integer,
MaxOrderQty,Max Order Quantity,The minimum quantity that should be ordered.,integer,
OnOrderQty,On Order Quantity,The quantity currently on order.,integer,"if it's equal to 0, it means ""out of stock"""
UnitMeasureCode,Unit Measure Code,The product's unit of measure.,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductVendor
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,Employee identification number.,integer,
DepartmentID,DepartmentI D,Department in which the employee worked including currently.,integer,
ShiftID,Shift ID,Identifies which 8-hour shift the employee works.,integer,
StartDate,Start Date,Date the employee started working in the department.,date,
EndDate,End Date,Date the employee ended working in the department.,date,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
EmployeeDepartmentHistory
original_column_name,column_name,column_description,data_format,value_description
SalesOrderID,Sales Order ID,The id number of sales order.,integer,
RevisionNumber,,,integer,
OrderDate,Order Date,,datetime,
DueDate,,,datetime,
ShipDate,Ship Date,Estimated shipment date from the vendor,datetime,
Status,Status,Order current status,integer,1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete Default: 1
OnlineOrderFlag,,,integer,
SalesOrderNumber,,,text,
PurchaseOrderNumber,,,text,
AccountNumber,,,text,
CustomerID,,,integer,
SalesPersonID,,,integer,
TerritoryID,,,integer,
BillToAddressID,,,integer,
ShipToAddressID,,,integer,
ShipMethodID,Ship Method ID,Shipping method,integer,
CreditCardID,,,integer,
CreditCardApprovalCode,,,text,
CurrencyRateID,,,integer,
SubTotal,,,real,
TaxAmt,Tax Amount,Tax amount,real,
Freight,Freight,Shipping cost,real,
TotalDue,Total Due,Total due to vendor,real,
Comment,,,text,
rowguid,,,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesOrderHeader
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,Business Entity ID,The id number identifying the Business Entity ID.,integer,
PersonID,Person ID,The id number identifying the Person ID.,integer,
ContactTypeID,Contact Type ID,The id number identifying the contact type ID.,integer,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
BusinessEntityContact
original_column_name,column_name,column_description,data_format,value_description
ProductSubcategoryID,Product Subcategory ID,Unique id number identifying the subcategory of products.,integer,
ProductCategoryID,Product Category ID,Product category identification number.,integer,
Name,,Subcategory description.,text,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ProductSubcategory
original_column_name,column_name,column_description,data_format,value_description
ShipMethodID,Ship Method ID,The unique number for ShipMethod records.,integer,
Name,,Shipping company name.,text,
ShipBase,Ship Base,Minimum shipping charge.,real,
ShipRate,Ship Rate,Shipping charge per pound.,real,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ShipMethod
original_column_name,column_name,column_description,data_format,value_description
SpecialOfferID,Special Offer ID,The id for SpecialOfferProduct records,integer,
ProductID,Product ID,Product identification number.,integer,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SpecialOfferProduct
original_column_name,column_name,column_description,data_format,value_description
PurchaseOrderID,Purchase Order ID,The unique id number identifying purchase order.,integer,
RevisionNumber,Revision Number,Incremental number to track changes to the purchase order over time. ,integer,
Status,Status,Order current status.,integer,1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete Default: 1
EmployeeID,Employee ID,Employee who created the purchase order.,integer,
VendorID,Vendor ID,Vendor with whom the purchase order is placed.,integer,
ShipMethodID,Ship Method ID,Shipping method,integer,
OrderDate,Order Date,Purchase order creation date,datetime,Default: getdate()
ShipDate,Ship Date,Estimated shipment date from the vendor.,datetime,
SubTotal,SubTotal,Purchase order subtotal,real, Computed as SUM (PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID
TaxAmt,Tax Amount,Tax amount,real,
Freight,Freight,Shipping cost,real,
TotalDue,Total Due,Total due to vendor,real,"Computed as Subtotal + TaxAmt + Freight. Computed: isnull(([SubTotal]+[TaxAmt])+[Freight],(0))"
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
PurchaseOrderHeader
original_column_name,column_name,column_description,data_format,value_description
SalesOrderID,Sales Order ID,The id number of sales order.,integer,
SalesReasonID,Sales Reason ID,The id number for sales reasons.,integer,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesOrderHeaderSalesReason
original_column_name,column_name,column_description,data_format,value_description
DocumentNode,Document Node,The unique hierarchy id identifying the document nodes.,text,
DocumentLevel,Document Level,Depth in the document hierarchy.,integer,Computed: [DocumentNode].[GetLevel]()
Title,,Title of the document.,text,
Owner,,Employee who controls the document.,integer,
FolderFlag,Folder Flag,The type of the folders.,integer,"0 = This is a folder, 1 = This is a document. Default: 0"
FileName,File Name,Uniquely identifying the record. Used to support a merge replication sample. ,text,File name of the document
FileExtension,File Extension,File extension indicating the document type.,text,
Revision,,Revision number of the document.,text,
ChangeNumber,Change Number,Engineering change approval number.,integer,
Status,,Status of document processing.,integer,"1 = Pending approval, 2 = Approved, 3 = Obsolete"
DocumentSummary,Document Summary,Document abstract.,text,"commonsense evidence:
if no document Summary: it means this document is private"
Document,,Complete document.,blob,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Document
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,business entity id,Unique number of identifying business entity.,integer,"Primary key for all customers, vendors, and employees. Identity / Auto increment column"
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
BusinessEntity
original_column_name,column_name,column_description,data_format,value_description
BusinessEntityID,BusinessEntityID,The unique number identifying Vendor records.,integer,
AccountNumber,AccountNumber,Vendor account (identification) number.,text,
Name,Name,Company name.,text,
CreditRating,CreditRating,Rating of credit.,integer,"commonsense evidence: 
1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average. 
commonsense evidence:
1, 2, 3 can represent good credit, 4 is average credit, 5 is bad credit."
PreferredVendorStatus,Preferred Vendor Status,Preferred Vendor Status,integer,"commonsense evidence: 
0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product."
ActiveFlag,Active Flag,Vendor URL,integer,"commonsense evidence:
0 = Vendor no longer used. 1 = Vendor is actively used. Default: 1"
PurchasingWebServiceURL,PurchasingWebServiceURL,Purchasing Web Service URL,text,
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
Vendor
original_column_name,column_name,column_description,data_format,value_description
TerritoryID,TerritoryID,The unique id number for SalesTerritory records.,integer,
Name,,Sales territory description.,text,
CountryRegionCode,Country Region Code,ISO standard country or region code.,text,
Group,,Geographic area to which the sales territory belong.,text,
SalesYTD,Sales Year to Date,Sales in the territory year to date.,real,
SalesLastYear,Sales Last Year,Sales in the territory the previous year.,real,
CostYTD,Cost Year to Date,Business costs in the territory year to date.,real,
CostLastYear,Cost Last Year,Business costs in the territory the previous year.,real,
rowguid,rowguid,Uniquely identifying the record. Used to support a merge replication sample. ,text,Default: newid()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
SalesTerritory
original_column_name,column_name,column_description,data_format,value_description
ShoppingCartItemID,Shopping CartItem ID,The unique id number identifying the shopping cart item records.,integer,
ShoppingCartID,Shopping Cart ID,Shopping cart identification number.,text,
Quantity,Quantity,Product quantity ordered.,integer,Default: 1
ProductID,Product ID,Product ordered.,integer,
DateCreated,Date Created,Date the time the record was created. ,datetime,Default: getdate()
ModifiedDate,modified date,Date and time the record was last updated. ,datetime,Default: getdate()
ShoppingCartItem