For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > May 2005 > char or varchar?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author char or varchar?
Roderik

2005-04-21, 8:56 pm

What is the difference between CHAR en VARCHAR?
Chris Hope

2005-04-21, 8:56 pm

Roderik wrote:

> What is the difference between CHAR en VARCHAR?


http://dev.mysql.com/doc/mysql/en/char.html

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Andy Hassall

2005-04-21, 8:56 pm

On Thu, 21 Apr 2005 22:15:34 +0200, Roderik <mail@roderik.net> wrote:

>What is the difference between CHAR en VARCHAR?


VAR.

For more details see the manual of the database you're using.

Usually it's to do with blank padding.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
steve

2005-05-03, 3:58 am

"Roderik1" wrote:
> What is the difference between CHAR en VARCHAR?


Obviously varchar is more flexible, as your field can be any number of
chars up to the max length.

The flip side is that there is a performance penalty for having
varchars. The penalty comes into play even if you have a single
varchar (or text) field.

It is not a big deal unless your table is huge.

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-SQL-cha...pict216440.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=759021
Norman Peelman

2005-05-07, 8:56 am

"steve" <UseLinkToEmail@dbForumz.com> wrote in message
news:4_759021_2ac27d4dab8423897be7979e65
a4a582@dbforumz.com...
> "Roderik1" wrote:
>
> Obviously varchar is more flexible, as your field can be any number of
> chars up to the max length.
>
> The flip side is that there is a performance penalty for having
> varchars. The penalty comes into play even if you have a single
> varchar (or text) field.
>
> It is not a big deal unless your table is huge.
>
>


A second caveat is that in any table that contains both CHAR and BLOB
columns, the CHAR will be converted to VARCHAR automatically.

Norm
--
FREE Avatar hosting at www.easyavatar.com


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com