3

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

0

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

What would on delete cascade allow it to do?
@ili on delete cascade means that when you delete a region with countrys pointing to it, they will also be deleted. This is not necessarily the correct behavior for your usecsae, but if it is, this would allow the database to do it for you instead of you having to code it in your application.
0

I cant seem to find a basic tutorial on how to use the software.

Have you looked at the Oracle Learning Library for SQL Developer tutorials?

If you search for: Getting Started with Oracle SQL Developer 4.0 you will find a tutorial that gets you up and running SQL Developer, this tutorial includes how to create Foreign Key Constraints.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.