Wednesday, October 12, 2016

Foreign key

Foreign key use for link one table to another table . It’s work like this one table column primary key and another table column foreign key by reference. Foreign key also refer unique constrain.Primary key and foreign key data type need to be similar. Without delete foreign key value you can’t delete primary key value.You can use more then one foreign key in a table.Foreign key have null values.

Query:

CREATE TABLE Worker
(
Worker_Id int NOT NULL PRIMARY KEY,
WorkerNo  int NOT NULL,
Worker_Id int FOREIGN KEY REFERENCES Team(Worker_Id)

)

No comments:

Post a Comment