Comparison operators: Comparison operators allow row retrieval from table based on the condition specified in the WHERE clause.
Here is the list of all comparison operators available in SQL.
Operator
|
Description
|
|---|---|
| = | Equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
| <>, != | Not equal to |
| !> | Not greater than |
| <! | Not Less than |
| () | Controls precedence |
Example: SELECT * from publishers WHERE country = 'USA'
The above statement displays those pub_name from publishers table for which country is USA.
Example: SELECT Type, Title_ID, Price from Titles WHERE Price * Ytd_Sales < Advance
This statement displays only those records from the Titles table in which the product of price and YtdSales attributes is less than the advance for the book.