| | |
about the length of mysql BIGINT
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Length/Values1 what do i put there.
this is a collumn in one of my tables its bigint so the number can get increased by alot. its a point system. it asks for length/values whn i edit the name of the column but i dont understand what to put there. i know the number can be like up to 1,000,000 or more i read that online. but do i put max number or max characters. cause if the max number was to 1,000 then id put the number 4 cause 1,000 is four or five with the comma. or do i pu t like 1,000,000 in the length/values feild?
i dont understand the reason im asking is becuase i dont know if i do it wrong maybe it will get messed up and have too many i dont know if it will allow too many considering its limited to a number but i dont understand if the length/values is the character ammount or the actual number ? please helps
this is a collumn in one of my tables its bigint so the number can get increased by alot. its a point system. it asks for length/values whn i edit the name of the column but i dont understand what to put there. i know the number can be like up to 1,000,000 or more i read that online. but do i put max number or max characters. cause if the max number was to 1,000 then id put the number 4 cause 1,000 is four or five with the comma. or do i pu t like 1,000,000 in the length/values feild?
i dont understand the reason im asking is becuase i dont know if i do it wrong maybe it will get messed up and have too many i dont know if it will allow too many considering its limited to a number but i dont understand if the length/values is the character ammount or the actual number ? please helps
http://dev.mysql.com/doc/refman/5.1/...ric-types.html Use the language documentation before going to the forums please.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Each Integer type is stored using a certain amount of bytes.
(See a list here)
A typical INT uses 4 bytes, so it can store the numbers:
Signed:
Unsigned:
A BIGINT uses 8 bytes, so it can store the numbers:
Signed:
Unsigned:
See a table of values each type can store at 10.2. Numeric Typesin the manual.
Note, these are the actual numbers it can store, not the number of characters in the number, or something like that.
The display length you can specify when you create the column (like
It is only used to suggest to application how long the number might be. Like, if you expect the numbers will always be 7 characers long, you would do INT(7).
You could still use the full range of the INT type tho. The display length doesn't limit that.
(See a list here)
A typical INT uses 4 bytes, so it can store the numbers:
Signed:
-2147483648 to 2147483647 Unsigned:
0 to 4294967295 A BIGINT uses 8 bytes, so it can store the numbers:
Signed:
-9223372036854775808 to 9223372036854775808 Unsigned:
0 to 18446744073709551615 See a table of values each type can store at 10.2. Numeric Typesin the manual.
Note, these are the actual numbers it can store, not the number of characters in the number, or something like that.
The display length you can specify when you create the column (like
INT(5) ) has no effect on the range of numbers the field can store.It is only used to suggest to application how long the number might be. Like, if you expect the numbers will always be 7 characers long, you would do INT(7).
You could still use the full range of the INT type tho. The display length doesn't limit that.
Simply put... unsigned integers can be twice as high as signed integers, but unsigned integers can not have negative values.
Thus, a normal signed integer has the range:
While and unsigned normal integer has the range:
It has to do with how they are stored.
In a signed integer, the last bit indicates whether it is a negative number or not.
In an unsigned integer, the last bit is used to store more data, making the range twice as high but making all values positive.
Thus, a normal signed integer has the range:
-2147483648 to 2147483647 While and unsigned normal integer has the range:
0 to 4294967295 It has to do with how they are stored.
In a signed integer, the last bit indicates whether it is a negative number or not.
In an unsigned integer, the last bit is used to store more data, making the range twice as high but making all values positive.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
Binary... That has a lot of meanings. (See Wikipedia.)
In this context, however, you are probably talking about binary numbers.
The numeric system most (if not all) of us use is decimal, or base-ten.
It is based on 10 numbers, 0-9. In a number with multiple characters (more than one number), each seat's value is 10 times more valuable than the one before it.
The value of the base-ten number
Binary numbers, or base-two numbers, on the other hand, are based on the number 2. It only has two numbers: 0 and 1.
It is based on the exact same math as base-ten numbers, but only with two numbers.
So in a binary number with multiple characters, each seat (or "bit") is only twice as valuable as the one before it.
The binary equivelent for the base-ten number
We can explain that like so:
(Explaining why using the first bit to store whether the number is negative only allows half of it's highest value (Although, in both directions))
The BIT type in MySQL stores these binary numbers.
To specify a bit value, you prefix the string with a lower-case "b":
Like, to insert into a bit field:
In this context, however, you are probably talking about binary numbers.
The numeric system most (if not all) of us use is decimal, or base-ten.
It is based on 10 numbers, 0-9. In a number with multiple characters (more than one number), each seat's value is 10 times more valuable than the one before it.
The value of the base-ten number
4321 could be explained like so: MySQL Syntax (Toggle Plain Text)
4 * 1000 = 4000+ 3 * 100 = 300+ 2 * 10 = 20+ 1 * 1 = 1+ ----- = 4321
Binary numbers, or base-two numbers, on the other hand, are based on the number 2. It only has two numbers: 0 and 1.
It is based on the exact same math as base-ten numbers, but only with two numbers.
So in a binary number with multiple characters, each seat (or "bit") is only twice as valuable as the one before it.
The binary equivelent for the base-ten number
4321 is 1000011100001 .We can explain that like so:
MySQL Syntax (Toggle Plain Text)
1 * 4096 = 4096+ 0 * 2048 = 0+ 0 * 1024 = 0+ 0 * 512 = 0+ 0 * 256 = 0+ 1 * 128 = 128+ 1 * 64 = 64+ 1 * 32 = 32+ 0 * 16 = 0+ 0 * 8 = 0+ 0 * 4 = 0+ 0 * 2 = 0+ 1 * 1 = 1+ ------ = 4321
The BIT type in MySQL stores these binary numbers.
To specify a bit value, you prefix the string with a lower-case "b":
b'1000011100001' .Like, to insert into a bit field:
mysql Syntax (Toggle Plain Text)
INSERT INTO `MyBitTable` SET `MyBitField` = b'1000011100001';
Last edited by Atli; Jun 16th, 2009 at 7:06 pm. Reason: Spelling... not my strong suit :P
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Similar Threads
- MS Access vs. MySQL (MS Access and FileMaker Pro)
- Factorial of any length (C++)
- Varchar field as foreign reference (MySQL)
- php/mysql full text search help (PHP)
- Help With Messages in Mysql Stop Overwriting (MySQL)
- error handling in VB6 + + ODBC + MySQL...(Help!!!!) (Visual Basic 4 / 5 / 6)
- MySQL syntax error check for the right syntax to use near 'A (A) )' at line 1 (PHP)
- MySQL varchar limitation (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: MYSQL Duplicate Entry on Key 1 (of 2) Problem
- Next Thread: Can Crystal Reports be used with MySQL?
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense aws bizspark changingprices communityjournalism contentmanagement contractors copyright count crm data database design developer development distinct drupal dui ec2 eliminate email enter enterprise error facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip join journalism keyword kickfire laptop legal license licensing linux maintenance mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource operand oracle pdf penelope php priceupdating query referencedesign remove saas search select sharepoint simpledb sourcecode spotify sql statement sugarcrm techsupport thunderbird update virtualization






