Query and Query polymerization conditions

Conditions inquiry:

Logical condition: and ( to ) or ( or )

 

and: a blog on the existing practical examples

Theorem: both sides must meet to appear (and are and mean)

or: or the meaning of

effect:

 

Definition: as long as any of them will be (or generally appear when using or)

Exercise:

effect:

Little Red Riding Hood can see the female gender but to meet so there is java1018 class.

 

<> (Not equal)

 

effect:

 

between and ( equivalent to > = and <=) :

 

effect:

 

Defined: between and is nailed only and less than or equal to

 

Determine sky conditions:

null: nothing is empty. Really no value

Empty string: There is value, but it is empty. It is an empty string

effect:

 

 

effect:

 

Definition: generally empty or, and usually is not empty (empty and not empty, but the two conditions are determined to be empty or, is not empty and).

 

 

Fuzzy query: like

 %: It represents any number of characters

 

 _: Represents a character

 and like to use _ or% with the job.

 effect:

 

Analysis: Add 'is because sname type varchar,% is added back after any large characters plus 0 ~ n can be matched, that is to say can be large at the beginning of the match.

 

%% Can be large write this on behalf of the word if there is a large field can be reflected

 

effect:

 

 

Analysis: plus _ because _ is representative of a character

 

 

E.g:

 

effect

 

 

Aggregate query;

Conventional polymerization functions: SUM () AVG () max () min () COUNT ()

Function only between the polymerization and select from.

sum (): sum (sum field bristling)

effect:

avg (): average

 

 

max (): maximum value

 

min (): minimum value

 

 

 

 

解析:ifnull(heml,0):是让heml里的null值为0.

count():是统计每一列的记录数,是统计每一列不为空的记录数

最好count(*)

count(*):会吧所有列都count一下然后取最大值

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/www1842564021/p/11962479.html