SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2001
    Location
    USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    VARCHAR vs TEXT?

    I've just begun fooling around with using PHP/MySQL to make a more dynamic site, and I have a little question I'd like cleared up. What are the differences between VARCHAR and TEXT? I know VARCHAR is limited to 255 characters, but are there performance/other advantages to using it instead of TEXT?

    Thanks!

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.mysql.com/doc/B/L/BLOB.html

    In most respects, you can regard a TEXT column as a VARCHAR column that can be as big as you like. Similarly, you can regard a BLOB column as a VARCHAR BINARY column. The differences are:

    * You can have indexes on BLOB and TEXT columns with MySQL Version 3.23.2 and newer. Older versions of MySQL did not support this.
    * There is no trailing-space removal for BLOB and TEXT columns when values are stored, as there is for VARCHAR columns.
    * BLOB and TEXT columns cannot have DEFAULT values.
    Does that answer it?
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •