Link to home
Start Free TrialLog in
Avatar of Westside2004
Westside2004Flag for United States of America

asked on

Referential Integrity and Constraint Question

Hi,

I have two tables, "Customer" and "Inactive"

Customer Table

cust_id (PK)       cust_name          status
1                 ABC Company    0
4                 XYG Company    2

Status Table

status(PK)       status_desc
0                   some desc
1                  diff desc
2                  2nd desc

I want to create a constraint between the PK of the Status table and the Status column in the Customer table.   What would be the SQL needed to do this?

I basically want to prevent a user from creating a record in the Customer Table with a value in the status column that doesn't exist in the Status table.

Hope that makes sense.

-ws
ASKER CERTIFIED SOLUTION
Avatar of HugoHiasl
HugoHiasl

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Westside2004

ASKER

Thanks