SQL Server fuzzy query, grouping

Source: Internet
Author: User

first, System functions
1. Convert (type [length], expression [, style])
2.isnull (expression, default)
character functions:
len () length
LTrim () |rtrim () remove left and right spaces
Right () |left () intercepts the character
substring (); intercept by position and length
Date Function:
DATEADD () date plus operation
DateDiff () Two date difference
getdate () gets the current system date
datepart () get part of date
second, fuzzy query
Like ' pattern ' can only be used in text type data
%: Any character of any length
_: One character of any character

[]: Any character in the specified range [Yang Qing] [0-9][^a-z]
 
CHECK Stuno like ' [0-9][0-9][0-9] ' 001 002 101
Range:
between ...  And ... Equivalent to and
list: in
field in (constant 1, constant 2) is equivalent to or
three, aggregation function;
1.sum (column name)
2.avg (column name)
3.max (column name) min (column name)
4.count (column name [*])
Iv. Grouping
SELECT column name, aggregate function () from table name
Where Condition
Group By column name
Having conditions
Order BY column name
columns after 1.SELECT must be available after group by
2. Order: where->group by->having->order by

SQL Server fuzzy query, grouping

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.