I am using sql server 2012. I want to just a use of Alternate Key in sql server that how can we use in our query and what is the actual logic of this. Can you give me suitable example of Alternate Key
Assuming there is a table called Student with next structure
Create Table Student
(
StudentID int ,
FirstName varchar(50),
LastName varchar(50),
CourseID int
)
Candidate keys are SID or FNAME+LAME
Primary Key: SID
Alternate Key: FNAME+LAME
now with some explanation
Candidate Keys are those keys which is candidate for primary key of a table. simply all columns which full fill all the requirements of primary key.
Alternate Key After choosing primary key from those candidate keys, rest of candidate keys are known Alternate Key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With