Please send your Questions & Answers or Feedback to ""

What is Foreign Key constraint ?

A foreign key means that values in one table must also appear in another table.

The referenced table is called the parent table while the table with the foreign key is called the child table. The foreign key in the child table will generally reference a primary key in the parent table.

A foreign key can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.




CREATE TABLE table_name


column1 datatype null/not null,

column2 datatype null/not null,

CONSTRAINT fk_column

  FOREIGN KEY (column1, column2, ... column_n)

  REFERENCES parent_table (column1, column2, ... column_n)


Related Posts Plugin for WordPress, Blogger...
Flag Counter