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

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

The field I want to create will only contain a single letter. That letter is simply any letter of the alphabet. There are 26 letters total, and only one is chosen to be stored in that field.

In MySQL, which column type should be used?

An enum column type, with an option for each letter of the alphabet?

enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','x','y','z');

Or... a char column type, with a character limit of 1?

char(1);

What do you think?

Categories: SQL

Add Feedback (view all)

Leave feedback

Feedback

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

Status

Sub-status

Your info

You should read this (if you haven't already), mainly the comments. http://dev.mysql.com/doc/mysql/en/ENUM.html enum column type allo ... Read more.

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

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 ... Read more.

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

Actually, enum can be case sensitive. When retrieved, values stored into an ENUM column are displayed usi ... Read more.

Nice blockquote style! ... Read more.

Haha this is pretty late feedback. CHAR can be any character. Which include numbers, etc... ... Read more.

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

Similar Entries

Stats

444 unique visits since August 2008

Syndicate

Advertisements