467,149 Members | 1,331 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,149 developers. It's quick & easy.

enum data type


can we have a enum datatype for a column in a table?
i need to store the position of an employee in the 'employee' table. there'll be just 5 positions available such as 'cashier, storage, admin, owner, etc..'.

for some reason i couldn't create another table to hold the position information and have a foreign key in the 'employee' table to that position table.

i thought i could use an enum data type. i want to hear from you guys, what datatype will suit this requirement. any comment and recommendation will be appreciated.

Thank you.
Oct 22 '08 #1
  • viewed: 2988
2 Replies
Expert 2GB
What error are you getting?


1. Create your POSITION table. Use tinyint as your PositionID (PK).
2. Insert records to your POSITION table.
3. Modify your EMPLOYEE table.Add a new column PositionID. Do not make it an FK yet.
4. Update your EMPLOYEE table for the proper PositionID based on POSITION table.
5. Make the Employee.PositionID as FK to Position.PositionID

Happy coding!

-- CK
Oct 22 '08 #2

thanks for the reply.
actually the reason that i couldn't create the Position table is not because errors while creating the Position table, it's the customer demand. i think i'll try to discuss this with the customer.

Thank you.
Oct 22 '08 #3

Post your reply

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

Similar topics

20 posts views Thread by Glenn Venzke | last post: by
21 posts views Thread by Andreas Huber | last post: by
5 posts views Thread by Barry | last post: by
34 posts views Thread by Steven Nagy | last post: by
35 posts views Thread by dtschoepe@gmail.com | last post: by
3 posts views Thread by hufaunder@yahoo.com | last post: by
10 posts views Thread by Charlie | last post: by
12 posts views Thread by Charlie | last post: by
4 posts views Thread by jonpb | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.