CREATE TABLE "ORDERS" ( "ORDER_ID" NUMBER(12,0) GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 2460 NOCACHE NOORDER NOCYCLE NOKEEP NOSCALE NOT NULL ENABLE, "ORDER_DATE" TIMESTAMP (6) WITH TIME ZONE CONSTRAINT "ORDER_DATE_NN" NOT NULL ENABLE, "ORDER_MODE" VARCHAR2(8), "CUSTOMER_ID" NUMBER(6,0) CONSTRAINT "OEHR_ORDER_CUSTOMER_ID_NN" NOT NULL ENABLE, "ORDER_STATUS" NUMBER(2,0), "ORDER_TOTAL" NUMBER(8,2), "SALES_REP_ID" NUMBER(6,0), "PROMOTION_ID" NUMBER(6,0), CONSTRAINT "OEHR_ORDER_MODE_LOV" CHECK (order_mode in ('direct','online')) ENABLE, CONSTRAINT "OEHR_ORDER_TOTAL_MIN" CHECK (order_total >= 0) ENABLE, CONSTRAINT "OEHR_ORDER_PK" PRIMARY KEY ("ORDER_ID") USING INDEX ENABLE ) ; ALTER TABLE "ORDERS" ADD CONSTRAINT "OEHR_ORDERS_CUSTOMER_ID_FK" FOREIGN KEY ("CUSTOMER_ID") REFERENCES "CUSTOMERS" ("CUSTOMER_ID") ON DELETE SET NULL ENABLE; ALTER TABLE "ORDERS" ADD CONSTRAINT "OEHR_ORDERS_SALES_REP_FK" FOREIGN KEY ("SALES_REP_ID") REFERENCES "EMPLOYEES" ("EMPLOYEE_ID") ON DELETE SET NULL ENABLE; CREATE INDEX "OEHR_ORD_CUSTOMER_IX" ON "ORDERS" ("CUSTOMER_ID") ; CREATE INDEX "OEHR_ORD_SALES_REP_IX" ON "ORDERS" ("SALES_REP_ID") ; COMMENT ON COLUMN "ORDERS"."ORDER_ID" IS 'PRIMARY KEY column.'; COMMENT ON COLUMN "ORDERS"."ORDER_DATE" IS 'TIMESTAMP WITH TIME ZONE column, NOT NULL constraint.'; COMMENT ON COLUMN "ORDERS"."ORDER_MODE" IS 'CHECK constraint.'; COMMENT ON COLUMN "ORDERS"."ORDER_STATUS" IS '0: Not fully entered, 1: Entered, 2: Canceled - bad credit, - 3: Canceled - by customer, 4: Shipped - whole order, - 5: Shipped - replacement items, 6: Shipped - backlog on items, - 7: Shipped - special delivery, 8: Shipped - billed, 9: Shipped - payment plan,- 10: Shipped - paid'; COMMENT ON COLUMN "ORDERS"."ORDER_TOTAL" IS 'CHECK constraint.'; COMMENT ON COLUMN "ORDERS"."SALES_REP_ID" IS 'References oehr_employees.employee_id.'; COMMENT ON COLUMN "ORDERS"."PROMOTION_ID" IS 'Sales promotion ID. Used in SH schema'; COMMENT ON TABLE "ORDERS" IS 'Contains orders entered by a salesperson as well as over the Web.';