Jump to content


Photo

Whats bigger


  • Please log in to reply
3 replies to this topic

#1 Scifa

Scifa
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 March 2006 - 12:13 PM

Can someone please tell me what is bigger

256 as int or GB as varchar

Thanks

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 03 March 2006 - 12:41 PM

Pretty weird question :)

256 is three bytes (unsigned), GB is two bytes.
Legend has it that reading the manual never killed anyone.
My site

#3 Scifa

Scifa
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 March 2006 - 02:00 PM

We have a database of users and inside there is a 2/3 varchar value to hold the the country code i.e. GB I want to move it over to another table and reference it by id but was told somehting about 256 begin bigger then GB ????

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,025 posts

Posted 04 March 2006 - 07:24 PM

A SMALLINT type takes 2 bytes.

GB as a VARCHAR would require 3 bytes. As CHAR it would require 2 bytes.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users