a where filter
1 Make
with
and
and the
OR
Combining query Criteria
SELECT * from Sell WHERE sell_price>=1000 and (or) sell_price<=2000
2
To make use of.
between
and the
Not between
Filter Records
SELECT * from sell where sell_price between and a (notbetween is not in this range )
3. Use the
inch
and the
not in
Filter Records
SELECT * from the worker WHERE work_id in (' 9601 ', ' 9702 ') (not in is not this ...) Range
4
To make use of.
like
and wildcard filter Records
% has 0 or more characters-single character
[] Specify a range such as "a~f" [^] outside the specified range [^a~f]
? example, from "WORKER" find the name in the first two words is " ? text " staff information.
Select * from worker Where Work_name like ' _ text _ '
? Example: Query worker All employee information of Wang in the table
Select * FROM student Where student_name like ' Wang % '
? the employee information of duress surname Wang
Select * from the worker Where work_name like ' [ Liu Wang ]% '
? example, from "Worker" the lowest number of search job numbers in the table is not in 2~6 within the scope of the staff.
SELECT * from worker where work_id like '%[^2-6] '
5
To filter records with null values
SELECT * from supplier where Sup_tel are (not) null
Two having filter
Total number of employees with sales totals above $1000 and sales totals
Select Word_id,sum (sell_price) from sell where Sell_price > the group by word_id
Where filtering is the first to select the sales price above 1000, and then group the summary
Select Word_id,sun (sell_price) from sell GROUP by word_id have sum (sell_price) >1000
Having a filter is the first group summary, and then select the total sales of more than 1000
Different points:
1 WHERE Check that every record is full? having Check that the aggregated data for each group after the group rollup is full? sufficient conditions;
2 youcan use aggregate functions in the HAVING clause, but not in the whereclause.
Where,having Filtering Method Summary