1

when creating tables(and columns inside it) using MySQL gui clients there is a field called 'length' of a column. What exactly does it mean. Isn't range for a datatype (say)int fixed. Does length relate to the range of column value in anyway? Thanks.

krishna
  • 3,547
  • 5
  • 27
  • 29

2 Answers2

1

yes, indeed. E.g. a varchar(255) field can hold up to 255 characters.

see http://dev.mysql.com/doc/refman/5.0/en/data-types.html for all datatypes

konsolenfreddy
  • 9,551
  • 1
  • 25
  • 36
1

Isn't range for a datatype (say)int fixed.

No - but MySQL has some predefined sizes for integers.

Does length relate to the range of column value in anyway

Yes, it sets a limit on the size of what you put in there - but don't assume its directly equivalent to the number of characters you key in (see previous link, also, this one on multibyte characters)

Community
  • 1
  • 1
symcbean
  • 47,736
  • 6
  • 59
  • 94