473,396 Members | 1,875 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,396 software developers and data experts.

Problem of storing employee id in mysql?

Hii everyone
I m new to this forum.
I have a table emp having employee details I want to make e_id as primary key auto-incremented . but I don't want to store ids as 1,2,3.... I want to store them as e1,e2,e3... I know it is possible by composite primary key(e + 1) but don't know how ?and Will composite key work with Mysql?
Person who knows the answer plz solve my problem.
thanks in advance
Apr 14 '10 #1
3 1474
RedSon
5,000 Expert 4TB
What does the "e" stand for? If e is for employee then can't you just assume that e is always at the front of any ID number and just add it in when selecting data from the database? Will it ever be anything other than 'e'?
Apr 14 '10 #2
@RedSon
Thanx RedSon for your reply I was also thinking for same but I thought if someone knew about storing it with e.
Once again thanks a lot for your response
Apr 15 '10 #3
Atli
5,058 Expert 4TB
Hey.

If you want the key auto_incremented, it needs to be a number. You can not store it with the letter without losing the auto incrementation.

You can of course create a composite primary key, but it won't really affect the way the data is displayed. Even if you had two columns, one with the auto incremented number and one with the letter, and you created a composite key out of those two columns, you would still need to concatenate them if you wanted to display them together.

If the "e" is always going to be present, like RedSon pointed out, then you could just as well assume it is always going to be there and add it on the way out.

Perhaps if you explained why you need the "e" to be there, we could offer some alternatives.
Apr 17 '10 #4

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

Similar topics

8
by: Steven | last post by:
Hi there, I am wanting to store price data as n.nn format, so if the user enters "1" the data that gets stored is "1.00" Is there a way to do this. Cheers Steven
0
by: DonO | last post by:
I am suppose to build an application for our HR department for benefit information. One component of benefit info is calculated off of an employee's salary. They would like it built so they have...
0
by: Morten Gulbrandsen | last post by:
USE company; DROP TABLE IF EXISTS EMPLOYEE; CREATE TABLE EMPLOYEE ( # PK SSN CHAR(9) NOT NULL, # FK SUPERSSN CHAR(9), DNO INT NOT NULL DEFAULT 1, CONSTRAINT EMPPK
0
by: Eben Goodman | last post by:
I am storing book isbn numbers in a table. isbn numbers are 10 digit numbers and many start with 0. The data type of the field I am storing this info in is a bigint(16) unsigned. It appears that...
0
by: yurps | last post by:
Hello I have an Employee object which is serializable and has a generictypeconverter to enable the object to be stored in the asp.net session.... In my code I am calling procedures by casting...
2
by: hendry.johan | last post by:
Hi, I'm currently developing an HR system which involves storing a lot of configurations per module, such as payroll module, absence/shift module, training module, etc. total: around 100...
3
by: fathi | last post by:
hello guys, i've worked with C, Java, VB and now C++ but i never knew how to deal with strings so a little bit of help will be so appreciated. it is infact a login code. here is the problem: ...
3
by: Yamasassy | last post by:
Hi im trying to create a VB program that allows storing and reading to a TXT file i keep getting error 424 object required, im not all to good with VB but i have to get this working for an...
8
by: yomama | last post by:
Hello, I am writing a program in which I take a string (specifically, first and last name with a space in between) from the user and put it into a data member of a class node. I have tried various...
0
by: Edwin.Madari | last post by:
-----Original Message----- statement prepared first and executed many times with exectemany - db API http://www.python.org/dev/peps/pep-0249/ inline statemets can be exeucuted only. hope that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.