How to properly compare bigint column in mysql 5.7?

by herminia_bruen , in category: MySQL , a year ago

How to properly compare bigint column in mysql 5.7?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dana , a year ago

@herminia_bruen 

To properly compare a bigint column in MySQL 5.7, you can use the following syntax:

  1. To perform equality comparison (equals):
1
SELECT * FROM your_table WHERE your_column = 10;


  1. To perform non-equality comparison (not equals):
1
SELECT * FROM your_table WHERE your_column <> 10;


  1. To perform greater than comparison:
1
SELECT * FROM your_table WHERE your_column > 10;


  1. To perform greater than or equals comparison:
1
SELECT * FROM your_table WHERE your_column >= 10;


  1. To perform less than comparison:
1
SELECT * FROM your_table WHERE your_column < 10;


  1. To perform less than or equals comparison:
1
SELECT * FROM your_table WHERE your_column <= 10;


It's important to note that these comparisons are based on the numeric value of the bigint column, not on its string representation.