database datatype size

Posted by yeeen on Stack Overflow See other posts from Stack Overflow or by yeeen
Published on 2010-03-30T02:57:44Z Indexed on 2010/03/30 3:03 UTC
Read the original article Hit count: 490

Filed under:
|
|
|

Just to clarify by specifying sth like VARCHAR(45) means it can take up to max 45 characters? I rmb I heard from someone a few years ago that the number in the parathesis doesn't refer to the no of characters, then the person tried to explain to me sth quite complicated which i don't understand n forgot alr.

And what is the difference btn CHAR and VARCHAR? I did search ard a bit and see that CHAR gives u the max of the size of the column and it is better to use it if ur data has a fix size and use VARCHAR if ur data size varies.

But if it gives u the max of the size of the column of all the data of this col, isn't it better to use it when ur data size varies? Esp if u don't know how big is ur data size gg to be. VARCHAR needs to specify the size (CHAR don't really need right?), isn't it more troublesome?

© Stack Overflow or respective owner

Related posts about database

Related posts about datatypes