Primary Key V/S Foreign key

There are so many differences between primary key and foreign key and some of these are as follows: -

How to Create Primary Key

		
create table Course(Course_Id int primary key, Course_Name varchar(100));
or

create table Course(Course_Id int Constraint CPk primary key(Course_Id), Course_Name varchar(100));

or

create table Course(Course_Id int Constraint CPk primary key, Course_Name varchar(100));
or

create table Course(Course_Id int , Course_Name varchar(100) Constraint CPk primary key(Course_Id));


		

In this table you can see that in enq_type column we have entered null as we don’t have any value for this row.

How to Create Foreign Key

		
create table t3(id int primary key, phone varchar (100), email varchar (200));

create table t4(id int foreign key references t3(id), fees int); 


		
		

Email Address

For any query you can send mail at info@techaltum.com
Thanks