SQL Comparison Operators Guide

To compare numbers in SQL, you can use comparison operators such as:

  1. Greater than (>): Used to compare if the number on the left is greater than the number on the right.
  2. Less than (<): used to compare if the number on the left is smaller than the number on the right.
  3. 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.
  4. 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.
  5. Equals (=): used to compare if the number on the left is equal to the number on the right.
  6. “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;
bannerAds