O'Reilly logo

SQL in a Nutshell by Kevin Kline

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required