Arrow

SQL logical operators

AuthorHariom Prajapati

Pubish Date03 Jul 2022

categoryMySql

The logical operators are used to find smaller, greater, equal values from same column.

 

1) Equal to

It is used to find data from a table according to the 'equal to' condition.

 

Syntax -

Select * from table_name where column_name  = column_data;



2) Not equal to

It is used to find data from a table according to the 'not equal to' condition.

 

Syntax -

Select * from table_name where column_name  != coumn_data;



3) Greater than or less than

It is used to find data from a table according to the 'greater than or less than' condition.

 

Syntax -

Select * from table_name where column_name  > column_data;
Select * from table_name where column_name  < column_data;



 4) Greater than equal to or less than equal to

It is used to find data from a table according to the 'greater than equal to or less than equal to' condition.

 

Syntax -

Select * from table_name where column_name  > = column_data;
Select * from table_name where column_name  < = column_data;



5) Data of anyone

It is used to find data of anyone from a table.

 

Syntax -

Select * from table_name where column_name  in ( ‘name1’, ‘name 2’,………. );



                                             OR

Select * from table_name where column_name  = ‘name1’ or  column_name  = ‘name 2’ or  ……….);