Best Data Types
I'm new to databases and MySQL, and would very much like to know, what the most efficient/suitable Data Types would be used with the following data:?
- Email Address
- Email Updates?
- Interested Sites (6 Check Boxes Max)
- Title (Mr, Mrs, Miss, Ms, Dr)
- First Name
- Last Name
- Image Title
- Upload Image
- Property Name/Number
- Street Name
agree w/ Nogdog's cross post with just this point:
use varchar almost exclusively, if it's free text. if it's an enumerated value (where you guarantee the length or something) you should be using enum. CHAR field always ends up w/ wasted memory.
Hey, Chazzy, I was under the impression that CHAR was more efficient than VARCHAR if the field in question always or nearly always contained the max number of allowed characters (or very close to the max with larger fields). Thus, for something like a password field, CHAR might be more appropriate if you are storing the MD5 hash, for example, which will always be the same length. Is this correct, or is it a misunderstanding on my part?
If you can guarantee that the value will always be 32 characters (for example) then you would use CHAR types. However, for any field that can have any # of characters up to N (say 255, for example) then you would use VARCHAR, so yeah your understanding's correct. most people will simply always use varchar, as it'll be easier to convert if need be.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)