skip to main content
Supported SQL Statements and Extensions : Create Table : Creating a Remote Table : Constraint Definition for Remote Tables
  

Try DataDirect Drivers Now
Constraint Definition for Remote Tables

Purpose

Defines a constraint for a remote table.

Syntax

[CONSTRAINT [constraint_name] {foreign_key_constraint}]
where:
constraint_name
is ignored. The driver uses the Salesforce relationship naming convention to generate the constraint name.
foreign_key_constraint
defines a link between related tables. See "Foreign Key Clause" for the syntax.
A column defined as a foreign key in one table references a primary key in the related table. Only values that are valid in the primary key are valid in the foreign key. The following example is valid because the foreign key values of the dept id column in the EMP table match those of the id column in the referenced table DEPT:
Referenced Table
Main Table
DEPT
EMP
(Foreign Key)
id
name
id
name
dept id
1
Dev
1
Mark
1
2
Finance
1
Jim
3
3
Sales
1
Mike
2
The following example, however, is not valid. The value 4 in the dept id column does not match any value in the referenced id column of the DEPT table.
Referenced Table
Main Table
DEPT
EMP
(Foreign Key)
id
name
id
name
dept id
1
Dev
1
Mark
1
2
Finance
1
Jim
3
3
Sales
1
Mike
4