Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
 

SQL Operators
Oracle Tips by Burleson
 

SQL incorporates operators that are quite similar to the operators in other languages, as shown in Table 2.2.

Table 2.2  SQL operators.
 

Operator Usage
** The exponentiation operator (2**2 IS 4)
NOT Negates a condition (IS NOT NULL, NOT IN, NOT BETWEEN)
+ The addition operator (2 + 2 IS 4) as well as the unary indicator of a positive number (+2)
- The subtraction operator (4 - 2 IS 2) as well as the unary indicator of a negative number (-2)
* The multiplication operator (2 * 2 IS 4)
/ The division operator (4 / 2 IS 2)
|| The concatenation operator (‘A’ || ‘B’ IS ‘AB’)
= The equation operator (2 = 2)
!= The non-equation operator (3 != 2)
< The less than operator (2 < 4)
> The greater than operator (4 > 2)
<= The less than or equal to operator (2 <= 4, 2 <= 2)
>= The greater than or equal to operator (4 >= 2, 2 >= 2)
IS NULL Tests a variable or condition for a NULL value (first_name IS NULL)
LIKE Allows wildcard searches (last_name LIKE ‘SM%’)
BETWEEN An inclusive range test (1, 2, AND 3 ARE BETWEEN 1 AND 3)
IN A set operator (2 IS IN {1, 2, 3})
AND A logical and (x < y AND y < z)
OR A logical or (x < y OR y < z)

Any of these operators may be used anywhere in a DML statement with the exception of the FROM clause, as shown by these examples:

SELECT 2**nRealValue
FROM   CHECK_VALUES
WHERE  nRealValueProcessed = 'F';

DELETE
FROM   STUDENTS
WHERE  overall_gpa < 0.2;

UPDATE STUDENTS
SET    overall_gpa = 1.02 * most_recent_gpa
WHERE  ssn = 999999999;

INSERT
INTO   CHECK_VALUES
       (nRealValueProcessed,
        nRealValue)
VALUES ('F',
        (2.031 ** 3) / 9);

Oracle Subqueries

A subquery is a query within the WHERE clause of a DML statement, as shown in this example:

SELECT ssn
FROM   STUDENTS
WHERE  overall_gpa = (SELECT max (overall_gpa)
                      FROM   STUDENTS);

Subqueries can be used in any type of DML statement.

 

This is an excerpt from the book "High Performance Oracle Database Automation" by Jonathan Ingram and Donald K. Burleson, Series Editor.

  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2014 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation. 

Hit Counter