RSS

Tag Archives: ForeignKey

ForeignKey, Definition, SQL Server, Databases

SQL Server Database Keys: PrimaryKey, NaturalKey, ForeignKey, UniqueKey, CandidateKey, AlternateKey, CompositeKey, SuperKey, SurrogateKey

Hi Guys,
How are you doing?

Many a times during interviews I notice that candidates know lots of things but they really hesitate while talking about “SQL Server Database Keys“. And even if they know about keys, they fail to provide proper answers with examples. So, today I would like to summarize few definitions which every database developer should be aware of.

I am not going to explain each in details but this will sure give you enough confidence to generate your own examples during interviews :)

I am going to use the following table for example reference in below definitions. Forget about the proper table design because we need only these columns for demo.

Table name : Employee (Parent Table)
Columns :

  • Id (Identity column of table )
  • Emp_Id (Employee’s Id Number given by a company/organization)
  • Emp_SSN (Employee’s Social Security Number)

Table Name : EmployeeDetails (Child Table)
Columns :

  • id_EmployeeDetails (PrimaryKey of table)

Read the rest of this entry »

 
3 Comments

Posted by on March 26, 2012 in General, SQL Server

 

Tags: , , , , , , , , , ,