[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PHPwestoz] [OT] MySQL UNIQUE INDEX




What's the difference between VARCHAR and TEXT?


As far as I know, VARCHAR is fixed length while TEXT is dynamic. There maybe more differences, but that's the main one off the top of my head.

Also, VARCHAR is limited to a maximum of 255 characters and its limit must be specified implicitely, while a TEXT field can hold up to 65535 characters and, as pointed out, is dynamically sized, so you don't have to specify a limit.


Also be aware that there are other TEXT-type fields available:

   * TINYTEXT: 255 chars
   * TEXT: 65,535 chars
   * MEDIUMTEXT: 16,777,215 chars
   * LONGTEXT: 4,294,967,295 chars

Cheers
Nicolas