Name

Operators

Synopsis

An operator is a symbol specifying an action that is performed on one or more expressions. Operators are used most often in DELETE , INSERT, SELECT, or UPDATE statements but also are used frequently in the creation of database objects, such as stored procedures, functions, triggers, and views.

Vendor

Command

SQL Server

Supported, with variations

MySQL

Supported, with variations

Oracle

Supported, with variations

PostgreSQL

Supported, with variations

Operators typically fall into these logical categories:

Arithmetic operators

Supported by all databases

Assignment operators

Supported by all databases

Bitwise operators

Supported by Microsoft SQL Server

Comparison operators

Supported by all databases

Logical operators

Supported by Oracle, Microsoft SQL Server, and PostgreSQL

Unary operators

Supported by Oracle

Arithmetic Operators

Arithmetic operators perform mathematical operations on two expressions of any datatypes in the numeric datatype category. See Table 3.4 for a listing of the arithmatic operators.

Table 3-4. Arithmetic Operators

Arithmetic Operator

Meaning

+

Addition

-

Subtraction

*

Multiplication

/

Division

%

Modula (SQL Server only); returns the remainder of a division operation as an integer value.

Tip

In Oracle and SQL Server, the + and - operators also can be used to perform arithmetic operations on date values.

Assignment Operators

Except in Oracle, the assignment operator (=) assigns the value to a ...

Get SQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.