Equal to Greater than Less than Not Equal to Operators in SQL

For Complete YouTube Video: Click Here

This class will understand Equal to Greater than Less than Not Equal to Operators in SQL.

We have already discussed the concepts of Commit and Rollback in SQL.

Equal to Greater than Less than Not Equal to Operators in SQL

Before understanding the above operators, we will try to understand the single value operator.

Single Value Operators

Single Value Operators make logical tests against single values.

select * from students where salary = 300;

In the above query, salary = 300, the ‘equal to’ operator can test only one value.

The following are the single value test operators.

Equal to =
Greater Than >
Less Than <

Greater Than Equal to >=
Less Than Equal to <=

Not Equal to !=, ^=, <>

LIKE
IS NULL
IS NOT NULL

LIKE, IS NULL, and IS NOT NULL are also single value operators.

We will see about them in our next classes.

Now we will test each operator individually and see the outputs.

‘Equal to’ operator in SQL

The use of the ‘equal to’ operator is as shown below.

Equal to Greater than Less than Not Equal to Operators in SQL 1
Equal to Greater than Less than Not Equal to Operators in SQL 1

The students whose salaries are ‘equal to’ 300 got selected.

‘Greater than’ operator in SQL

The use of the ‘greater than’ operator is as shown below.

Equal to Greater than Less than Not Equal to Operators in SQL 2
Equal to Greater than Less than Not Equal to Operators in SQL 2

The students whose salaries are ‘greater than’ 300 got selected.

‘Greater than or Equal to’ operator in SQL

The use of the ‘greater than or equal to’ operator is as shown below.

Equal to Greater than Less than Not Equal to Operators in SQL 3
Equal to Greater than Less than Not Equal to Operators in SQL 3

The students whose salaries are ‘greater than or equal to’ 300 got selected.

‘Less than or Equal to’ operator in SQL

Similarly, you can visualize for less than and less than or equal to also.

‘Not Equal to’ operator in SQL

The use of the ‘not equal to’ with all the operators is as shown below.

Equal to Greater than Less than Not Equal to Operators in SQL 4
Equal to Greater than Less than Not Equal to Operators in SQL 4

The students whose salaries are ‘ not equal to’ 300 got selected.