Add CONSTRAINT to all tables
ALTER TABLE CUSTOMERS
ADD CONSTRAINT CUSTOMERS_CUSTOMERID_PK PRIMARY KEY(CUSTOMERID);
—————————————————————
ALTER TABLE CUSTOMERSCONTACT
ADD CONSTRAINT CCONTACT_CONTACTID_PK PRIMARY KEY(CONTACTID);
—————————————————————
ALTER TABLE EMPLOYEESCONTACT
ADD CONSTRAINT ECONTACT_CONTACTID_PK PRIMARY KEY(CONTACTID);
—————————————————————
ALTER TABLE CUSTOMERSFINANCIAL
ADD CONSTRAINT CFINANCIAL_FINANCIALID_PK PRIMARY KEY(FINANCIALID;
—————————————————————
ALTER TABLE EMPLOYEESFINANCIAL
ADD CONSTRAINT EFINANCIAL_FINANCIALID_PK PRIMARY KEY(FINANCIALID);
—————————————————————
ALTER TABLE TRANSACTIONS
ADD CONSTRAINT TRANSACTIONS_TRANSACTIONID_PK PRIMARY KEY(TRANSACTIONID);
—————————————————————
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMPLOYEES_EMPLOYEEID_PK PRIMARY KEY(EMPLOYEEID);
—————————————————————
ALTER TABLE CUSTOMERSCONTACT
ADD CONSTRAINT CCONTACT_CUSTOMERID_FK FOREIGN KEY (CUSTOMERID)
REFERENCES CUSTOMERS(CUSTOMERID);
—————————————————————
ALTER TABLE EMPLOYEESCONTACT
ADD CONSTRAINT ECONTACT_EMPLOYEESID_FK FOREIGN KEY (EMPLOYEEID)
REFERENCES EMPLOYEES(EMPLOYEEID);
—————————————————————
ALTER TABLE CUSTOMERSFINANCIAL
ADD CONSTRAINT CFINANCIAL_CUSTOMERID_FK FOREIGN KEY (CUSTOMERID)
REFERENCES CUSTOMERS(CUSTOMERID);
—————————————————————
ALTER TABLE EMPLOYEESFINANCIAL
ADD CONSTRAINT EFINANCIAL_EMPLOYEESID_FK FOREIGN KEY (EMPLOYEEID)
REFERENCES EMPLOYEES(EMPLOYEEID);
—————————————————————
ALTER TABLE TRANSACTIONS
ADD CONSTRAINT TRANSACTIONS_CUSTOMERID_FK FOREIGN KEY (CUSTOMERID)
REFERENCES CUSTOMERS(CUSTOMERID);
—————————————————————
ALTER TABLE TRANSACTIONS
ADD CONSTRAINT TRANSACTIONS_EMPLOYEEID_FK FOREIGN KEY (EMPLOYEEID)
REFERENCES EMPLOYEES(EMPLOYEEID);
—————————————————————
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMPLOYEES_MNG_FK FOREIGN KEY (MNG)
REFERENCES EMPLOYEES(EMPLOYEEID);
—————————————————————
ALTER TABLE CUSTOMERS
ADD CONSTRAINT CUSTOMER_GENDER_CK
CHECK ( GENDER IN (‘M’, ‘F’, ‘O’));
————————————————————–
ALTER TABLE CUSTOMERS
ADD CONSTRAINT CUSTOMER_RESIDENCY_CK
CHECK ( RESIDENCYSTATUS IN (‘V’, ‘R’));
—————————————————————
ALTER TABLE CUSTOMERS
ADD CONSTRAINT CUSTOMER_VERIFICATION_CK
CHECK ( VERIFICATIONSTATUS IN (‘A’, ‘N’, ‘D’));
—————————————————————
ALTER TABLE TRANSACTIONS
ADD CONSTRAINT TRANSACTIONS_PAYMENT_CK
CHECK ( PAYMENTMETHOD IN (‘C’, ‘D’, ‘Q’, ‘R’, ‘T’, ‘O’));
—————————————————————
ALTER TABLE TRANSACTIONS
ADD CONSTRAINT TRANSACTIONS_DELIVERY_CK
CHECK ( DELIVERYMETHOD IN (‘C’, ‘D’, ‘Q’, ‘O’));
—————————————————————
ALTER TABLE CUSTOMERSFINANCIAL
ADD CONSTRAINT CFINANCIAL_ACCOUNTTYPE_CK
CHECK ( ACCOUNTTYPE IN (‘S’, ‘C’, ‘R’));
—————————————————————
ALTER TABLE CUSTOMERSFINANCIAL
ADD CONSTRAINT EFINANCIAL_ACCOUNTTYPE_CK
CHECK ( ACCOUNTTYPE IN (‘S’, ‘C’, ‘R’));
—————————————————————
ALTER TABLE CUSTOMERSCONTACT
ADD CONSTRAINT CCONTACT_CUSTOMERID_UQ UNIQUE(CUSTOMERID);
—————————————————————
ALTER TABLE EMPLOYEESCONTACT
ADD CONSTRAINT ECONTACT_EMPLOYEEID_UQ UNIQUE(EMPLOYEEID);