Employee Name as primary key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NareshN
    New Member
    • Aug 2010
    • 45

    #1

    Employee Name as primary key

    Hi All,


    I am uploading excel file to database.In the excel file EmpFirstName,Em pLastName,Dates but i dont have EmpNo.can i use FirstName and LastName as primary key.
    If not what is the other choice for selecting primarykey.


    Excel File Data

    FirstName Lastname Date
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    The PRIMARY KEY constraint uniquely identifies each record in a database table.
    Primary keys must contain unique values and each table can have only ONE primary key.

    I donot think it is good idea to have First Name and Last name as primary key.
    You can have an Identity column

    Comment

    • Stewart Ross
      Recognized Expert Moderator Specialist
      • Feb 2008
      • 2545

      #3
      As mzmishra says, firstname and lastname together are not unique and cannot be used as a primary key. A candidate key in employee-related applications is to use an employee reference number of some kind.

      These are often assigned to employees by the Human Resources Department or by Payroll if the company has these, to uniquely identify particular members of staff and payments made to them.

      If you don't have unique reference numbers for your employees you will most likely not be able to proceed, as simple combinations such as name and date of birth cannot be guaranteed to be unique.

      -Stewart

      Comment

      Working...