The BIGINT is a b byte or 64 bits integer worth and is extremely handy in storing huge integer values.
The MySQL BIGINT, like any other MySQL integer knowledge type, can be signed or unsigned. A signed knowledge style signifies that the column can retail store both of those favourable and damaging integer values. This is the default sort for most integer varieties in MySQL. Therefore, unless explicitly specified, any integer variety column can keep the two optimistic and damaging integers.
On the other hand, unsigned knowledge variety implies the column can only retail outlet favourable integer values.
The vary for the signed MySQL BIGINT form is in between -9223372036854775808 and 9223372036854775807
For unsigned BIGINT style, the price ranges from to 18446744073709551615.
The other attribute of the BIGINT kind is the ZEROFILL. With this attribute specified on a column, the column gets mechanically set to UNSIGNED.
The zerofill attribute also fills the areas with zeros.
Let us look at few examples to illustrate how to use the BIGINT form.
Future, permit us generate a desk and populate it with a variety of BIGINT columns, as shown in the query down below:
Enable us 1st consider to add all constructive values to the table:
In the instance question earlier mentioned, the values are appropriate for the reason that they are in the assortment of signed, unsigned, and zerofill BIGINT varieties.
| x | y | z |
| 1 | 2 | 00000000000000000003 |
1 row in <strong>setstrong> (.01 sec)
In the following situation, permit us try introducing all destructive values. An instance question is below:
In this scenario, the query fails as the y column is unsigned. Consequently, assigning a negative value to the column is out of the column selection.
Case in point 3
We can notice a similar circumstance as earlier mentioned for the 3rd column. The zerofill attribute mechanically would make the column unsigned, creating adding a destructive price is out of assortment. An example is as:
Let us now try adding the utmost values for each and every kind. An instance question is:
In the case in point over, given that all the values are in the range, the query executes correctly.
Look at the question beneath:
You will discover that all the values are on the optimum values. Considering that the x column is set to Automobile_INCREMENT, incorporating a value to it will fall short.
Mistake 1062 (23000): Copy entry ‘9223372036854775807’ for essential ‘examples.PRIMARY’
Having said that, if rigorous mode is disabled in MySQL, you can insert out-of-array values.
In this tutorial, we mentioned the MySQL BININT type and the ranges for its many attributes.