Search code examples
oracle-databaseoracle-sqldeveloperforeign-key-relationship

Oracle SQL Developer - using foreign keys


First of, this is a pretty basic question but I cant seem to find a basic tutorial on how to use the software.

If i have a table named COUNTRY with the field region_id and then another table named REGION with a primary key as region_id.

I want to set the region_id field in COUNTRY table as a foreign key. Are the following steps correct?

  • Go to constraints, add a new foreign key.
  • Select COUNTRY as table
  • Change local column to region_id

![enter image description here][1] Am I doing it correctly? if not, where am i going wrong


Solution

  • Yes, This is the correct procedure.

    If you want your foreign key to have additional behavior (e.g., ON DELETE CASCADE), you can use the "on delete" drop-down in the wizard.