text: /* SqlServer DDL Generated by BIM 1.0 */
  
  
  CREATE TABLE "D_PRODUCT"
  (
  	"ID_PRODUCT" int NOT NULL,
  	"PRODUCT_NAME" nvarchar(40),
  	"QUANTITY_PER_UNIT" nvarchar(20),
  	"PRODUCT_UNIT_PRICE" money,
  	"DISCONTINUED" bit,
  	"ID_CATEGORY" int
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_PRODUCT"
  ADD CONSTRAINT "PK_D_PRODUCT" PRIMARY KEY NONCLUSTERED ("ID_PRODUCT")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_CATEGORY"
  (
  	"ID_CATEGORY" int NOT NULL,
  	"CATEGORY_NAME" nvarchar(15),
  	"DESCRIPTION" ntext
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_CATEGORY"
  ADD CONSTRAINT "PK_D_CATEGORY" PRIMARY KEY NONCLUSTERED ("ID_CATEGORY")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_ORDER"
  (
  	"ORDER_NUMBER" int NOT NULL
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_ORDER"
  ADD CONSTRAINT "PK_D_ORDER" PRIMARY KEY NONCLUSTERED ("ORDER_NUMBER")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_SHIPPER"
  (
  	"ID_SHIPPER" int NOT NULL,
  	"COMPANY_NAME" CHAR(16)
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_SHIPPER"
  ADD CONSTRAINT "PK_D_SHIPPER" PRIMARY KEY NONCLUSTERED ("ID_SHIPPER")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_CUSTOMER"
  (
  	"ID_CUSTOMER" nvarchar(6) NOT NULL,
  	"CUSTOMER_NAME" nvarchar(40),
  	"CUSTOMER_ADDRESS" nvarchar(60),
  	"CUSTOMER_ZIP_CODE" nvarchar(10),
  	"ID_LOCATION" int
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_CUSTOMER"
  ADD CONSTRAINT "PK_D_CUSTOMER" PRIMARY KEY NONCLUSTERED ("ID_CUSTOMER")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_LOCATION"
  (
  	"ID_LOCATION" int identity(1,1) NOT NULL,
  	"CITY" nvarchar(40),
  	"STATE" nvarchar(40),
  	"ENGLISH_STATE_NAME" nvarchar(40),
  	"STATE_TYPE" nvarchar(40),
  	"REGION" nvarchar(40),
  	"REGION_CODE" nvarchar(16),
  	"COUNTRY" nvarchar(40),
  	"COUNTRY_CODE" nvarchar(10),
  	"POPULATION" int,
  	"SUBDIVISION" nvarchar(40),
  	"CONTINENT" nvarchar(40)
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_LOCATION"
  ADD CONSTRAINT "PK_D_LOCATION" PRIMARY KEY NONCLUSTERED ("ID_LOCATION")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_SUPPLIER"
  (
  	"ID_SUPPLIER" int NOT NULL,
  	"SUPPLIER_NAME" nvarchar(40),
  	"SUPPLIER_ADDRESS" nvarchar(60),
  	"SUPPLIER_ZIP_CODE" nvarchar(10),
  	"ID_LOCATION" int
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_SUPPLIER"
  ADD CONSTRAINT "PK_D_SUPPLIER" PRIMARY KEY NONCLUSTERED ("ID_SUPPLIER")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_EMPLOYEE"
  (
  	"ID_EMPLOYEE" int NOT NULL,
  	"EMPLOYEE_NAME" nvarchar(40),
  	"TITLE" nvarchar(30),
  	"BIRTHDATE" datetime,
  	"HIREDATE" datetime
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_EMPLOYEE"
  ADD CONSTRAINT "PK_D_EMPLOYEE" PRIMARY KEY NONCLUSTERED ("ID_EMPLOYEE")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "D_TIME"
  (
  	"ID_TIME" int identity(1,1) NOT NULL,
  	"WEEK_DAY_NUMBER" int,
  	"MONTH_DAY_NUMBER" int,
  	"WEEK_DAY_NAME" nvarchar(16),
  	"YEAR_WEEK_NUMBER" int,
  	"MONTH_NUMBER" int,
  	"MONTH_NAME" nvarchar(16),
  	"QUARTER" int,
  	"YEAR" int,
  	"SQLDATE" datetime
  )
  WITH (DATA_COMPRESSION = NONE);
  
  ALTER TABLE "D_TIME"
  ADD CONSTRAINT "PK_D_TIME" PRIMARY KEY NONCLUSTERED ("ID_TIME")
  WITH (DATA_COMPRESSION = NONE)
  ;
  
  CREATE TABLE "F_SALES"
  (
  	"ID_PRODUCT" int NULL,	-- should be NOT NULL
  	"ID_SHIPPER" int NULL,	-- should be NOT NULL
  	"ID_CUSTOMER" nvarchar(6) NULL,	-- should be NOT NULL
  	"ID_SUPPLIER" int NULL,	-- should be NOT NULL
  	"ID_EMPLOYEE" int NULL,	-- should be NOT NULL
  	"ID_TIME_DUEDATE" int ,
  --	"ID_TIME_ORDER_DATE" int ,
  	"ID_TIME_ORDERDATE" int ,
  	"ID_TIME_SHIPDATE" int ,
  	"QUANTITY" NUMERIC,
  	"UNITPRICE" NUMERIC,
  	"DISCOUNT" NUMERIC,
  	"FREIGHT" NUMERIC,
  	"ORDER_NUMBER" int NULL	-- should be NOT NULL
  )
  WITH (DATA_COMPRESSION = NONE);
  
  
  ALTER TABLE "D_PRODUCT"
  ADD CONSTRAINT "ProductCategory" FOREIGN KEY ("ID_CATEGORY")
  REFERENCES "D_CATEGORY" ("ID_CATEGORY")
  ;
  
  ALTER TABLE "D_CUSTOMER"
  ADD CONSTRAINT "FK_CUSTOMER_LOCATION" FOREIGN KEY ("ID_LOCATION")
  REFERENCES "D_LOCATION" ("ID_LOCATION")
  ;
  
  ALTER TABLE "D_SUPPLIER"
  ADD CONSTRAINT "FK_SUPPLIER_LOCATION" FOREIGN KEY ("ID_LOCATION")
  REFERENCES "D_LOCATION" ("ID_LOCATION")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_PRODUCT" FOREIGN KEY ("ID_PRODUCT")
  REFERENCES "D_PRODUCT" ("ID_PRODUCT")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_SHIPPER" FOREIGN KEY ("ID_SHIPPER")
  REFERENCES "D_SHIPPER" ("ID_SHIPPER")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_CUSTOMER" FOREIGN KEY ("ID_CUSTOMER")
  REFERENCES "D_CUSTOMER" ("ID_CUSTOMER")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_SUPPLIER" FOREIGN KEY ("ID_SUPPLIER")
  REFERENCES "D_SUPPLIER" ("ID_SUPPLIER")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_EMPLOYEE" FOREIGN KEY ("ID_EMPLOYEE")
  REFERENCES "D_EMPLOYEE" ("ID_EMPLOYEE")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_TIME_DUEDATE" FOREIGN KEY ("ID_TIME_DUEDATE")
  REFERENCES "D_TIME" ("ID_TIME")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_TIME_ORDERDATE" FOREIGN KEY ("ID_TIME_ORDERDATE")
  REFERENCES "D_TIME" ("ID_TIME")
  ;
  
  ALTER TABLE "F_SALES"
  ADD CONSTRAINT "FK_SALES_TIME_SHIPDATE" FOREIGN KEY ("ID_TIME_SHIPDATE")
  REFERENCES "D_TIME" ("ID_TIME")
  ;
  
  