Why do integers in database row tuple have an 'L' suffix in MySQL?

MySQLMySQLi Database

The ‘L’ suffix concept in MySQL can be related with Python. In Python 2, the long integer literal is suffixed with L or l, but int and long have been binded into int in version 3. Therefore, there is no need for L or l.

Adding large numbers in Python Version 3.7 (Python 3), without using any suffix.

Python Version

Here, if we suffix L or l, Python 3 gives an error.

Python Error

However, Python Version 2 suffixed with L or l will not give an error.

Python Version2

The following is the output with no error.

Python Result

Hence, Python int is equal to long type in C language, while Python 3 is just like BigInteger equivalent in java. We cannot assume it has great precision.

So, we can add suffix l or L to get a really large number in MySQL database row tuple when we do not know in advance how many values the user will enter.

Note − Adding suffix L or l in database is used to get a large number.

Updated on 30-Jul-2019 22:30:23