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

## All 9 Replies

no i ws actually on that page when i made this post i dont understand any of it.

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: -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.

i dont understand the binary and signed and unsigned whats that mean?

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: -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.

ok what is binary mean?

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 4321 could be explained like so:

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:

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

(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": b'1000011100001' .
Like, to insert into a bit field:

INSERT INTO `MyBitTable`
SET `MyBitField` = b'1000011100001';

ok i dont understand the use for those bianary numbers. the tables that i use are all just for counting up ect...

Then you probably have no use for them.

If your tables are only storing regular numbers, you will probably just wan to use the INT types. (Or DECIMAL, if they have fractions)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.