Learning notes for MySQL required: 1

Source: Internet
Author: User
Learning notes for MySQL required: 1 # select a database

USE mysql

# Back to the list of available databases

SHOW DATABASES

# Return the available tables in the current database

SHOW TABLES

# Return table columns

Show columns from db

# Display creation statements for a specific database

Show create database mysql

# Display a wide range of server status information

SHOW STATUS

# Display the security permissions of authorized users

SHOW GRANTS

Multiple SQL statements must be separated by semicolons.

SQL statements are case-insensitive and often capitalized.

Use DISTINCT to retrieve different rows. only different values are returned.

LIMIT result, LIMIT clause

LIMIT 5 returns no more than five rows.

LIMIT 3 and 4 rows starting from row 3

LIMIT 4 OFFSET 3 (the result is the same as above) [supported after MySQL5]

Order by clause sorting

DESC/ASC specify the sorting direction

WHERE clause. order by is located after WHERE.

Operator

Description

=

Equal

<>

Not equal

! =

Not equal

<

Less

<=

Less than or equal

>

Greater

> =

Greater than or equal

BETWEEN

Between two specified values

NULL

WHERE *** is null check whether the field has a NULL value.

And or operator.

The IN operator is used to specify the condition range. multiple valid values are separated by commas.

NOT negative operator, which can be used to reverse the IN, BETWEEN, and EXISTS clauses.

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.