Oracle expression Operator Precedence

Source: Internet
Author: User
Tags arithmetic arithmetic operators logical operators

Oracle has the following types of operators

Arithmetic operator join operator comparison (relational) operator logical operator

1. Arithmetic operators

The arithmetic operator has four, +,-, *,/.

SELECT sal,sal* from EMP;    The value after #sal and sal*12.

2. Connection operators

The Join operator has | | You can concatenate two of strings together.

SELECT ename | | "The Wages are" | | Sal from EMP;   #此 | | is to connect employees to wages         Bob (ename) "Wages are" (SAL)

3. Compare (relational) operators

The relational operators are > greater than, >= is greater than or equal, < less than, <= is less than or equal,! = or <> is not equal.

Selcet  ename,sal,hiredate from     emp WHERE    '01-jan-91';                #找出1991年01月01日日期以后的记录.

Special relational operator "between and" "in" "like"

Between and selects a range of records. Cases:

SELECT ename,sal from  emp  WHERE sal  ;        #sal列下1500-3000 of records.

In to intercept multiple records. Cases:

SELECT ename,sal,hiredate,job  from emp WHERE job  in (' Salesman ','clerak',  'MANAGER');   The #选取 job value is ' salesman ','clerak','MANAGER' records.

Like in conjunction with wildcard match examples:

' sal% ';   #% can be understood as a wildcard character, which is equivalent to the * number. Represents any character.

% represents 0 or more characters

_ Represents a single character example:

' s_l_s% ';   #第一个字符为S, the second is an L, and the third is an arbitrary value of S.

If the matched value contains a% or _, it can be escaped. Cases:

CREATE TABLE test_dept as SELECT * from dept;  #新建一张测试表. INSERT into Test_dept VALUES ("it_rese",'Beijing  ');    ' it\_% '  ' \ ';   #escape defines the escape character. 

4. Logical operators

logical operators have and (logical AND) or (logical OR) not (logical not)

T is true, F is false and expression is expression 1 and expression 2 expression one or two both have a result of T and no is f.

F and F = f f and t = f t and T =t

and Priority f>null>t

or expression 1 or expression 2 only one of the expressions is true, and the result is true.

F or F =f f or T = t t or T = t

OR Priority T->null>f

The result is true when the not expression 1 not expression 22 edge condition is not valid

F not F =t f not t = f t t = f

---------------------------------------------------------------------------------------

Operator Precedence

Arithmetic operator > Join operator > Relational operator >is null,is not NULL, like, not-like, in, not-in operator >between, not between operator >not logical operator &G T The and logical operator >or logical operators. Cases:

SELECT ename,empno,sal,job from  emp WHERE job='clerk'job   ='  Salesman' and sal>=;   #AND expression is prioritized and will be calculated first.

NULL indicates null, not equal to a space, the expression contains null, and the result is null

  

Oracle expression Operator Precedence

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.