To add a new foreign key to an existing table using OMB+, the syntax is
For Eg: Sales_Fact has a column Order_Date_Key and a new FK needs to be created. This Order_Date_Key is populated with the PK of Time_Dim. To implement this, the OMB+ syntaxt is -
OMBALTER TABLE 'SALES_FACT' ADD FOREIGN_KEY 'FK_SALFACT_TIME_DIM' \
SET REF COLUMMNS ('ORDER_DATE_KEY') \
SET REFERENCE PRIMARY_KEY 'DIMENSION_KEY' OF TABLE 'TIME_DIM'.
No comments:
Post a Comment