St

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View St as PDF for free.

More details

  • Words: 246
  • Pages: 2
CREATE TABLE ( cust_key CUST_ID FIRST_NAME LAST_NAME PH_NO ADDRESS CITY STATE CURRENT_FLAG );

CUST_FLAG_DIM Number(4), NUMBER(4) VARCHAR2(25) VARCHAR2(25) CHAR(12), VARCHAR2(23), VARCHAR2(12) CHAR(2), char(1)

ALTER TABLE CUST_FLAG_DIM ADD

NOT NULL, NOT NULL, NOT NULL, NOT NULL,

PRIMARY KEY (CUST_Key);

CREATE TABLE CUST_DIM ( cust_key Number(4), CUST_ID NUMBER(4) NOT NULL, FIRST_NAME VARCHAR2(25) NOT NULL, LAST_NAME VARCHAR2(25) NOT NULL, PH_NO CHAR(12), ADDRESS VARCHAR2(23), CITY VARCHAR2(12) NOT NULL, STATE CHAR(2) ); ALTER TABLE CUST_DIM ADD PRIMARY KEY (CUST_Key); CREATE TABLE ( CUST_ID FIRST_NAME LAST_NAME PH_NO ADDRESS CITY STATE );

CUSTOMER_MASTER NUMBER(4) VARCHAR2(25) VARCHAR2(25) CHAR(12), VARCHAR2(23), VARCHAR2(12) CHAR(2)

ALTER TABLE CUSTOMER_MASTER ADD

CREATE TABLE PRODUCT_MASTER ( PRODUCT_CD CHAR(4) PRODUCT_NAME VARCHAR2(25) PRICE NUMBER(7,2) );

NOT NULL, NOT NULL, NOT NULL, NOT NULL,

PRIMARY KEY (CUST_ID);

NOT NULL, NOT NULL, NOT NULL

ALTER TABLE PRODUCT_MASTER ADD PRIMARY KEY (PRODUCT_CD); CREATE TABLE ORDER_TX ( ORD_ID NUMBER(4) CUST_ID NUMBER(4)

NOT NULL, NOT NULL,

);

PROD_CD ORD_QTY ORD_AMT ORD_DT

CHAR(4) NUMBER(5) NUMBER(7,2) DATE

NOT NULL, NOT NULL, NOT NULL,

ALTER TABLE ORDER_TX ADD PRIMARY KEY (ORD_ID); ALTER TABLE ORDER_TX ADD ( FOREIGN KEY (CUST_ID) REFERENCES CUSTOMER_MASTER (CUST_ID)); ALTER TABLE ORDER_TX ADD ( FOREIGN KEY (PROD_CD) REFERENCES PRODUCT_MASTER (PRODUCT_CD)); CREATE TABLE PAYMENT_TX ( PAY_ID NUMBER(4) CUST_ID NUMBER(4) ORD_ID NUMBER(4) PAY_AMT NUMBER(7,2) PAY_DT DATE ); ALTER TABLE PAYMENT_TX ADD

NOT NOT NOT NOT NOT

PRIMARY KEY (PAY_ID);

ALTER TABLE PAYMENT_TX ADD ( CONSTRAINT FK_PT_CM_CID FOREIGN KEY (CUST_ID) REFERENCES CUSTOMER_MASTER (CUST_ID)); ALTER TABLE PAYMENT_TX ADD ( CONSTRAINT FK_PT_OT_OID FOREIGN KEY (ORD_ID) REFERENCES ORDER_TX (ORD_ID));

NULL, NULL, NULL, NULL, NULL

Related Documents

St
May 2020 16
St
June 2020 17
St
June 2020 21
St
November 2019 21
St
December 2019 19
St
June 2020 10