Results 1 to 5 of 5

Thread: small problem

  1. #1
    Join Date
    Aug 2003
    Posts
    23

    Unanswered: 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 =)

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: small problem

    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)

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002

    Re: small problem

    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 
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: small problem

    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

  5. #5
    Join Date
    Aug 2003
    Posts
    23

    ok

    thx to all! :-)
    Alx_81 =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •