How do you specify a foreign key in Oracle?

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter7: User Creation And Management
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

How do you specify a foreign key in Oracle?

 

Expert Solution
Step 1

Foreign Key:

  • A foreign key is a method to apply referential integrity within user Oracle database.
    • It is a key used to connect two tables together.
  • It is a field in one table that refers to the primary key in alternative table.
    • It means a column in one table whose values equal the primary key in another table.

Specifying foreign key in Oracle:

  • In Oracle, a foreign key can be specified in "ALTER TABLE" command.
  • When a table have a foreign key, user can identify the foreign key by using "ADD FOREIGN KEY" clause of the "ALTER TABLE" command.
    • In this clause, user specify the column that is a foreign key and the table it matches.
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr