SQL must know will be -05

Advanced data filtering

Combined where clause

Where clause allows multiple SQL, and may use keywords or keyword or connection.

and operator

eg:select prod_id, pro_price, prod_name from products where vend_id = 'dll01' and prod_price <= 4;

and for indicating to retrieve all rows that satisfy a given condition.

or operator

and the operator or opposite the operator, wherein the row satisfy a retrieval condition.

eg: select prod_name, prod_price from products where vend_id = 'dll01' or vend_id = 'brs01';

Order of evaluation

where clause can contain any number of and and or operators, allowing both to be used in combination. However, they have an order of evaluation.

Prior to treatment or SQL operators, and operators will priority. If the priority processing or brackets can be used. (Often used to segment semantic parentheses)

eg:select prod_name, prod_price from products where (vend_id = 'dll01' or vend_id = 'brs01')and prod_price >= 10;

in operator

operator is used in the specified range of conditions, in the range of each condition can be matched.

eg: select pro_name, prod_price from Products where vend_id in ( 'dll01', 'drs01'); vend_id retrieved value 'dll01', 'drs01' line.

in operator or operators and it is very similar.

in operator benefits:

  1, the syntax of the operator in a clearer and more intuitive.

  2, with respect to and, or operator, in the order of evaluation easier to manage.

  3, in a specific set of operators or operators perform faster

  4, in the operator select statement can contain other, can be constructed where clause dynamic.

not operator

where clause not operator has only one function it is to deny subsequent conditions.

 

Guess you like

Origin www.cnblogs.com/sunshine-2018/p/11423024.html