Im new to Database programming and I have a very basic question:
In my PHPMyAdmin GUI that Im using to create tables in my database, what does it mean when the column "type" (ie. datatype) has the data type and something in brackets after that. For example: int(20), bigint(30) .....
I understand the type int and bigint imply the number of bytes that are used and consequently the range of values that can be stored. But what does the value in the brackets mean?
What does the (20) and the (30) stand for.... what impact does this have on....
Sorry if the Q is basic, I am trying to understand databases....
Thanks a lot
Basically this is a Display Width.
I've found very good explanation of this concept here is so decided to not describe it myself and let you read it yourself from the original source.
In the same way that a max-length can be specified for string data types (e.g. VARCHAR(5) = Maximum 5 Characters), Numeric data type cells can have a "Display Length" specified ( E.g.: INT(5) ).
There is a common misconception that specifying a Display Length on an INT column will limit that column's range. As example, it is quite often thought that defining a column as INT(1) will reduce the column's unsigned range to 0 - 9, and that INT(2) would reduce the column's unsigned range to 0 - 99. This is not the case. An INT data column will ALWAYS have a viable unsigned range of 0 - 4294967295, or a signed range of -2147483648 to 2147483647, irrespective of the specified Display Width, whether it be 1 ( INT(1) ) or 20 ( INT(20) ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With