SQL operators are used to derive the result of a value based on a variety of operations such as arithmetic, comparisons, and logic.

There are many types of operators such as Arithmetic Operators, Comparison Operators, and Logical Operators who work according to the conditions.

### SQL Operators

Arithmetic Operators and Comparison Operators are used with the sign, such as (*) to multiply and (+) to add value. Most of these operators are used with a numeric value.

Related: 25 important examples of SQL where clause

If you want to use Logical Operators, then for that you have to apply some specific keywords from which you can perform logical operations.

We have some excellent examples of SQL operators available, after seeing which you will know how the operators work.

### Arithmetic Operators In SQL

First, let’s talk about Arithmetic Operators, which includes subtract (-), add (+), multiply (*), modulus (%), and divide (/).To teach you much better we have SQL arithmetic operators examples available.

``````/ ****** Addition (+) ****** /

SELECT name, salary, salary + 100
AS "Total salary" FROM Employees;

/ ****** Subtraction (-) ****** /

SELECT name, salary, salary - 150
AS "Total salary" FROM Employees;

/ ****** Multiplication (*) ****** /

SELECT name, salary, salary * 2
AS "Total salary" FROM Employees;

/ ****** Division (/) ****** /

SELECT name, salary, salary / 4
AS "Total salary" FROM Employees;

/ ****** Modulus (%) ****** /

SELECT name, salary, salary % 8
AS "Total salary" FROM Employees;``````

### SQL Comparison Operators

Now comes the Comparison Operators which are used to show a value based on the comparison. Below the examples, you will know how to set comparison operators in SQL.

Equal to (=)  Checks the given value whether it is equal or not.

``````SELECT name FROM Employees
WHERE salary = 2000;``````

Greater than (>)    If the value on the left is larger than the value of the right set, it will return a record.

``````SELECT name FROM Employees
WHERE salary > 4000;``````

Less than (<)  If the value on the left is less than the value of the right set, it will return a record.

``````SELECT name FROM Employees
WHERE salary < 3000;``````

Greater than or equal (>=) It will check if the value is above or equal to the operand.

``````SELECT name FROM Employees
WHERE salary >= 2500;``````

Not equal (<>)  If the left value is not equal to the set right value, It will remove that record.

``````SELECT name FROM Employees
WHERE salary <> 4500;``````

### Logical Operators In SQL

Logical operators are those that are used most to extract data. These operators return true and false values according to your condition. Below you will see the logical operators in SQL with examples that are the most used.

AND:- This will only work if both of your conditions are true.

``````SELECT * FROM Employees
WHERE car = "BMW" AND bike = "Yamaha";``````

OR:- This will work if any of the conditions are correct.

``````SELECT name FROM Employees
WHERE car = "BMW" OR bike = "Yamaha";``````

BETWEEN:- This operator is used to extract records from between your given values.

``````SELECT name FROM Employees
WHERE age BETWEEN 30 AND 80;``````

LIKE:- The role of this operator is to discover the named pattern.

``````SELECT * FROM Employees
WHERE name LIKE 'a%';``````

IN:- The IN operator search for multiple values.

``````SELECT * FROM Employees
WHERE car IN ('MBW','Ferrari');``````

We have answers to some questions that people search on the Internet every day. Let’s know what those questions are and what their answers are.

What are the basic operators of SQL Server?
There are 4 basic operators such as insert, select, update, and delete.

How many types of operators in SQL?
There are the following types such as Arithmetic Operators, Comparison Operators, Bitwise Operators, and Logical Operators.

How to extract data from the database?
Using the “SELECT” statement.

What is limit keyword SQL?
The limit keyword is used to extract data from a database according to a limit value.

How do get the full table data?
Using the “SELECT * FROM mytable” statement.

How to search for a specific pattern?
Using the LIKE keyword.

How to create a table in the database?
Using the CREATE TABLE keyword.

Related: 13 simple examples of SQL sum and SQL count