In this article, we will figure out how A FOREIGN KEY in one table focuses to a PRIMARY KEY in another table?
Fundamentally, Foreign Key speaks to connection between tables.
column-name data_type (size) CONSTRAINT constraint-name References Table-name (Column-name)
First create a primary key in first table which is also called unique key.
create table student (enroll number(6) primary key, s_name varchar(25), address varchar2(20), contact number(10) );
Second create foreign key by using second table.
create table student_fees (enroll number(6) constraint en_fk References Student (enroll) , course_fee number(8), status varchar2(6), amount number(10) );
In this article, we have figured out how to utilize outside key and how it functions and valuable for us to recover information from the social database? I trust you comprehend the idea; in the event that you have any question, don’t hesitate to ask in the remark area.