473,411 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Employee Name as primary key

45
Hi All,


I am uploading excel file to database.In the excel file EmpFirstName,EmpLastName,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
Sep 9 '10 #1
2 1317
mzmishra
390 Expert 256MB
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
Sep 9 '10 #2
Stewart Ross
2,545 Expert Mod 2GB
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
Sep 9 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matt | last post by:
The ASP page has a combo box with id list, and when user click the particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call...
3
by: Matthew Louden | last post by:
if the user select the EmployeeID in drop down list, and then click the submit button, and it will look up database and show the Employee Name in the text box, this is easy. But my case is:...
5
by: LFM | last post by:
I have a table I'm importing from our SQL accounting database. The Employee Name is in one field. For the purpose of my needs, I need to extract the last name, first name and middle initial. ...
0
by: Alex | last post by:
Hi all. I have this table: CREATE TABLE sites_pages (   id int(6) NOT NULL,   site_id int(4) NOT NULL,   name varchar(80) NOT NULL,   UNIQUE KEY site_id_name (site_id, name),   PRIMARY KEY...
1
by: Karl | last post by:
Can you create name tags with pictures using A2000? I have a table with an Employee name field and a field with a link to their gif picture. I was able to get a form to work using the Image...
3
by: dhutton | last post by:
Hello, I'm trying to convert employee number to employee name. What would be the best way to do this? Here is my code: ======================================================== SELECT ...
2
by: KrazyKasper | last post by:
My table contains single field for EmployeeName populated as LASTNAME, FIRSTNAME In my report query qry_OptimizeIt1 I defined two new fields as Expr4: ParseFirstComp() and Expr2: ParseSecondComp()...
5
by: artemetis | last post by:
I have a macro that is exporting records for a particular employee to an xls. The default output filename is qryEmpItems.xls Is there a way to have the macro append the employee name to the actual...
7
by: habsy | last post by:
The below are the question given; Please help. (Payroll) Write a program that reads the following information and prints payroll statements in show message dialog box. These are the...
6
by: itishree priyadarsini | last post by:
sql query to display half employee name in upper case & other half in lower case
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.