-- Script to create the physical objects in the Fusion Order Demo Schema
-- $Id: createFODSchemaObjects.sql 

CREATE TABLE PERSONS
(
PERSON_ID NUMBER(15) NOT NULL,
PRINCIPAL_NAME VARCHAR2(60) NOT NULL,
TITLE VARCHAR2(12),
FIRST_NAME VARCHAR2(30),
LAST_NAME VARCHAR2(30),
PERSON_TYPE_CODE VARCHAR2(30) NOT NULL,
SUPPLIER_ID NUMBER,
PROVISIONED_FLAG VARCHAR2(1) DEFAULT 'N',
PRIMARY_ADDRESS_ID NUMBER(15),
REGISTERED_DATE DATE,
MEMBERSHIP_ID NUMBER(15),
EMAIL VARCHAR2(25) NOT NULL,
CONFIRMED_EMAIL VARCHAR2(25),
PHONE_NUMBER VARCHAR2(20),
MOBILE_PHONE_NUMBER VARCHAR2(20),
CREDIT_LIMIT NUMBER(9, 2),
DATE_OF_BIRTH DATE,
MARITAL_STATUS_CODE VARCHAR2(30) NOT NULL,
GENDER VARCHAR2(1) NOT NULL,
CHILDREN_UNDER_18 NUMBER(2),
APPROXIMATE_INCOME NUMBER(15),
CONTACT_METHOD_CODE VARCHAR2(30),
CONTACTABLE_FLAG VARCHAR2(1) DEFAULT 'Y' NOT NULL,
CONTACT_BY_AFFILLIATES_FLAG VARCHAR2(1) DEFAULT 'Y' NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE ADDRESSES
(
ADDRESS_ID NUMBER(15) NOT NULL,
ADDRESS1 VARCHAR2(40) NOT NULL,
ADDRESS2 VARCHAR2(40),
CITY VARCHAR2(40) NOT NULL,
POSTAL_CODE VARCHAR2(12),
STATE_PROVINCE VARCHAR2(40) NOT NULL,
COUNTRY_ID CHAR(2) NOT NULL,
LONGITUDE NUMBER,
LATITUDE NUMBER,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE ADDRESS_USAGES
(
ADDRESS_USAGES_ID NUMBER NOT NULL,
ASSOCIATED_OWNER_ID NUMBER(15) NOT NULL,
OWNER_TYPE_CODE VARCHAR2(30) NOT NULL,
ADDRESS_ID NUMBER(15) NOT NULL,
USAGE_TYPE_CODE VARCHAR2(30) NOT NULL,
EXPIRED_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE SUPPLIERS
(
SUPPLIER_ID NUMBER(15) NOT NULL,
SUPPLIER_NAME VARCHAR2(120) NOT NULL,
SUPPLIER_STATUS VARCHAR(30) NOT NULL,
PHONE_NUMBER VARCHAR2(20),
EMAIL VARCHAR2(255),
UI_SKIN VARCHAR2(60),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE PAYMENT_OPTIONS
(
PAYMENT_OPTION_ID NUMBER(16) NOT NULL,
CUSTOMER_ID NUMBER(15) NOT NULL,
PAYMENT_TYPE_CODE VARCHAR2(30) NOT NULL,
BILLING_ADDRESS_ID INTEGER,
ACCOUNT_NUMBER NUMBER(19) NOT NULL,
CARD_TYPE_CODE VARCHAR2(30),
EXPIRE_DATE DATE,
CHECK_DIGITS NUMBER(4),
ROUTING_IDENTIFIER VARCHAR2(15),
INSTITUTION_NAME VARCHAR2(120),
VALID_FROM_DATE DATE,
VALID_TO_DATE DATE,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE CUSTOMER_IDENTIFICATIONS
(
CUSTOMER_ID NUMBER(15) NOT NULL,
ID_TYPE_CODE VARCHAR2(30) NOT NULL,
ID_DETAIL VARCHAR2(20) NOT NULL,
ADDITIONAL_INFORMATION VARCHAR2(1000),
VERIFIED_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
VERIFIED_DATE DATE,
VERIFIED_BY NUMBER(15),
VERIFICATION_METHOD_CODE VARCHAR2(30),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE ORDERS
(
ORDER_ID NUMBER(15) NOT NULL,
ORDER_DATE DATE NOT NULL,
ORDER_SHIPPED_DATE DATE,
ORDER_STATUS_CODE VARCHAR2(30) NOT NULL,
ORDER_TOTAL NUMBER(8, 2) NOT NULL,
CUSTOMER_ID NUMBER(15) NOT NULL,
SHIP_TO_NAME VARCHAR2(120),
SHIP_TO_ADDRESS_ID NUMBER(15) NOT NULL,
SHIP_TO_PHONE_NUMBER VARCHAR2(20),
SHIPPING_OPTION_ID NUMBER(15) NOT NULL,
PAYMENT_OPTION_ID NUMBER(16),
DISCOUNT_ID NUMBER(15),
COUPON_ID NUMBER(15),
FREE_SHIPPING_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
CUSTOMER_COLLECT_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
COLLECTION_WAREHOUSE_ID NUMBER(15),
GIFTWRAP_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
GIFTWRAP_MESSAGE VARCHAR2(2000),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE ORDER_ITEMS
(
ORDER_ID NUMBER(15) NOT NULL,
LINE_ITEM_ID NUMBER(15) NOT NULL,
PRODUCT_ID NUMBER(15) NOT NULL,
QUANTITY NUMBER(6, 0) DEFAULT 1 NOT NULL,
UNIT_PRICE NUMBER(8, 2) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE PRODUCTS_BASE
(
PRODUCT_ID NUMBER(15) NOT NULL,
SUPPLIER_ID NUMBER(15) NOT NULL,
CATEGORY_ID NUMBER(15),
PRODUCT_NAME VARCHAR2(50) NOT NULL,
PRODUCT_STATUS VARCHAR2(30) NOT NULL,
COST_PRICE NUMBER(8, 2),
LIST_PRICE NUMBER(8, 2) NOT NULL,
MIN_PRICE NUMBER(8, 2) NOT NULL,
WARRANTY_PERIOD_MONTHS NUMBER(2, 0),
SHIPPING_CLASS_CODE VARCHAR2(30) NOT NULL,
EXTERNAL_URL VARCHAR2(200),
ATTRIBUTE_CATEGORY VARCHAR2(30),
ATTRIBUTE1 VARCHAR2(150),
ATTRIBUTE2 VARCHAR2(150),
ATTRIBUTE3 VARCHAR2(150),
ATTRIBUTE4 VARCHAR2(150),
ATTRIBUTE5 VARCHAR2(150),
ATTRIBUTE6 VARCHAR2(150),
ATTRIBUTE7 VARCHAR2(150),
ATTRIBUTE8 VARCHAR2(150),
ATTRIBUTE9 VARCHAR2(150),
ATTRIBUTE10 VARCHAR2(150),
ATTRIBUTE11 VARCHAR2(150),
ATTRIBUTE12 VARCHAR2(150),
ATTRIBUTE13 VARCHAR2(150),
ATTRIBUTE14 VARCHAR2(150),
ATTRIBUTE15 VARCHAR2(150),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE WAREHOUSES
(
WAREHOUSE_ID NUMBER(15) NOT NULL,
ADDRESS_ID NUMBER(15) NOT NULL,
WAREHOUSE_NAME VARCHAR2(35) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE WAREHOUSE_STOCK_LEVELS
(
PRODUCT_ID NUMBER(15) NOT NULL,
WAREHOUSE_ID NUMBER(15) NOT NULL,
QUANTITY_ON_HAND NUMBER(8) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE PRODUCT_TRANSLATIONS
(
PRODUCT_ID NUMBER(15) NOT NULL,
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANG VARCHAR2(30),
DESCRIPTION VARCHAR2(4000) NOT NULL,
ADDITIONAL_INFO VARCHAR2(4000),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE PRODUCT_CATEGORIES_BASE
(
CATEGORY_ID NUMBER(15) NOT NULL,
PARENT_CATEGORY_ID NUMBER(15),
CATEGORY_LOCKED_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
REPRESENTATIVE_PRODUCT_ID NUMBER(15),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE DISCOUNTS_BASE
(
DISCOUNT_ID NUMBER(15) NOT NULL,
DISCOUNT_TYPE_CODE VARCHAR2(30) NOT NULL,
DISCOUNT_AMOUNT NUMBER NOT NULL,
APPLY_AS_PERCENTAGE_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
EASY_CODE VARCHAR2(20),
ADD_FREE_SHIPPING_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
ONETIME_DISCOUNT_FLAG VARCHAR2(1) DEFAULT 'Y' NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE ELIGIBLE_DISCOUNTS
(
MEMBERSHIP_ID NUMBER(15) NOT NULL,
DISCOUNT_ID NUMBER(15) NOT NULL,
VALID_FROM_DATE DATE,
VALID_TO_DATE DATE,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE DISCOUNT_TRANSLATIONS
(
DISCOUNT_TRANSLATIONS_ID NUMBER(15) NOT NULL,
DISCOUNT_ID NUMBER(15) NOT NULL,
DESCRIPTION VARCHAR2(4000) NOT NULL,
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANGUAGE VARCHAR2(15) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE PRODUCT_IMAGES
(
PRODUCT_IMAGE_ID NUMBER(15) NOT NULL,
PRODUCT_ID NUMBER(15) NOT NULL,
DEFAULT_VIEW_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
DETAIL_IMAGE_ID NUMBER(15),
IMAGE BLOB NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE MEMBERSHIPS_BASE
(
MEMBERSHIP_ID NUMBER(15) NOT NULL,
MEMBERSHIP_TYPE_CODE VARCHAR2(30) NOT NULL,
CONTACT_ID NUMBER(15) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE COUPON_USAGES
(
CUSTOMER_ID NUMBER(15) NOT NULL,
DISCOUNT_ID NUMBER(15) NOT NULL,
APPLIED_DATE DATE NOT NULL,
ORDER_ID NUMBER(15) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE AVAILABLE_LANGUAGES
(
LANGUAGE VARCHAR2(30) NOT NULL,
DEFAULT_FLAG VARCHAR2(1) DEFAULT 'N' NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE COUNTRY_CODES
(
ISO_COUNTRY_CODE VARCHAR2(2) NOT NULL,
COUNTRY_NAME VARCHAR2(100),
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANG VARCHAR2(30),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE LOOKUP_CODES
(
LOOKUP_TYPE VARCHAR(30) NOT NULL,
LOOKUP_CODE VARCHAR2(30) NOT NULL,
MEANING VARCHAR2(80) NOT NULL,
DESCRIPTION VARCHAR2(240),
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANG VARCHAR2(30) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE SHIPPING_OPTIONS_BASE
(
SHIPPING_OPTION_ID NUMBER(15) NOT NULL,
COUNTRY_CODE VARCHAR2(2),
COST_PER_CLASS1_ITEM NUMBER(8, 2) NOT NULL,
COST_PER_CLASS2_ITEM NUMBER(8, 2) NOT NULL,
COST_PER_CLASS3_ITEM NUMBER(8, 2) NOT NULL,
FREE_SHIPPING_ALLOWED_FLAG VARCHAR2(1) DEFAULT 'N',
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE CUSTOMER_INTERESTS
(
CUSTOMER_ID NUMBER(15) NOT NULL,
CUSTOMER_INTERESTS_ID NUMBER(15) NOT NULL,
CATEGORY_ID NUMBER(15) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE CATEGORY_TRANSLATIONS
(
CATEGORY_ID NUMBER(15) NOT NULL,
CATEGORY_NAME VARCHAR2(50) NOT NULL,
CATEGORY_DESCRIPTION VARCHAR2(1000),
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANG VARCHAR2(30),
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE SHIPPING_OPTION_TRANSLATIONS
(
SHIPPING_TRANSLATIONS_ID NUMBER(15) NOT NULL,
SHIPPING_OPTION_ID NUMBER(15) NOT NULL,
SHIPPING_METHOD VARCHAR2(100) NOT NULL,
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANG VARCHAR2(4000) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE MEMBERSHIP_TRANSLATIONS
(
MEMBERSHIP_TRANSLATIONS_ID NUMBER(15) NOT NULL,
MEMBERSHIP_ID NUMBER(15) NOT NULL,
MEMBERSHIP_NAME VARCHAR2(120) NOT NULL,
DESCRIPTION VARCHAR2(2000),
LANGUAGE VARCHAR2(30) NOT NULL,
SOURCE_LANGUAGE VARCHAR2(15) NOT NULL,
CREATED_BY VARCHAR2(60) NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY VARCHAR2(60) NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
OBJECT_VERSION_ID NUMBER(15) NOT NULL
)
;

CREATE TABLE DEMO_OPTIONS
(
KEY VARCHAR2(40) NOT NULL,
VALUE VARCHAR2(120),
JAVA_DATA_TYPE VARCHAR2(120) DEFAULT 'java.lang.String' NOT NULL,
DESCRIPTION VARCHAR2(4000) NOT NULL
)
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_PK PRIMARY KEY
(
PERSON_ID
)
 ENABLE
;

ALTER TABLE ADDRESSES
ADD CONSTRAINT ADDRESSES_PK PRIMARY KEY
(
ADDRESS_ID
)
 ENABLE
;

ALTER TABLE ADDRESS_USAGES
ADD CONSTRAINT ADDRESS_USAGES_PK PRIMARY KEY
(
ADDRESS_USAGES_ID
)
 ENABLE
;

ALTER TABLE SUPPLIERS
ADD CONSTRAINT SUPPLIERS_PK PRIMARY KEY
(
SUPPLIER_ID
)
 ENABLE
;

ALTER TABLE PAYMENT_OPTIONS
ADD CONSTRAINT PAYMENT_OPTIONS_PK PRIMARY KEY
(
PAYMENT_OPTION_ID
)
 ENABLE
;

ALTER TABLE CUSTOMER_IDENTIFICATIONS
ADD CONSTRAINT VERIFIED_ID_PK PRIMARY KEY
(
CUSTOMER_ID
)
 ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_PK PRIMARY KEY
(
ORDER_ID
)
 ENABLE
;

ALTER TABLE ORDER_ITEMS
ADD CONSTRAINT ORDER_ITEMS_PK PRIMARY KEY
(
ORDER_ID,
LINE_ITEM_ID
)
 ENABLE
;

ALTER TABLE PRODUCTS_BASE
ADD CONSTRAINT PRODUCTS_PK PRIMARY KEY
(
PRODUCT_ID
)
 ENABLE
;

ALTER TABLE WAREHOUSES
ADD CONSTRAINT WAREHOUSES_PK PRIMARY KEY
(
WAREHOUSE_ID
)
 ENABLE
;

ALTER TABLE WAREHOUSE_STOCK_LEVELS
ADD CONSTRAINT WAREHOUSE_STOCK_LEVELS_PK PRIMARY KEY
(
PRODUCT_ID,
WAREHOUSE_ID
)
 ENABLE
;

ALTER TABLE PRODUCT_TRANSLATIONS
ADD CONSTRAINT PRODUCT_TRANSLATIONS_PK PRIMARY KEY
(
PRODUCT_ID,
LANGUAGE
)
 ENABLE
;

ALTER TABLE PRODUCT_CATEGORIES_BASE
ADD CONSTRAINT PRODUCT_TAGS_PK PRIMARY KEY
(
CATEGORY_ID
)
 ENABLE
;

ALTER TABLE DISCOUNTS_BASE
ADD CONSTRAINT DISCOUNTS_PK PRIMARY KEY
(
DISCOUNT_ID
)
 ENABLE
;

ALTER TABLE ELIGIBLE_DISCOUNTS
ADD CONSTRAINT ELIGIBLE_DISCOUNTS_PK PRIMARY KEY
(
DISCOUNT_ID,
MEMBERSHIP_ID
)
 ENABLE
;

ALTER TABLE DISCOUNT_TRANSLATIONS
ADD CONSTRAINT DISCOUNT_TRANSLATIONS_PK PRIMARY KEY
(
DISCOUNT_TRANSLATIONS_ID
)
 ENABLE
;

ALTER TABLE PRODUCT_IMAGES
ADD CONSTRAINT PRODUCT_IMAGES_PK PRIMARY KEY
(
PRODUCT_IMAGE_ID
)
 ENABLE
;

ALTER TABLE MEMBERSHIPS_BASE
ADD CONSTRAINT MEMBERSHIPS_BASE_PK PRIMARY KEY
(
MEMBERSHIP_ID
)
 ENABLE
;

ALTER TABLE COUPON_USAGES
ADD CONSTRAINT COUPON_USAGES_PK PRIMARY KEY
(
CUSTOMER_ID,
DISCOUNT_ID
)
 ENABLE
;

ALTER TABLE AVAILABLE_LANGUAGES
ADD CONSTRAINT AVAILABLE_LANGUAGES_PK PRIMARY KEY
(
LANGUAGE
)
 ENABLE
;

ALTER TABLE COUNTRY_CODES
ADD CONSTRAINT COUNTRY_CODES_PK PRIMARY KEY
(
ISO_COUNTRY_CODE,
LANGUAGE
)
 ENABLE
;

ALTER TABLE LOOKUP_CODES
ADD CONSTRAINT LOOKUP_CODES_PK PRIMARY KEY
(
LOOKUP_TYPE,
LOOKUP_CODE,
LANGUAGE
)
 ENABLE
;

ALTER TABLE SHIPPING_OPTIONS_BASE
ADD CONSTRAINT SHIPPING_OPTIONS_PK PRIMARY KEY
(
SHIPPING_OPTION_ID
)
 ENABLE
;

ALTER TABLE CUSTOMER_INTERESTS
ADD CONSTRAINT CUSTOMER_INTERESTS_PK PRIMARY KEY
(
CUSTOMER_INTERESTS_ID
)
 ENABLE
;

ALTER TABLE CUSTOMER_INTERESTS
ADD CONSTRAINT CUSTOMER_CATEGORY_ID_UNIQUE UNIQUE
(
CUSTOMER_ID, CATEGORY_ID
)
 ENABLE
;

ALTER TABLE CATEGORY_TRANSLATIONS
ADD CONSTRAINT CATEGORY_TRANSLATIONS_PK PRIMARY KEY
(
CATEGORY_ID,
LANGUAGE
)
 ENABLE
;

ALTER TABLE SHIPPING_OPTION_TRANSLATIONS
ADD CONSTRAINT SHIPPING_OPTION_TRANSLATI_PK PRIMARY KEY
(
SHIPPING_TRANSLATIONS_ID
)
 ENABLE
;

ALTER TABLE MEMBERSHIP_TRANSLATIONS
ADD CONSTRAINT MEMBERSHIP_TRANSLATIONS_PK PRIMARY KEY
(
MEMBERSHIP_TRANSLATIONS_ID
)
 ENABLE
;

ALTER TABLE DEMO_OPTIONS
ADD CONSTRAINT DEMO_OPTIONS_PK PRIMARY KEY
(
KEY
)
 ENABLE
;


ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_ADDRESSES_FK FOREIGN KEY
(
PRIMARY_ADDRESS_ID
)
REFERENCES ADDRESSES
(
ADDRESS_ID
) ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_MEMBERSHIPS_BASE_FK FOREIGN KEY
(
MEMBERSHIP_ID
)
REFERENCES MEMBERSHIPS_BASE
(
MEMBERSHIP_ID
) ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSON_SUPPLIER_FK FOREIGN KEY
(
SUPPLIER_ID
)
REFERENCES SUPPLIERS
(
SUPPLIER_ID
) ENABLE
;

ALTER TABLE ADDRESS_USAGES
ADD CONSTRAINT ADDRESS_USAGES_ADDRESSES_FK FOREIGN KEY
(
ADDRESS_ID
)
REFERENCES ADDRESSES
(
ADDRESS_ID
) ENABLE
;

ALTER TABLE ADDRESS_USAGES
ADD CONSTRAINT ADDRESS_USAGES_PERSONS_FK FOREIGN KEY
(
ASSOCIATED_OWNER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE PAYMENT_OPTIONS
ADD CONSTRAINT PAYMENT_OPTIONS_PERSONS_FK FOREIGN KEY
(
CUSTOMER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE CUSTOMER_IDENTIFICATIONS
ADD CONSTRAINT CUSTOMER_IDENTIFICATIONS_FK FOREIGN KEY
(
CUSTOMER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE CUSTOMER_IDENTIFICATIONS
ADD CONSTRAINT CUSTOMER_IDENTIFICATIONS__FK1 FOREIGN KEY
(
VERIFIED_BY
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_PAYMENT_OPTIONS_FK FOREIGN KEY
(
PAYMENT_OPTION_ID
)
REFERENCES PAYMENT_OPTIONS
(
PAYMENT_OPTION_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_SHIPPING_OPTIONS_FK FOREIGN KEY
(
SHIPPING_OPTION_ID
)
REFERENCES SHIPPING_OPTIONS_BASE
(
SHIPPING_OPTION_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_DISCOUNTS_FK FOREIGN KEY
(
DISCOUNT_ID
)
REFERENCES DISCOUNTS_BASE
(
DISCOUNT_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_DISCOUNTS_FK1 FOREIGN KEY
(
COUPON_ID
)
REFERENCES DISCOUNTS_BASE
(
DISCOUNT_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_WAREHOUSES_FK FOREIGN KEY
(
COLLECTION_WAREHOUSE_ID
)
REFERENCES WAREHOUSES
(
WAREHOUSE_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_ADDRESSES_FK FOREIGN KEY
(
SHIP_TO_ADDRESS_ID
)
REFERENCES ADDRESSES
(
ADDRESS_ID
) ENABLE
;

ALTER TABLE ORDERS
ADD CONSTRAINT ORDERS_PERSONS_FK FOREIGN KEY
(
CUSTOMER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE ORDER_ITEMS
ADD CONSTRAINT ORDER_ITEMS_PRODUCTS_FK FOREIGN KEY
(
PRODUCT_ID
)
REFERENCES PRODUCTS_BASE
(
PRODUCT_ID
) ENABLE
;

ALTER TABLE ORDER_ITEMS
ADD CONSTRAINT ORDER_ITEMS_ORDERS_FK FOREIGN KEY
(
ORDER_ID
)
REFERENCES ORDERS
(
ORDER_ID
) ENABLE
;

ALTER TABLE PRODUCTS_BASE
ADD CONSTRAINT PRODUCTS_SUPPLIERS_FK FOREIGN KEY
(
SUPPLIER_ID
)
REFERENCES SUPPLIERS
(
SUPPLIER_ID
) ENABLE
;

ALTER TABLE PRODUCTS_BASE
ADD CONSTRAINT PRODUCTS_PRODUCT_CATEGORIES_FK FOREIGN KEY
(
CATEGORY_ID
)
REFERENCES PRODUCT_CATEGORIES_BASE
(
CATEGORY_ID
) ENABLE
;

ALTER TABLE WAREHOUSES
ADD CONSTRAINT WAREHOUSES_ADDRESSES_FK FOREIGN KEY
(
ADDRESS_ID
)
REFERENCES ADDRESSES
(
ADDRESS_ID
) ENABLE
;

ALTER TABLE WAREHOUSE_STOCK_LEVELS
ADD CONSTRAINT WAREHOUSE_STOCK_LEVELS_FK FOREIGN KEY
(
WAREHOUSE_ID
)
REFERENCES WAREHOUSES
(
WAREHOUSE_ID
) ENABLE
;

ALTER TABLE WAREHOUSE_STOCK_LEVELS
ADD CONSTRAINT WAREHOUSE_STOCK_LEVELS_FK1 FOREIGN KEY
(
PRODUCT_ID
)
REFERENCES PRODUCTS_BASE
(
PRODUCT_ID
) ENABLE
;

ALTER TABLE PRODUCT_TRANSLATIONS
ADD CONSTRAINT PRODUCT_TRANSLATIONS_FK FOREIGN KEY
(
PRODUCT_ID
)
REFERENCES PRODUCTS_BASE
(
PRODUCT_ID
) ENABLE
;

ALTER TABLE PRODUCT_CATEGORIES_BASE
ADD CONSTRAINT PRODUCT_CATEGORIES_FK FOREIGN KEY
(
PARENT_CATEGORY_ID
)
REFERENCES PRODUCT_CATEGORIES_BASE
(
CATEGORY_ID
) ENABLE
;

ALTER TABLE PRODUCT_CATEGORIES_BASE
ADD CONSTRAINT REPRESENTATIVE_PRODUCT_FK FOREIGN KEY
(
REPRESENTATIVE_PRODUCT_ID
)
REFERENCES PRODUCTS_BASE
(
PRODUCT_ID
) ENABLE
;

ALTER TABLE ELIGIBLE_DISCOUNTS
ADD CONSTRAINT ELIGIBLE_DISCOUNTS_FK1 FOREIGN KEY
(
DISCOUNT_ID
)
REFERENCES DISCOUNTS_BASE
(
DISCOUNT_ID
) ENABLE
;

ALTER TABLE ELIGIBLE_DISCOUNTS
ADD CONSTRAINT ELIGIBLE_DISCOUNTS_FK FOREIGN KEY
(
MEMBERSHIP_ID
)
REFERENCES MEMBERSHIPS_BASE
(
MEMBERSHIP_ID
) ENABLE
;

ALTER TABLE DISCOUNT_TRANSLATIONS
ADD CONSTRAINT DISCOUNT_TRANSLATIONS_FK FOREIGN KEY
(
DISCOUNT_ID
)
REFERENCES DISCOUNTS_BASE
(
DISCOUNT_ID
) ENABLE
;

ALTER TABLE PRODUCT_IMAGES
ADD CONSTRAINT PRODUCT_IMAGES_FK FOREIGN KEY
(
DETAIL_IMAGE_ID
)
REFERENCES PRODUCT_IMAGES
(
PRODUCT_IMAGE_ID
) ENABLE
;

ALTER TABLE PRODUCT_IMAGES
ADD CONSTRAINT PRODUCT_IMAGES_PRODUCTS_FK FOREIGN KEY
(
PRODUCT_ID
)
REFERENCES PRODUCTS_BASE
(
PRODUCT_ID
) ENABLE
;

ALTER TABLE COUPON_USAGES
ADD CONSTRAINT COUPON_USAGES_DISCOUNTS_FK FOREIGN KEY
(
DISCOUNT_ID
)
REFERENCES DISCOUNTS_BASE
(
DISCOUNT_ID
) ENABLE
;

ALTER TABLE COUPON_USAGES
ADD CONSTRAINT COUPON_USAGES_ORDERS_FK FOREIGN KEY
(
ORDER_ID
)
REFERENCES ORDERS
(
ORDER_ID
) ENABLE
;

ALTER TABLE COUPON_USAGES
ADD CONSTRAINT COUPON_USAGES_PERSONS_FK FOREIGN KEY
(
CUSTOMER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE CUSTOMER_INTERESTS
ADD CONSTRAINT CUSTOMER_INTERESTS_FK1 FOREIGN KEY
(
CATEGORY_ID
)
REFERENCES PRODUCT_CATEGORIES_BASE
(
CATEGORY_ID
) ENABLE
;

ALTER TABLE CUSTOMER_INTERESTS
ADD CONSTRAINT CUSTOMER_INTERESTS_PERSON_FK1 FOREIGN KEY
(
CUSTOMER_ID
)
REFERENCES PERSONS
(
PERSON_ID
) ENABLE
;

ALTER TABLE CATEGORY_TRANSLATIONS
ADD CONSTRAINT CATEGORY_TRANSLATIONS_FK FOREIGN KEY
(
CATEGORY_ID
)
REFERENCES PRODUCT_CATEGORIES_BASE
(
CATEGORY_ID
) ENABLE
;

ALTER TABLE SHIPPING_OPTION_TRANSLATIONS
ADD CONSTRAINT SHIPPING_OPTION_TRANSLATION_FK FOREIGN KEY
(
SHIPPING_OPTION_ID
)
REFERENCES SHIPPING_OPTIONS_BASE
(
SHIPPING_OPTION_ID
) ENABLE
;

ALTER TABLE MEMBERSHIP_TRANSLATIONS
ADD CONSTRAINT MEMBERSHIP_TRANSLATIONS_FK FOREIGN KEY
(
MEMBERSHIP_ID
)
REFERENCES MEMBERSHIPS_BASE
(
MEMBERSHIP_ID
) ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_GENDER_CHK CHECK
(GENDER in ('M','F','D'))
 ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_CONTACT_CHK CHECK
(CONTACTABLE_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_AFF_CONTACT_CHK CHECK
(CONTACT_BY_AFFILLIATES_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE PERSONS
ADD CONSTRAINT PERSONS_PROVISIONED_CHK CHECK
(PROVISIONED_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE ADDRESS_USAGES
ADD CONSTRAINT ADDRESS_USAGES_CHK_EXPIRED CHECK
(EXPIRED_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE CUSTOMER_IDENTIFICATIONS
ADD CONSTRAINT CUSTOMER_ID_VERIFY_CHK CHECK
(VERIFIED_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE PRODUCT_CATEGORIES_BASE
ADD CONSTRAINT PRODUCT_CATEGORIES_LOCKED_CHK CHECK
(CATEGORY_LOCKED_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE DISCOUNTS_BASE
ADD CONSTRAINT DISCOUNT_AS_PERCENTAGE_CHK CHECK
(APPLY_AS_PERCENTAGE_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE DISCOUNTS_BASE
ADD CONSTRAINT DISCOUNTS_FREE_SHIPPING_CHK CHECK
(ADD_FREE_SHIPPING_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE DISCOUNTS_BASE
ADD CONSTRAINT DISCOUNTS_ONETIME_CHK CHECK
(ONETIME_DISCOUNT_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE PRODUCT_IMAGES
ADD CONSTRAINT PRODUCT_IMAGES_DEFAULT_CHK CHECK
(DEFAULT_VIEW_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE AVAILABLE_LANGUAGES
ADD CONSTRAINT AVAILABLE_LANGUAGES_DEFLT_CHK CHECK
(DEFAULT_FLAG in ('Y','N'))
 ENABLE
;

ALTER TABLE SHIPPING_OPTIONS_BASE
ADD CONSTRAINT SHIPPING_OPTIONS_FREE_CHK CHECK
(FREE_SHIPPING_ALLOWED_FLAG  in ('Y','N'))
 ENABLE
;

CREATE VIEW DISCOUNTS AS SELECT 
    DISCOUNT_ID DISCOUNT_ID, 
    DISCOUNT_TRANSLATIONS.DESCRIPTION DESCRIPTION, 
    DISCOUNTS_BASE.DISCOUNT_TYPE_CODE DISCOUNT_TYPE_CODE, 
    DISCOUNTS_BASE.DISCOUNT_AMOUNT DISCOUNT_AMOUNT, 
    DISCOUNTS_BASE.APPLY_AS_PERCENTAGE_FLAG APPLY_AS_PERCENTAGE_FLAG, 
    DISCOUNTS_BASE.EASY_CODE EASY_CODE, 
    DISCOUNTS_BASE.ADD_FREE_SHIPPING_FLAG ADD_FREE_SHIPPING_FLAG, 
    DISCOUNTS_BASE.ONETIME_DISCOUNT_FLAG ONETIME_DISCOUNT_FLAG 
FROM 
    DISCOUNT_TRANSLATIONS INNER JOIN DISCOUNTS_BASE USING (DISCOUNT_ID) 
WHERE 
    DISCOUNT_TRANSLATIONS.LANGUAGE = SYS_CONTEXT('userenv', 'LANG')
WITH READ ONLY;

CREATE VIEW SHIPPING_OPTIONS AS SELECT 
    SHIPPING_OPTION_TRANSLATIONS.SHIPPING_METHOD SHIPPING_METHOD, 
    SHIPPING_OPTION_ID SHIPPING_OPTION_ID, 
    SHIPPING_OPTIONS_BASE.COUNTRY_CODE COUNTRY_CODE, 
    SHIPPING_OPTIONS_BASE.COST_PER_CLASS1_ITEM COST_PER_CLASS1_ITEM, 
    SHIPPING_OPTIONS_BASE.COST_PER_CLASS2_ITEM COST_PER_CLASS2_ITEM, 
    SHIPPING_OPTIONS_BASE.COST_PER_CLASS3_ITEM COST_PER_CLASS3_ITEM, 
    SHIPPING_OPTIONS_BASE.FREE_SHIPPING_ALLOWED_FLAG FREE_SHIPPING_ALLOWED_FLAG 
FROM 
    SHIPPING_OPTION_TRANSLATIONS INNER JOIN SHIPPING_OPTIONS_BASE USING (SHIPPING_OPTION_ID) 
WHERE 
    SHIPPING_OPTION_TRANSLATIONS.LANGUAGE = SYS_CONTEXT('userenv', 'LANG');

CREATE OR REPLACE VIEW PRODUCT_CATEGORIES 
AS SELECT 
    CATEGORY_TRANSLATIONS.CATEGORY_NAME CATEGORY_NAME, 
    CATEGORY_TRANSLATIONS.CATEGORY_DESCRIPTION CATEGORY_DESCRIPTION, 
    CATEGORY_ID CATEGORY_ID, 
    PRODUCT_CATEGORIES_BASE.PARENT_CATEGORY_ID PARENT_CATEGORY_ID, 
    PRODUCT_CATEGORIES_BASE.CATEGORY_LOCKED_FLAG CATEGORY_LOCKED_FLAG, 
    PRODUCT_IMAGES.IMAGE IMAGE
FROM 
    CATEGORY_TRANSLATIONS INNER JOIN PRODUCT_CATEGORIES_BASE USING (CATEGORY_ID), 
    PRODUCT_IMAGES 
WHERE 
    PRODUCT_IMAGES.PRODUCT_ID = PRODUCT_CATEGORIES_BASE.REPRESENTATIVE_PRODUCT_ID AND PRODUCT_IMAGES.DEFAULT_VIEW_FLAG = 'Y' AND CATEGORY_TRANSLATIONS.LANGUAGE = SYS_CONTEXT('userenv', 'LANG')
WITH READ ONLY;

CREATE VIEW PRODUCTS AS SELECT 
    PRODUCT_TRANSLATIONS.DESCRIPTION DESCRIPTION, 
    PRODUCT_TRANSLATIONS.ADDITIONAL_INFO ADDITIONAL_INFO, 
    PRODUCTS_BASE.COST_PRICE COST_PRICE, 
    PRODUCTS_BASE.SUPPLIER_ID SUPPLIER_ID, 
    PRODUCTS_BASE.PRODUCT_NAME PRODUCT_NAME, 
    PRODUCTS_BASE.LIST_PRICE LIST_PRICE, 
    PRODUCT_ID PRODUCT_ID, 
    PRODUCTS_BASE.CATEGORY_ID CATEGORY_ID, 
    PRODUCTS_BASE.MIN_PRICE MIN_PRICE, 
    PRODUCTS_BASE.WARRANTY_PERIOD_MONTHS WARRANTY_PERIOD_MONTHS, 
    PRODUCTS_BASE.SHIPPING_CLASS_CODE SHIPPING_CLASS_CODE, 
    PRODUCTS_BASE.EXTERNAL_URL EXTERNAL_URL, 
    PRODUCTS_BASE.ATTRIBUTE_CATEGORY ATTRIBUTE_CATEGORY, 
    PRODUCTS_BASE.ATTRIBUTE15 ATTRIBUTE15, 
    PRODUCTS_BASE.ATTRIBUTE1 ATTRIBUTE1, 
    PRODUCTS_BASE.ATTRIBUTE2 ATTRIBUTE2, 
    PRODUCTS_BASE.ATTRIBUTE3 ATTRIBUTE3, 
    PRODUCTS_BASE.ATTRIBUTE4 ATTRIBUTE4, 
    PRODUCTS_BASE.ATTRIBUTE5 ATTRIBUTE5, 
    PRODUCTS_BASE.ATTRIBUTE6 ATTRIBUTE6, 
    PRODUCTS_BASE.ATTRIBUTE7 ATTRIBUTE7, 
    PRODUCTS_BASE.ATTRIBUTE8 ATTRIBUTE8, 
    PRODUCTS_BASE.ATTRIBUTE9 ATTRIBUTE9, 
    PRODUCTS_BASE.ATTRIBUTE10 ATTRIBUTE10, 
    PRODUCTS_BASE.ATTRIBUTE11 ATTRIBUTE11, 
    PRODUCTS_BASE.ATTRIBUTE12 ATTRIBUTE12, 
    PRODUCTS_BASE.ATTRIBUTE13 ATTRIBUTE13, 
    PRODUCTS_BASE.ATTRIBUTE14 ATTRIBUTE14 
FROM 
    PRODUCT_TRANSLATIONS INNER JOIN PRODUCTS_BASE USING (PRODUCT_ID) 
WHERE 
    PRODUCT_TRANSLATIONS.LANGUAGE = SYS_CONTEXT('USERENV', 'LANG');

CREATE VIEW PERSON_INFORMATION AS SELECT 
    PERSONS.PERSON_ID CUSTOMER_ID, 
    PERSONS.PRINCIPAL_NAME PRINCIPAL_NAME, 
    PERSONS.TITLE TITLE, 
    PERSONS.FIRST_NAME FIRST_NAME, 
    PERSONS.LAST_NAME LAST_NAME, 
    ADDRESSES1.ADDRESS1 ADDRESS1, 
    ADDRESSES1.ADDRESS2 ADDRESS2, 
    ADDRESSES1.CITY CITY, 
    ADDRESSES1.POSTAL_CODE POSTAL_CODE, 
    ADDRESSES1.STATE_PROVINCE STATE_PROVINCE, 
    ADDRESSES1.COUNTRY_ID COUNTRY_ID, 
    ADDRESSES1.LONGITUDE LONGITUDE, 
    ADDRESSES1.LATITUDE LATITUDE, 
    PERSONS.CONFIRMED_EMAIL CONFIRMED_EMAIL, 
    PERSONS.PHONE_NUMBER PHONE_NUMBER, 
    PERSONS.MOBILE_PHONE_NUMBER MOBILE_PHONE_NUMBER, 
    PERSONS.REGISTERED_DATE REGISTERED_DATE, 
    PERSONS.MEMBERSHIP_ID MEMBERSHIP_ID, 
    PERSONS.CREDIT_LIMIT CREDIT_LIMIT, 
    PERSONS.DATE_OF_BIRTH DATE_OF_BIRTH, 
    PERSONS.MARITAL_STATUS_CODE MARITAL_STATUS_CODE, 
    PERSONS.GENDER GENDER, 
    PERSONS.CHILDREN_UNDER_18 CHILDREN_UNDER_18, 
    PERSONS.APPROXIMATE_INCOME APPROXIMATE_INCOME, 
    PERSONS.CONTACT_METHOD_CODE CONTACT_METHOD_CODE, 
    PERSONS.CONTACTABLE_FLAG CONTACTABLE_FLAG, 
    PERSONS.CONTACT_BY_AFFILLIATES_FLAG CONTACT_BY_AFFILLIATES_FLAG 
FROM 
    PERSONS INNER JOIN ADDRESSES ADDRESSES1 ON PERSONS.PRIMARY_ADDRESS_ID = ADDRESSES1.ADDRESS_ID;

CREATE VIEW MEMBERSHIPS AS SELECT 
    MEMBERSHIP_ID MEMBERSHIP_ID, 
    MEMBERSHIPS_BASE.MEMBERSHIP_TYPE_CODE MEMBERSHIP_TYPE_CODE, 
    MEMBERSHIP_TRANSLATIONS.MEMBERSHIP_NAME MEMBERSHIP_NAME, 
    MEMBERSHIP_TRANSLATIONS.DESCRIPTION DESCRIPTION, 
    MEMBERSHIPS_BASE.CONTACT_ID CONTACT_ID 
FROM 
    MEMBERSHIP_TRANSLATIONS INNER JOIN MEMBERSHIPS_BASE USING (MEMBERSHIP_ID) 
WHERE 
    MEMBERSHIP_TRANSLATIONS.LANGUAGE = SYS_CONTEXT('USERENV', 'LANG');

CREATE SEQUENCE SUPPLIER_SEQ INCREMENT BY 1 START WITH 300 CACHE 10 ;

CREATE SEQUENCE ADDRESS_SEQ INCREMENT BY 1 START WITH 300;

CREATE SEQUENCE ADDRESS_USAGES_SEQ INCREMENT BY 1 START WITH 300;

CREATE SEQUENCE PERSON_SEQ INCREMENT BY 1 START WITH 300 CACHE 10 ;

CREATE SEQUENCE CUSTOMER_INTERESTS_SEQ INCREMENT BY 1 START WITH 200;

CREATE SEQUENCE ORDER_SEQ INCREMENT BY 1 START WITH 1100 CACHE 10;

CREATE SEQUENCE PRODUCT_SEQ INCREMENT BY 1 START WITH 100;

CREATE SEQUENCE WAREHOUSE_SEQ INCREMENT BY 1 START WITH 200;

CREATE SEQUENCE CATEGORY_SEQ INCREMENT BY 1 START WITH 15;

CREATE SEQUENCE PRODUCT_IMAGE_SEQ INCREMENT BY 1 START WITH 68;

CREATE SEQUENCE ORDER_ITEMS_SEQ INCREMENT BY 1 START WITH 101;

CREATE SEQUENCE SHIPPING_OPTION_SEQ INCREMENT BY 1 START WITH 5 ;

CREATE SEQUENCE PAYMENT_OPTION_SEQ INCREMENT BY 1 START WITH 1058 ;

CREATE SEQUENCE MEMBER_SEQ INCREMENT BY 1 START WITH 15;

CREATE SEQUENCE MEMBER_TRANSLATIONS_SEQ INCREMENT BY 1 START WITH 8;

CREATE SEQUENCE DISCOUNT_SEQ INCREMENT BY 1 START WITH 8 ;

CREATE SEQUENCE DISCOUNT_TRANSLATIONS_SEQ INCREMENT BY 1 START WITH 8;

CREATE SEQUENCE SHIPPING_TRANSLATIONS_SEQ INCREMENT BY 1 START WITH 5 ;


COMMENT ON TABLE PERSONS IS 'The core person information table'
;

COMMENT ON TABLE ADDRESSES IS 'The shared address table that is used to hold customer addresses, shipping addresses, warehouse addresses and so on. '
;

COMMENT ON TABLE ADDRESS_USAGES IS 'Intersection entity that maps addresses to customers, suppliers etc. Any entity that can have multiple addresses will map them through this table. Certain address references such as a Customer''s primary address are also de-normalised into the relevant table. Where a consumer has one and only one address it will have a direct reference to the address table and will not have an entry here (for example Warehouse)'
;

COMMENT ON TABLE SUPPLIERS IS 'This table holds a list of product suppliers'
;

COMMENT ON TABLE PAYMENT_OPTIONS IS 'The list of payment types defined for this particular customer'
;

COMMENT ON TABLE CUSTOMER_IDENTIFICATIONS IS 'Various forms of identification provided by a customer. Confirmed identity will be used to configure the rules used during the order process, allowing higer spending and less manual verification'
;

COMMENT ON TABLE ORDERS IS 'Orders holds the core order information'
;

COMMENT ON TABLE ORDER_ITEMS IS 'Holds the order lines'
;

COMMENT ON TABLE PRODUCTS_BASE IS 'The products that are sold'
;

COMMENT ON TABLE WAREHOUSES IS 'Warehouses owned by the store''s company (not individual suppliers) '
;

COMMENT ON TABLE WAREHOUSE_STOCK_LEVELS IS 'Holds information about the stock levels for a particular product in each warehouse.'
;

COMMENT ON TABLE PRODUCT_TRANSLATIONS IS 'Holds the translated names and descriptions of the product. One translation row will exist for each language supported by the system and each product'
;

COMMENT ON TABLE PRODUCT_CATEGORIES_BASE IS 'The classification hierachy for a particular product. Categories can be nested and then a product is assigned to a particular category.  The actual names and descriptions for the categories are held in the separate CATEGORY_TRANSLATIONS table.'
;

COMMENT ON TABLE DISCOUNTS_BASE IS 'DISCOUNTS provides modifiers to an order. A particular order may have up to two discounts applied. The base discount resulting from customer membership  enrollment and a coupon discount for one-time savings'
;

COMMENT ON TABLE ELIGIBLE_DISCOUNTS IS 'Maps the available discounts to a particular membership. Note that One-Time discounts (Coupons) cannot be allocated to memberships in this way.'
;

COMMENT ON TABLE DISCOUNT_TRANSLATIONS IS 'Holds translations of the discount description text'
;

COMMENT ON TABLE PRODUCT_IMAGES IS 'Images of each product. A product many have several images available, only one of which will be marked as primary. Imgaes may also be thumbnails in which case the detailed version is pointed to by the DETAIL_IMAGE_ID'
;

COMMENT ON TABLE MEMBERSHIPS_BASE IS 'The memberships table holds information about corporate and group membership programs. Particular discounts (see ELIGIBLE_DISCOUNTS) are associated with a membership.  Memberships may be personal,  group, coroprate or partner Note that this table is not translated.'
;

COMMENT ON TABLE COUPON_USAGES IS 'Associates the use of One-time discounts (coupons) with a particular customer.  When the customer attempts to apply a coupon to a transaction, this table will be checked to see if they have already used this coupon.'
;

COMMENT ON TABLE AVAILABLE_LANGUAGES IS 'AVAILABLE_LANGUAGES lists all of the translations that are available in the system. Any translation table will be fully populated with one instance per available language. The entry itself may not yet be translated, in which case, the SOURCE_LANGUAGE column in the translation table will hold the language that the entry is currently in. When a value has been translated SOURCE_LANGUAGE and LANGUAGE will be the same. Only one row in this table will have the DEFAULT_FLAG set to Y '
;

COMMENT ON TABLE COUNTRY_CODES IS 'List of ISO Country codes and the name of the relevant country. This contains the translations for each country name as well. So each country code will be repeated for each supported language'
;

COMMENT ON TABLE LOOKUP_CODES IS 'Codes used throughout the system following the standard pattern of code Domains specifying to what a code is used for. '
;

COMMENT ON TABLE SHIPPING_OPTIONS_BASE IS 'This table drives the available shipping options for the order. This list is used by the UI and configured based on the shipping address''s country code. '
;

COMMENT ON TABLE CUSTOMER_INTERESTS IS 'The table is used to record the product categories that are of interest to the customer. This information is used to generate the recomendations list on the home page'
;

COMMENT ON TABLE CATEGORY_TRANSLATIONS IS 'Holds one translation for the  category text for each lanuage supported by the system.'
;

COMMENT ON TABLE SHIPPING_OPTION_TRANSLATIONS IS 'Holds the translated shipping option description. One translation will exist for each supported language and shipping option combination'
;

COMMENT ON TABLE DISCOUNTS IS 'Defines a simplified view of discounts where the translation aspect is automatically handled based on the current user environment'
;

COMMENT ON TABLE PRODUCT_CATEGORIES IS 'Simplified view of categories'
;

COMMENT ON TABLE DEMO_OPTIONS IS 'Demo Settings defines the various options within the demo which are switched on. It also caches general configuration information such as email addresses and phone numbers to use as overrides in a demo scenario (where emails etc. may be fake)'
;

COMMENT ON COLUMN PERSONS.PERSON_ID IS 'Unique Identifier for a Person'
;

COMMENT ON COLUMN PERSONS.PRINCIPAL_NAME IS 'Associates this person record with a security username (principle name) from LDAP or whatever security credential store is in use. '
;

COMMENT ON COLUMN PERSONS.PERSON_TYPE_CODE IS 'Descriminator column: Customer or Staff. References LOOKUP_CODES, domain PERSON_TYPE_CODE'
;

COMMENT ON COLUMN PERSONS.PROVISIONED_FLAG IS 'Boolean (Y/N) flag used to indicate if a person has been provisioned (created) in the security repository'
;

COMMENT ON COLUMN PERSONS.PRIMARY_ADDRESS_ID IS 'Main address of the person. This will be used as the default for filling in forms etc.'
;

COMMENT ON COLUMN PERSONS.REGISTERED_DATE IS 'The date that this person was registered on the system - note that this may not match the CREATION_DATE if the customer delays in confirming the registration.  The CREATION_DATE records when the record was created in the table, the REGISTERED_DATE records when the registration was finally confirmed. Implicitly a record with no REGISTRATION_DATE is a person who has begun, but not completed the registration process'
;

COMMENT ON COLUMN PERSONS.MEMBERSHIP_ID IS 'Customers may enroll in the membership program either using an ID unique to them or a shared Partner or Corporate ID'
;

COMMENT ON COLUMN PERSONS.EMAIL IS 'Contact email for the person. If this needs to be updated once the record is created then the user will either have to call customer support, or if they use the UI then they will have to confirm the email address change from the old email address (CONFIRMED_EMAIL) before it is finalised. Once the new address is confirmed both EMAIL and CONFIRMED_EMAIL will be set to the same value.'
;

COMMENT ON COLUMN PERSONS.CONFIRMED_EMAIL IS 'The confirmed email column holds the last known good email address for the user. This will be set during the confirmation (identity verification) stage of the registration and as part of the final step of an email change operation'
;

COMMENT ON COLUMN PERSONS.PHONE_NUMBER IS 'Primary contact number'
;

COMMENT ON COLUMN PERSONS.CREDIT_LIMIT IS 'Calculated credit limit for this person used by the various rules within the shipping process'
;

COMMENT ON COLUMN PERSONS.MARITAL_STATUS_CODE IS 'Link to the LOOKUP_CODES table, MARITAL_STATUS_DOMAIN'
;

COMMENT ON COLUMN PERSONS.GENDER IS 'Three way flag M - Male, F - Female, D - Decline to Answer'
;

COMMENT ON COLUMN PERSONS.APPROXIMATE_INCOME IS 'Income  rounded - no precision needed'
;

COMMENT ON COLUMN PERSONS.CONTACT_METHOD_CODE IS 'Link to the LOOKUP_CODES table, domain: CONTACT_METHOD_CODE'
;

COMMENT ON COLUMN PERSONS.CONTACTABLE_FLAG IS 'Can the person be contacted with great offers by us? '
;

COMMENT ON COLUMN PERSONS.CONTACT_BY_AFFILLIATES_FLAG IS 'Can the person be contacted with great offers by our carefully chosen partners? '
;

COMMENT ON COLUMN PERSONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PERSONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PERSONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PERSONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PERSONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN ADDRESSES.ADDRESS_ID IS 'Unique identifier for an address'
;

COMMENT ON COLUMN ADDRESSES.ADDRESS1 IS 'First Line of the Address e.g. Street / Apartment number'
;

COMMENT ON COLUMN ADDRESSES.ADDRESS2 IS 'Second line of adress if required'
;

COMMENT ON COLUMN ADDRESSES.CITY IS 'Postal city or town'
;

COMMENT ON COLUMN ADDRESSES.STATE_PROVINCE IS 'If in the  US, this will be restricted to the US States, otherwise this will be free form.'
;

COMMENT ON COLUMN ADDRESSES.COUNTRY_ID IS 'ISO country code. See the COUNTRY_CODES table'
;

COMMENT ON COLUMN ADDRESSES.LONGITUDE IS 'Grid reference information for use in map mashups'
;

COMMENT ON COLUMN ADDRESSES.LATITUDE IS 'Grid reference information for use in map mashups'
;

COMMENT ON COLUMN ADDRESSES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN ADDRESSES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN ADDRESSES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN ADDRESSES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN ADDRESSES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN ADDRESS_USAGES.ASSOCIATED_OWNER_ID IS 'The ID of the associated Customer or Supplier'
;

COMMENT ON COLUMN ADDRESS_USAGES.OWNER_TYPE_CODE IS 'Links the address usage to either a Customer or a Supplier. References LOOKUP_CODES with the domain OWNER_TYPE_CODE'
;

COMMENT ON COLUMN ADDRESS_USAGES.ADDRESS_ID IS 'Unique Id of the mapped address'
;

COMMENT ON COLUMN ADDRESS_USAGES.USAGE_TYPE_CODE IS 'Distinguish between shipping, postal and invoice addresses.References LOOKUP_CODES with the domain USAGE_TYPE_CODE'
;

COMMENT ON COLUMN ADDRESS_USAGES.EXPIRED_FLAG IS 'Boolean to indicate if this address mapping is still valid'
;

COMMENT ON COLUMN ADDRESS_USAGES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN ADDRESS_USAGES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN ADDRESS_USAGES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN ADDRESS_USAGES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN ADDRESS_USAGES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN SUPPLIERS.SUPPLIER_ID IS 'Unique identifier for a supplier'
;

COMMENT ON COLUMN SUPPLIERS.SUPPLIER_NAME IS 'Supplier Name'
;


COMMENT ON COLUMN SUPPLIERS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN SUPPLIERS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN SUPPLIERS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN SUPPLIERS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN SUPPLIERS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.PAYMENT_OPTION_ID IS 'Unique Id for this payment option'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.CUSTOMER_ID IS 'Link to the customer'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.PAYMENT_TYPE_CODE IS 'Type of payment. Links to LOOKUP_CODES with the domain PAYMENT_TYPE_CODE'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.BILLING_ADDRESS_ID IS 'Billing address ID if different from the primary address of the user'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.ACCOUNT_NUMBER IS 'Account number of the Credit card, bank account etc.'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.CARD_TYPE_CODE IS 'If this is a credit/debit card what type is it. Links to LOOKUP_CODES using the domain CARD_TYPE_CODE '
;

COMMENT ON COLUMN PAYMENT_OPTIONS.EXPIRE_DATE IS 'For a card payment when does this card expire. Input will be in the form of MM/YY. We will store as a date at the end of that specified month'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.CHECK_DIGITS IS 'For a card payment this is the verification code that is usually on the signature strip'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.ROUTING_IDENTIFIER IS 'Used when the type is direct debit. Holds the routing (sort) code of the bank'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.INSTITUTION_NAME IS 'If direct Debit is used the name of the bank.'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.VALID_FROM_DATE IS 'From when is this payment option valid? Will defaul to the creation date of the record, but the user may set this to the future if creating a new payment option.'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.VALID_TO_DATE IS 'When was this payment option valid to ( in the case of a credit card this will be the end of the expiry month on the card)'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PAYMENT_OPTIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.CUSTOMER_ID IS 'Link to the persons table'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.ID_TYPE_CODE IS 'The type of identity provided by the customer. A look up in the CODE_LOOKUPS table with the domain of ID_TYPE_CODE'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.ID_DETAIL IS 'The relevant number corresponding to the selected ID type'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.ADDITIONAL_INFORMATION IS 'Free form text for staff use'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.VERIFIED_FLAG IS 'Boolean Y/N, has this piece of ID been verified '
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.VERIFIED_DATE IS 'Date / time that the verification took place'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.VERIFIED_BY IS 'Id of the Staff member who verified the record'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.VERIFICATION_METHOD_CODE IS 'The method of verification. A lookup in the LOOKUP_CODES table referencing the VERIFICATION_METHOD_CODE domain'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_IDENTIFICATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN ORDERS.ORDER_ID IS 'Unique identifier for an order'
;

COMMENT ON COLUMN ORDERS.ORDER_DATE IS 'Date on which the order was placed'
;

COMMENT ON COLUMN ORDERS.ORDER_SHIPPED_DATE IS 'Date on which the order was shipped. Note that the system does not provide for splitting orders into muliple parts for shipping purposes. Well we never said it was real!'
;

COMMENT ON COLUMN ORDERS.ORDER_STATUS_CODE IS 'What status the order is currently in. Links to the LOOKUP_CODES table using the domain ORDER_STATUS_CODE '
;

COMMENT ON COLUMN ORDERS.ORDER_TOTAL IS 'The calculated total for the order based on the products (and quantity) ordered. This value does not include shipping costs.'
;

COMMENT ON COLUMN ORDERS.CUSTOMER_ID IS 'Link to the customer placing the order'
;

COMMENT ON COLUMN ORDERS.SHIP_TO_NAME IS 'The name to address this package to. If null then the name will be constructed from the Customer record'
;

COMMENT ON COLUMN ORDERS.SHIP_TO_ADDRESS_ID IS 'Direct reference to the shipping address. The UI will generally default this to the primary address of the customer.'
;

COMMENT ON COLUMN ORDERS.SHIP_TO_PHONE_NUMBER IS 'Contact phone number for the delivery guy. If null, the phone number of the Customer will be used'
;

COMMENT ON COLUMN ORDERS.SHIPPING_OPTION_ID IS 'How should this order be shipped'
;

COMMENT ON COLUMN ORDERS.PAYMENT_OPTION_ID IS 'What form of payment will be used'
;

COMMENT ON COLUMN ORDERS.DISCOUNT_ID IS 'If the customer has a membership of some sort this will link to the discount level provided by that membership'
;

COMMENT ON COLUMN ORDERS.COUPON_ID IS 'link to a one-off coupon used with this order'
;

COMMENT ON COLUMN ORDERS.FREE_SHIPPING_FLAG IS 'Boolean flag to indicate if shipping costs for basic shipping will be deducted. This flag only takes effect when the FREE_SHIPPING_ALLOWED_FLAG flag is set in the selected Shipping option'
;

COMMENT ON COLUMN ORDERS.CUSTOMER_COLLECT_FLAG IS 'Indicates if this order will be collected from a warehouse rather than being shipped'
;

COMMENT ON COLUMN ORDERS.COLLECTION_WAREHOUSE_ID IS 'If the CUSTOMER_COLLECT_FLAG is set, this column will hold the warehouse that the customer will elect to collect from '
;

COMMENT ON COLUMN ORDERS.GIFTWRAP_FLAG IS 'Boolean Y/N'
;

COMMENT ON COLUMN ORDERS.GIFTWRAP_MESSAGE IS 'Message to be printed and included in a Giftwrapped order.'
;

COMMENT ON COLUMN ORDERS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN ORDERS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN ORDERS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN ORDERS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN ORDERS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN ORDER_ITEMS.ORDER_ID IS 'ID of the associated Order'
;

COMMENT ON COLUMN ORDER_ITEMS.LINE_ITEM_ID IS 'Line number of this item'
;

COMMENT ON COLUMN ORDER_ITEMS.PRODUCT_ID IS 'Product being purchased'
;

COMMENT ON COLUMN ORDER_ITEMS.QUANTITY IS 'Number of units of this product in the purchase'
;

COMMENT ON COLUMN ORDER_ITEMS.UNIT_PRICE IS 'Price per unit'
;

COMMENT ON COLUMN ORDER_ITEMS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN ORDER_ITEMS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN ORDER_ITEMS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN ORDER_ITEMS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN ORDER_ITEMS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN PRODUCTS_BASE.PRODUCT_ID IS 'The unique identifier for this product'
;

COMMENT ON COLUMN PRODUCTS_BASE.SUPPLIER_ID IS 'The unique ID of the supplier of this product'
;

COMMENT ON COLUMN PRODUCTS_BASE.CATEGORY_ID IS 'The category to which this product belongs. This category us used to help in searching for and organizing the products in the Storefront.'
;

COMMENT ON COLUMN PRODUCTS_BASE.PRODUCT_NAME IS 'A descriptive name for this product.'
;

COMMENT ON COLUMN PRODUCTS_BASE.COST_PRICE IS 'The amount paid to the supplier for this product'
;

COMMENT ON COLUMN PRODUCTS_BASE.LIST_PRICE IS 'The suggested list price for the product'
;

COMMENT ON COLUMN PRODUCTS_BASE.MIN_PRICE IS 'The agreed minimum price (after discounts) for this product'
;

COMMENT ON COLUMN PRODUCTS_BASE.WARRANTY_PERIOD_MONTHS IS 'How long is the warantee for this product'
;

COMMENT ON COLUMN PRODUCTS_BASE.SHIPPING_CLASS_CODE IS 'Defines the weight class for this particular product. This is then used to calculate the shipping cost. Code is a lookup to the LOOKUP_CODES table with a domain of SHIPPING_CLASS_CODE'
;

COMMENT ON COLUMN PRODUCTS_BASE.EXTERNAL_URL IS 'Link back to the supplier website '
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE_CATEGORY IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE1 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE2 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE3 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE4 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE5 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE6 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE7 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE8 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE9 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE10 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE11 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE12 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE13 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.ATTRIBUTE14 IS 'Reserved for Applications use as Descriptive Flexfield'
;

COMMENT ON COLUMN PRODUCTS_BASE.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCTS_BASE.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCTS_BASE.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCTS_BASE.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCTS_BASE.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN WAREHOUSES.WAREHOUSE_ID IS 'Unique Id for a warehouse'
;

COMMENT ON COLUMN WAREHOUSES.ADDRESS_ID IS 'Address of the warehouse. A warehouse can only have one location so there is a direct link to addresses here rather than a link via the ADDRESS_USAGES table.'
;

COMMENT ON COLUMN WAREHOUSES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN WAREHOUSES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN WAREHOUSES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN WAREHOUSES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN WAREHOUSES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.PRODUCT_ID IS 'Link to the product table'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.WAREHOUSE_ID IS 'The warehouse in question '
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.QUANTITY_ON_HAND IS 'The stock level of this product'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN WAREHOUSE_STOCK_LEVELS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.PRODUCT_ID IS 'Link to the product'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.LANGUAGE IS 'Language code for this entry'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.SOURCE_LANG IS 'Actual language that this entry is is. If the entry has not yet been translated this value may be different from the defined LANGUAGE of the entry'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.DESCRIPTION IS 'Translated description of the product '
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.ADDITIONAL_INFO IS 'More ionformation about the product such as technical specifications'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_TRANSLATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.CATEGORY_ID IS 'Unique Id for the category'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.PARENT_CATEGORY_ID IS 'The parent of this category in the hierachy'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.CATEGORY_LOCKED_FLAG IS 'Boolean fag to define if new products may be assigned to this category or not '
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.REPRESENTATIVE_PRODUCT_ID IS 'Links to a product which will be used to provide the sample image to illustrate the whole category.'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_CATEGORIES_BASE.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN DISCOUNTS_BASE.DISCOUNT_ID IS 'Unique identifier for the discount'
;

COMMENT ON COLUMN DISCOUNTS_BASE.DISCOUNT_TYPE_CODE IS 'Type of discount referencing a lookup to the LOOKUP_TYPES table, domain DISCOUNT_TYPE_CODE'
;

COMMENT ON COLUMN DISCOUNTS_BASE.DISCOUNT_AMOUNT IS 'The value of the discount either as a dollar amount or as a percentage (see APPLY_AS_PERCENTAGE_FLAG) '
;

COMMENT ON COLUMN DISCOUNTS_BASE.APPLY_AS_PERCENTAGE_FLAG IS 'Boolean flag (Y/N) to define if the DISCOUNT_AMOUNT is a percentage or an absolute value'
;

COMMENT ON COLUMN DISCOUNTS_BASE.EASY_CODE IS 'Short Code for use in marketing promos and email shots'
;

COMMENT ON COLUMN DISCOUNTS_BASE.ADD_FREE_SHIPPING_FLAG IS 'Boolean Y/N: deduct shipping cost when this flag set to Y'
;

COMMENT ON COLUMN DISCOUNTS_BASE.ONETIME_DISCOUNT_FLAG IS 'Boolean Y/N value. Can this discount only be applied once per customer?'
;

COMMENT ON COLUMN DISCOUNTS_BASE.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN DISCOUNTS_BASE.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN DISCOUNTS_BASE.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN DISCOUNTS_BASE.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN DISCOUNTS_BASE.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.MEMBERSHIP_ID IS 'Link to the membership table'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.DISCOUNT_ID IS 'Link to the relevant discount'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.VALID_FROM_DATE IS 'If the life of the discount is restricted, this is the start date (inclusive)'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.VALID_TO_DATE IS 'If the life of the discount is restricted, this is the end date (inclusive)'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN ELIGIBLE_DISCOUNTS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.DISCOUNT_ID IS 'Link to the base discount table'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.DESCRIPTION IS 'The translated description'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.LANGUAGE IS 'The lannguage that this translation row represents '
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.SOURCE_LANGUAGE IS 'The actual language that this row is in - it may not match the LANGUAGE column if the row has not actually been translated yet'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN DISCOUNT_TRANSLATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN PRODUCT_IMAGES.PRODUCT_IMAGE_ID IS 'Unique Id for images'
;

COMMENT ON COLUMN PRODUCT_IMAGES.PRODUCT_ID IS 'Link to the associated product'
;

COMMENT ON COLUMN PRODUCT_IMAGES.DEFAULT_VIEW_FLAG IS 'Only one image can be the default view. This will be the image show in the main catelog. Only one image for a particular product may have this flag set'
;

COMMENT ON COLUMN PRODUCT_IMAGES.DETAIL_IMAGE_ID IS 'Allows for a drilldown from thumbnail view to a detailed version of the image'
;

COMMENT ON COLUMN PRODUCT_IMAGES.IMAGE IS 'The image to show'
;

COMMENT ON COLUMN PRODUCT_IMAGES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_IMAGES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_IMAGES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN PRODUCT_IMAGES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN PRODUCT_IMAGES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.MEMBERSHIP_ID IS 'Unique Id for a memberships'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.MEMBERSHIP_TYPE_CODE IS 'Typ[e of membership, references LOOKUP_CODES; domain: MEMBERSHIP_TYPE_CODE'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.CONTACT_ID IS 'Link to the customer who is the named contact for this particular membership. This is mainly of interest to Group, Corporate and Partner memberships where many users will be associated with the same membership number'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIPS_BASE.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN COUPON_USAGES.CUSTOMER_ID IS 'Link to the customer using the coupon (discount)'
;

COMMENT ON COLUMN COUPON_USAGES.DISCOUNT_ID IS 'Link to the discount being applied '
;

COMMENT ON COLUMN COUPON_USAGES.APPLIED_DATE IS 'When was the discount used'
;

COMMENT ON COLUMN COUPON_USAGES.ORDER_ID IS 'The order for which this discount was used.'
;

COMMENT ON COLUMN COUPON_USAGES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN COUPON_USAGES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN COUPON_USAGES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN COUPON_USAGES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN COUPON_USAGES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.LANGUAGE IS 'The supported language'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.DEFAULT_FLAG IS 'Is this the system base language? Boolean Flag Y or N'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN AVAILABLE_LANGUAGES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN COUNTRY_CODES.ISO_COUNTRY_CODE IS 'The actual country code'
;

COMMENT ON COLUMN COUNTRY_CODES.COUNTRY_NAME IS 'Translated country name'
;

COMMENT ON COLUMN COUNTRY_CODES.LANGUAGE IS 'Language that this row represents'
;

COMMENT ON COLUMN COUNTRY_CODES.SOURCE_LANG IS 'Actual language that this row is currently in. May not necessarily match the LANGUGE value if the entry has yet to be translated'
;

COMMENT ON COLUMN COUNTRY_CODES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN COUNTRY_CODES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN COUNTRY_CODES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN COUNTRY_CODES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN COUNTRY_CODES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN LOOKUP_CODES.LOOKUP_TYPE IS 'The domain to use '
;

COMMENT ON COLUMN LOOKUP_CODES.LOOKUP_CODE IS 'The code to match'
;

COMMENT ON COLUMN LOOKUP_CODES.MEANING IS 'What the code means'
;

COMMENT ON COLUMN LOOKUP_CODES.DESCRIPTION IS 'Further qualification of the meaning'
;

COMMENT ON COLUMN LOOKUP_CODES.LANGUAGE IS 'The language that this row represents'
;

COMMENT ON COLUMN LOOKUP_CODES.SOURCE_LANG IS 'The actual language that the strings in this row are in - this may not match the LANGUAGE column if the row has not yet been translated'
;

COMMENT ON COLUMN LOOKUP_CODES.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN LOOKUP_CODES.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN LOOKUP_CODES.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN LOOKUP_CODES.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN LOOKUP_CODES.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.SHIPPING_OPTION_ID IS 'Unique Id for the shipping method'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.COUNTRY_CODE IS 'Link to the COUNTRY_CODES table. The various types of shipping have different costs for each target country. For the sake of brevity, this table is populated with costs for the a small set of countries. A null country code indicates the rest of the world as a catch all.'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.COST_PER_CLASS1_ITEM IS 'Unit cost for shipping CLASS1 items'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.COST_PER_CLASS2_ITEM IS 'Unit cost for shipping CLASS2 items'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.COST_PER_CLASS3_ITEM IS 'Unit cost for shipping CLASS3 items'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.FREE_SHIPPING_ALLOWED_FLAG IS 'Boolean flag to indicate if this is a deductable shipping cost. In most cases this will only be set to Y for non-express shipping options'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTIONS_BASE.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.CUSTOMER_ID IS 'Unique Id for the customer'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.CATEGORY_ID IS 'The Id iof the category that they are interested in '
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN CUSTOMER_INTERESTS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.CATEGORY_ID IS 'Link to the category table'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.CATEGORY_NAME IS 'Name of the category in the relevant language'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.CATEGORY_DESCRIPTION IS 'Description of the category in the relevant language'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.LANGUAGE IS 'Language assigned for this entry '
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.SOURCE_LANG IS 'Actual language that the values are currently in. The value may not actually be translated, if LANGUAGE and SOURCE_LANG are the same then the row has been translated'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN CATEGORY_TRANSLATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.SHIPPING_OPTION_ID IS 'Link to the shipping option '
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.SHIPPING_METHOD IS 'Translated description'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.LANGUAGE IS 'The language that this row represents'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.SOURCE_LANG IS 'The actual language that this entry is currently in. This value may not match the LANGUAGE column if the entry has yet to be translated.'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN SHIPPING_OPTION_TRANSLATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.MEMBERSHIP_ID IS 'Link to the membership record that this translation is for'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.MEMBERSHIP_NAME IS 'Name of this particular membership'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.DESCRIPTION IS 'Free text description of the membership'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.LANGUAGE IS 'Language which this particular row represents'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.SOURCE_LANGUAGE IS 'Language in which this particular row is actually encoded. If the row has not been translated yet it will not be the same as the LANGUAGE column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.CREATED_BY IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.CREATION_DATE IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.LAST_UPDATED_BY IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.LAST_UPDATE_DATE IS 'History column'
;

COMMENT ON COLUMN MEMBERSHIP_TRANSLATIONS.OBJECT_VERSION_ID IS 'History column'
;

COMMENT ON COLUMN DEMO_OPTIONS.KEY IS 'Key Value to identify the preference. This will use a basic dot notation in the naming. e.g.  "override.customer.email"'
;

COMMENT ON COLUMN DEMO_OPTIONS.VALUE IS 'The value for the property. If this is set to NULL then the behavior of the preference will depend on context. For example setting an "override.*" property to null will indicate that the override is not in use and the real value will be used.  The type of a preference will genarlly be String. However, should an alternative type be required the value here should be valid for that type and the JAVA_DATA_TYPE set accordingly'
;

COMMENT ON COLUMN DEMO_OPTIONS.JAVA_DATA_TYPE IS 'Data Type of the setting value'
;

COMMENT ON COLUMN DEMO_OPTIONS.DESCRIPTION IS 'Describes the use of the setting. All settings must be fully explained and define what the valid values are.'
;

