MySQL supports a variety of operators that are used in SQL queries to perform different operations on data.
SELECT column1 + column2 AS sum FROM table;
SELECT column1 - column2 AS difference FROM table;
SELECT column1 * column2 AS product FROM table;
SELECT column1 / column2 AS quotient FROM table;
SELECT column1 % column2 AS remainder FROM table;
= (Equal to): Tests whether two expressions are equal. <> or != (Not equal to): Tests whether two expressions are not equal. < (Less than): Tests whether the value on the left is less than the value on the right. > (Greater than): Tests whether the value on the left is greater than the value on the right. <= (Less than or equal to): Tests whether the value on the left is less than or equal to the value on the right. >= (Greater than or equal to): Tests whether the value on the left is greater than or equal to the value on the right.
AND / && (Logical AND): Returns true if both conditions are true. OR / || (Logical OR): Returns true if at least one condition is true. NOT / ! (Logical NOT): Returns true if the condition is false, and false if the condition is true.
|| (Double pipe): Concatenates two strings.
SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;