ARITHMETIC OPERATORS

ARITHMETIC OPERATORS

Oracle allows arithmetic operators to be used while viewing records from the table or while performing Data Manipulations operations such as Insert, Update, and Delete.

These are: -

+ Addition
* Multiplication
- Subtraction
** Exponentiation
/ Division
( ) Enclosed operation


LOGICAL OPERATOR


Logical operators that can be used in SQL sentences are: -

The AND operator:
The Oracle engine will process all rows in a table and display the result only when all of the conditions specified using the AND operator are satisfied.
EXAMPLE: -
SQL> SELECT order_no, client_no, order_date, sale_amount
FROM sales_order
WHERE sale_amount>=10000 AND sale_amount<=50000;

The OR operator:
The Oracle engine will process all rows in a table and display the result only when any of the conditions specified using the OR operator are satisfied.

EXAMPLE: -

SQL> SELECT order_no, client_no, order_date, sale_amount
FROM sales_order
WHERE (client_no=C0003 OR client_no=C0005);


The NOT operator:

The Oracle engine will process all rows in table and display the result only when none of the conditions specified using the NOT operator are satisfied.
EXAMPLE: -

SQL>SELECT order_no, client_no, sale_amount
FROM sales_order
WHERE NOT (sale_amount=20000 OR sale_amount=50000);


RANGE SEARCHING

In order to select data that is within range of values, the BETWEEN operator is used. The BETWEEN operator allows the selection of rows that contains values within a specified lower and upper limit. The range coded after the word BETWEEN in inclusive.
The lower value must be coded first. The two values in between the range must be linked with the keyword AND. A BETWEEN operator can be used with both character, numeric data types. However, one cannot mix the data types i.e. the lower value of the range of values from character column and the other from a numeric column.
EXAMPLE: -
SQL> SELECT order_no, client_no, sale_amount
From sales_order
WHERE order_noBETWEEN'O191002' and 'O191005';

Post a Comment

Previous Post Next Post