MySQL query statement -- SELECT

Source: Internet
Author: User
I would like to summarize several other experiments of high-availability clusters. Let's look back at the content summarized by others, which is very fine and has extended a lot of content. Sorry, I can't do it, But I skipped it first.

I would like to summarize several other experiments of high-availability clusters. Let's look back at the content summarized by others, which is very fine and has extended a lot of content. Sorry, I can't do it, But I skipped it first.

I would like to summarize several other experiments on high-availability clusters. Let's look back at the content summarized by others. It's very fine, and a lot of content has been extended. Sorry, I just skipped it, haha ~~~

Here we will summarize the mysql query statements:

This section describes simple database operations. Next, we will start with the details to introduce mysql query statements;

Import a jiaowu database here to perform the following operations:

Let's take a look at the contents of this database.

L> use jiaowu;

Database changed

This is the data used in the following example. You can refer to it first;

The first is the mysql query statement:

Query category:

Single Table query: simple query

Multi-Table query: join query

Subquery: complex Query

Joint Query

Select statement:

Common functions:

# Field -- indicates a field

Total number of count (*) rows

Max (field) returns the maximum value.

Min (field) returns the minimum value.

Avg (field) Average

Sum () and

Select selects columns, where selects rows, and combines them to display the attributes of an object as a whole.

The condition is specified after where:

The following conditions can be specified:

Arithmetic comparison:

>,<, =,!,> =, <=, <=> (The result is null and no error occurs)

Logical comparison of combinations:

And

Or

Not (!)

Comparison of other conditions:

Beween ...... And ......

The in query field is in the specified list.

Is null: the query is null.

Is not null

Like: wildcard matching

%: Match any character of any length

_: Match a single character

Regexp | rlike: Regular Expression matching

Order by: sort. The default value is asc in ascending order.

Desc: Descending Order

Distinct: the uniqueness of the display result, which is attached to the select statement (as described in the following example, only the same cid1 is displayed once)

Group by: groups the obtained results. Generally, the group results are used for aggregation operations.

Having: filter the results of a group based on conditions.

Limit: limit the number of lines displayed

Eg: limit 1, 2; indicates skipping the first line and then displaying the second line

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.