SQL Comparison Operators Guide
To compare numbers in SQL, you can use comparison operators such as:
- Greater than (>): Used to compare if the number on the left is greater than the number on the right.
- Less than (<): used to compare if the number on the left is smaller than the number on the right.
- Greater than or equal to (>=): Used to compare if the number on the left is greater than or equal to the number on the right.
- Less than or equal to (<=) is used to compare whether the number on the left is smaller than or equal to the number on the right.
- Equals (=): used to compare if the number on the left is equal to the number on the right.
- “Does not equal to (!= or <>) is used to compare if the number on the left is not equal to the number on the right.”
– The man was so exhausted that he fell asleep as soon as he got home.
– The man was so tired that he fell asleep as soon as he arrived at his house.
SELECT * FROM table_name WHERE column_name > 10;
SELECT * FROM table_name WHERE column_name < 20;
SELECT * FROM table_name WHERE column_name >= 15;
SELECT * FROM table_name WHERE column_name <= 30;
SELECT * FROM table_name WHERE column_name = 25;
SELECT * FROM table_name WHERE column_name != 5;