LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-08-2011, 04:22 AM   #1
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
MySQL: Can I add an ENUM value later?


Say I create a MySQL table with a ENUM column with the possible values BOOK, DVD, and CASSETTE. And then two years later I decide I want to add another possible value (say, ISOLINEAR CHIP :-). This won't be a problem, right? I got the impression from an on-line post that I could use ALTER TABLE to do this and it wouldn't be a problem. But I wanted to get a second opinion because obviously I don't want to come back two years later and run into some major issue.
 
Old 05-08-2011, 05:21 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I would strongly discourage you from using "enum's": use codes (1, 2, 3, etc) or strings ('BOOK', 'DVD', etc) instead. This, of course, is the exact OPPOSITE of what you'd want to do in a programming language (like C++ or Java), but it's actually sound advice for SQL. Especially if you ever want to use this data elsewhere, besides a MySQL database.

ANYWAY - to answer your question: Yes, you CAN add (or change) mySql enums post facto. Yes, you'd do it with "alter table" syntax. But you might encounter problems:

http://stackoverflow.com/questions/1...olumn-in-mysql
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ enum vendtagain Programming 4 01-24-2010 03:26 AM
mysql: can you get list of possible enum types from db? BrianK Programming 2 06-28-2007 05:58 PM
Questions about enum. What would be a good use of enum? RHLinuxGUY Programming 5 06-11-2006 02:13 PM
MySQL ODBC driver fails when trying to add a DSN to MySQL banjoman Linux - Software 0 01-24-2005 10:59 AM
Cant add MySQL through add/remove programs Hero Doug Fedora 6 01-03-2004 11:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration