DatabaseLink`
DatabaseLink`
SQLTableImportedKeys
SQLTableImportedKeys[conn,table]
returns information about primary keys referenced by foreign keys in table.
Details and Options
- To use SQLTableImportedKeys, you first need to load DatabaseLink using Needs["DatabaseLink`"].
- The following options can be given:
-
"Catalog" None database catalog to use "Schema" None database schema to use "ShowColumnHeadings" False whether to return headings with the results
Examples
Basic Examples (1)
If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the DatabaseLink`DatabaseExamples` package, as described in Using the Example Databases.
Create a table with a primary key:
Create another table. The PersonId column will be used for a foreign key constraint referencing the PEOPLE table's primary key:
Add the foreign key constraint:
The foreign key appears as an index in the EMPLOYEES table:
The primary key of the PEOPLE table now appears as an imported key of EMPLOYEES: