If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > small problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-11-04, 12:01
alx_81 alx_81 is offline
Registered User
 
Join Date: Aug 2003
Posts: 23
small problem

i'm a new user of mysql..
what does it means the brackets after int datatype??

ex:
create table table1
...
field1 int (8) <--????
int occupes 4 bytes so 8?? what's??

sorry for this "stupid question"... but i must know what's 8!!
=)))

thx!
__________________
Alx_81 =)
Reply With Quote
  #2 (permalink)  
Old 02-14-04, 09:44
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: small problem

Quote:
Originally posted by alx_81
i'm a new user of mysql..
what does it means the brackets after int datatype??

ex:
create table table1
...
field1 int (8) <--????
int occupes 4 bytes so 8?? what's??

sorry for this "stupid question"... but i must know what's 8!!
=)))

thx!
That means maximum number you can insert is 99999999 (eight number places)
Reply With Quote
  #3 (permalink)  
Old 02-14-04, 10:01
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Re: small problem

Quote:
Originally posted by ika
That means maximum number you can insert is 99999999 (eight number places)
no, you can still insert any integer value (up to 2 billion or whatever it is)

the 8 refers to the minimum number of digits to display when using ZEROFILL

observe:
PHP Code:
create table testzerofill 
foo1 integer 
foo2 integer(8)
foo3 integer(8zerofill
foo4 integer(11zerofill
);
insert into testzerofill 
values 
 
1111)
,( 
999999999999999999999999999999999999 )
,( 
11111111111111111111111111111111111111111111)
;
select from testzerofill;

   
foo1       foo2       foo3       foo4  
         1          1   00000001 00000000001 
 999999999  999999999  999999999 00999999999 
2147483647 2147483647 4294967295 04294967295 
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 02-14-04, 10:03
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: small problem

Quote:
Originally posted by ika
That means maximum number you can insert is 99999999 (eight number places)
http://www.mysql.com/doc/en/Numeric_types.html
Reply With Quote
  #5 (permalink)  
Old 05-10-04, 06:01
alx_81 alx_81 is offline
Registered User
 
Join Date: Aug 2003
Posts: 23
ok

thx to all! :-)
__________________
Alx_81 =)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On