1.6. Relational Operators
An operator manipulates data elements and returns a result. The data elements that are operated upon are called operands or arguments, and a special character or keyword represents the actual operator. Oracle SQL supports several types of operators, listed in this section.
1.6.1. Arithmetic Operators
Arithmetic operators perform arithmetical calculations on a pair of data elements and/or constants. Table 1-1 lists the arithmetic operators available in SQL.
| Operator | Description | Example |
|---|---|---|
| + | Addition | sal + comm |
| - | Subtraction | sal - comm |
| * | Multiplication | sal * 1.1 |
| / | Division | sal / 12 |
| - | Negation | -sal |
| + | Identity | +sal |
1.6.2. Concatenation Operator
The concatenation operator (||) combines two character strings. Consider the following SQL statement:
SELECT fname || ' ' || lname FROM employee_master;
This statement returns (for each row) a single string consisting of the first name, a space, and the last name.
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access