Relational Operators


☞ Relational operators in MySQL are used to compare values in SQL queries and conditions to determine whether a particular condition is true or false.

☞ These operators are typically used in the WHERE clause of SELECT, UPDATE, DELETE.

☞ The commonly used relational operators in MySQL.

S.No.OperatorDescription
1. = equal to
2. < less than
3. > greater than
4. <= less than or equal to
5. >= greater than or equal to
6. <> OR != not equal to

Syntax :

SELECT * FROM <table_name>
WHERE <condition>;

Example :

SELECT * FROM Student
WHERE name="ananya";

OR

SELECT * FROM Student
WHERE fees>=15000;

OR

SELECT * FROM Student
WHERE dob>='2009-05-15';

OR

SELECT * FROM Student
WHERE fees<>14020.50;
NOTE : Date and time must be enclosed in inverted commas.