Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary Key and Foreign Key in a table

Status
Not open for further replies.

kondakindi

IS-IT--Management
Apr 18, 2005
31
US
I have a table employee_Current_Details which refers to the table Employee_Details with reference to the Emp_Id.

I want this Emp_id to be unique in both the tables. How do i do that?

Can i declare the column as both primary and Foreign key?

or i need to check if it is existing before insert into the employee_Current_details table.

thanks in advance.



 
> Can i declare the column as both primary and Foreign key?

Yup. But both foreign keys should point to Employee table.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top