SQL grouping, fuzzy search, sort,

Grouping:

Implemented row_number () over ()

语法:ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN)

 

Implemented group by

Syntax: group by Field [ase or desc]

 

Fuzzy query:

Implemented patindex

Returns the expression of a specified start position of the first occurrence; and if the pattern is not found in all valid text and character data types, a zero is returned.

Syntax: patindex ( '% pattern%', expression)

parameter

pattern

A string. You can use wildcards, but there must be pattern before and after (except the first and last character of the search)% character. pattern is an expression of short character data type category.

expression
expression, typically a column in which to search for the specified pattern, expression is a string data type category.
Return type
int
Note
PATINDEX useful for text data type; inter IS NULL, IS NOT NULL and the LIKE (these are the Where clause of type text only other valid comparison operation) outside, can also be used PATINDEX Where clause .

Implemented like

语法:select * from table1 where name like '%明%'

 

Sort by:

asc ascending

desc Descending

 

is sorted order by a field, gorup by a field is set in the same group

 

Guess you like

Origin www.cnblogs.com/BruceV/p/11960632.html