Geek Slack

My SQL Tutorial
About Lesson


MySQL Operators


MySQL Operators

Operators in MySQL are used to perform operations on values and produce a result. They include arithmetic operators, comparison operators, logical operators, and more.

Arithmetic Operators:

SELECT 10 + 5 AS addition,
       10 - 5 AS subtraction,
       10 * 5 AS multiplication,
       10 / 5 AS division,
       10 % 3 AS modulus;

This query demonstrates the arithmetic operators in MySQL, including addition, subtraction, multiplication, division, and modulus.

Comparison Operators:

SELECT * FROM employees
WHERE salary > 5000;

This query selects all employees with a salary greater than 5000, using the comparison operator >.

Logical Operators:

SELECT * FROM employees
WHERE department_id = 1 AND salary > 5000;

This query selects employees from department 1 with a salary greater than 5000, using the logical AND operator.

These are just a few examples of operators in MySQL. They are essential for building complex queries and performing various operations on data.

Join the conversation