SELECT (A-B) from table;
but you get ERROR 1690 (22003): BIGINT UNSIGNED value is out of range. What you do?
Do not panic.
From the MySQL data types docs:
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.
So you are obviously subtracting columns of type UNSIGNED and result is negative. To solve this you need to cast them to SIGNED , even if you do not heed to store the result - just displaying.
SELECT (CAST(A AS SIGNED)-CAST(B AS SIGNED)) from table;