MySQL: enum or char(1)? Oct12 '04

Feedback

# (1 of 7): Dale » dalegroup.net

2 hours, 15 minutes after the fact. (Tue 12 Oct 2004, 9:43 PM CST)

You should read this (if you haven't already), mainly the comments.

http://dev.mysql.com/doc/mysql/en/ENUM.html

enum column type allows for a more strict set of input values, which could be good or bad.

Overall I don't think your choice should affect anything too much.

# (2 of 7): Matthom

2 hours, 59 minutes after the fact. (Tue 12 Oct 2004, 10:27 PM CST)

Thanks for the link and feedback. You're right, though. It's barely worth consideration. It's not going to affect anything drastically.

Therefore, I am going with char(1).

Previous comment Return to entry

# (3 of 7): Joshua Street » joahua.com

10 hours, 43 minutes after the fact. (Wed 13 Oct 2004, 6:12 AM CST)

Because I'm lazy, and can't be bothered looking it up, is enum case sensitive, or could you have got away with using the column type you specified in the post for both upper- and lower-case characters?

Previous comment Return to entry

# (4 of 7): Matthom

11 hours, 26 minutes after the fact. (Wed 13 Oct 2004, 6:54 AM CST)

Josh, enum is NOT case sensitive. But you bring up a good point. I will have to look into that.

Previous comment Return to entry

# (5 of 7): Kaolin Fire » erif.org/code/fallingup

9 months, 1 week after the fact. (Sun 17 Jul 2005, 4:29 PM CST)

Actually, enum can be case sensitive.

When retrieved, values stored into an ENUM column are displayed using the lettercase that was used in the column definition. Before MySQL 4.1.1, lettercase is irrelevant when you assign values to an ENUM column. As of 4.1.1, ENUM columns can be assigned a character set and collation. For binary or case-sensitive collations, lettercase does matter when you assign values to to the column.

Previous comment Return to entry

# (6 of 7): Kaolin Fire » erif.org/code/detritus

9 months, 1 week after the fact. (Sun 17 Jul 2005, 4:30 PM CST)

Nice blockquote style!

Previous comment Return to entry

# (7 of 7): Brice

3 years, 3 months after the fact. (Thu 17 Jan 2008, 11:12 AM CST)

Haha this is pretty late feedback.

CHAR can be any character. Which include numbers, etc...

Previous comment Return to entry

RSS feed for comments on this post

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

Return to entry.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

In a recent table creation, in MySQL, I ran into a situation that could go one of two ways.

You are at the feedback permalink page for: MySQL: enum or char(1)?

Read more...