Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Why does CHAR columns come out as VARCHAR ones
Old 10-25-2006, 01:51 AM Why does CHAR columns come out as VARCHAR ones
Extreme Talker

Posts: 163
Name: James
Location: Australia
Trades: 0
I have just tried to set the below table in a MYSQL database, but when I do the show columns from, all of the columns of which I have set to with 'CHAR', are all shown as 'VARCHAR", and the table is listed as 'dynamic' rather than 'fixed'

What is going on?
Is there some variable of which is confusing the system in some way?

CREATE TABLE watchregcontact (
wtcctsp TIMESTAMP,
wtccip CHAR(20),
wtccjacn INT UNSIGNED,
wtccrow BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
wtccdte DATETIME,
wtccmt CHAR(10),
wtccmr CHAR(8),
wtcchead CHAR(50),
wtccmbod TEXT,
wtccpd DATETIME,
wtccpb TINYTEXT,
wtccfd DATETIME,
wtccfb TEXT,
wtccpi CHAR(20),
wtccpu CHAR(30),
wtccfi CHAR(20),
wtccfu CHAR(30)
);
TRANZIT JIM is offline
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
 
Register now for full access!
Old 10-29-2006, 07:17 AM Re: Why does CHAR columns come out as VARCHAR ones
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
if you have several CHAR columns with differing widths MySQL will optimise them all as VARCHAR types. This will save space in the database as CHAR columns are padded with spaces to fill the specified width but VARCHAR are not.
So a 10 character string in a 50 wide CHAR column will take up 50 bytes but as a VARCHAR will only take up 11 bytes
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Why does CHAR columns come out as VARCHAR ones
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09654 seconds with 12 queries