RE: [PHP-DB] VARCHAR/CHAR question...

From: Date: Fri, 08 Dec 2000 22:49:45 +0000
Subject: RE: [PHP-DB] VARCHAR/CHAR question...
Groups: php.db 
Request: Send a blank email to php-db+get-5114@lists.php.net to get a copy of this message
Although foreign keys don't mean anything in mySQL, it's still good practice to make your PK/FK types match. For example: CREATE TABLE ADDRESS ( ADDR_LN1 VARCHAR(30), ADDR_LN2 VARCHAR(30), CITY VARCHAR(30), STATE_CD CHAR(2) /* no table wide advantage*/ ) ; CRATE TABLE STATE ( CD CHAR(2) /* table wide advantage */ ) ; What I don't know is if there's an advantage to the speed of the JOIN on the STATE side. Who knows, who cares? Anthony -----Original Message----- From: Adv. Systems Design [mailto:asd_2000@yahoo.com] Sent: Friday, December 08, 2000 1:01 PM To: Michael Zornek; php-db@lists.php.net Subject: Re: [PHP-DB] VARCHAR/CHAR question... Michael: this is correct...only with mysql...and the reason for this is that any speed and storage advantages you may have gained by specifying a field to be CHAR is lost if in the same row you have another field of type VARCHAR, so they both may as well be VARCHAR... ...it really makes little difference...in terms of storage, if you really plan to have so many records that this would be of consequence, you are probably better off going with a databa$e like oracle... That is the way I understand it anyways... Luis --- Michael Zornek <mzornek@seyboldreports.com> wrote: > I'm new to PHP, and I found a questionable line in a > book I'm reading > (BEGINING PHP 4), in the MySQL chapter page 390 it > says: > > " A final note on VARCHAR/CHAR type fields; if your > table has at > least one VARCHAR field all character fields are > converted to VARCHAR > type even if you define them otherwise." > > That doesn't seen fair or correct. > > Anybody have any comments or suggestions. I'll > gladly follow this in > designing my new DB but am suprised to read it. > > mike > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-db-unsubscribe@lists.php.net > For additional commands, e-mail: > php-db-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#5114) next »