Home  /  Application Development: Core Topics  /  Class Definition Reference  /  Class Definitions  /  Foreign Key Definitions

Class Definition Reference
Foreign Key Definitions
[Back]  [Next] 
InterSystems: The power behind what matters   

Describes the structure of a foreign key definition.
A foreign key defines a referential integrity constraint. When a table containing a foreign key constraint is modified, the foreign key constraints are checked.
You can add foreign key definitions to persistent classes. They are not meaningful in other kinds of classes.
Note that you can also enforce reference integrity by defining relationship properties that connect the classes.
A foreign key definition has the following structure:
/// description 
ForeignKey name(key_props) References referenced_class(ref_index) [ keyword_list ]; 
ForeignKey EmpKey(EmpId) References MyApp.Employee(EmpID) [ OnDelete = cascade ];
See Also