1 , what is fuzzy query:
Criteria query is ambiguous, the result is not unique, and not very clear value.
2 , Tsuhaifu
_ [Underscore] represents a character
% [Percent sign] represent any character
[] [] Brackets represent the range of values within the brackets
[^] [Brackets] non lies outside the brackets represents the range
3 , fuzzy query method:
(1) Use like + 'string having wildcard'
select top column number 1 as an alias, a column 2 as aliases
from table name
where column like 'string having wildcard'
order by sort column
NOTE: LIKE only be used in combination with the character data, StudentName like ' Peng %' surname Peng.
(2) is null and is not null [value] never existed
select top column number 1 as an alias, a column 2 as aliases
from table name
where 列 is null
order by sort column
(3) If there is a column of this value, but the value is deleted after, can not be used is null query should be:
select top column number 1 as an alias, a column 2 as aliases
from table name
where column = ''
order by sort column
(4) use between ... and ... represents a value between a column and what
select top column number 1 as an alias, a column 2 as aliases
from table name
where column [Not] BETWEEN value 1 and value 2 between
order by sort column
Note: AND the number is less than the number in front of the back [] from small to large, otherwise the error did not result.
5) Use [not] in the keyword query
Search record contents of a column and a list of the contents of the listed matches
select top column number 1 as an alias, a column 2 as aliases
from table name
where column [not] in ( value 1 , value 2 , ...... )
order by sort column
Note: the parentheses in the table of contents, a plurality of values [,] connected.
4, aggregate functions: to calculate a set of values, and returns the calculated value , has the effect of statistical data
- The SUM () to find a sum only for numerical operations.
- The AVG () to find an average , only numeric operations.
- MIN () and MAX () selecting the maximum value of the number of a minimum value , to be numbers, strings, date type operation.
- COUNT () is used to find the number of effective lines , statistics.
Note: COUNT (*) query the total number of records; COUNT ( column name ) , a separate query when null values are ignored.