MySQL Common syntax

Source: Internet
Author: User

1. Union merging of two or more SELECT statements
2.year (now ())-year (sbirthday) Get current Age

3.order by sort default positive order desc reverse

4.group by grouping having a conditional judgment on group by data only

COUNT (*): Counts the number in a group, usually with "*" Parameters

Max (field name): Gets the maximum value in the Group for this field.

Min (field name): Gets the minimum value in the Group for this field.

sum (field name): Gets the sum of the fields in the group.

AVG (field name): Gets the average of the field in the group.

5. Like (Fuzzy Lookup): Grammatical form: xx as ' the character to look for '

% represents any number of arbitrary characters

_ represents any character of 1

6. Limit:
select * FROM table limit M,n
where m refers to the beginning of the record index, starting from 0, indicating the first record
n means starting from section m+1 and taking N.
SELECT * FROM tablename limit 2,4
Take out 3rd to 6th, 4 records

7. The difference between or and and

Or:or is ' or ' meaning, as long as one of the conditions is established.

And:and is ' with ' meaning, juxtaposition, two conditions to be set up

MySQL Common syntax

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.