MySQL must know the notes

Source: Internet
Author: User

"English" Ben Forta

1

1.0 Select Database use eg:use database name;

2.0 Show Command View information: show databases;

Show tables;

Show columns from table name; (Displays property information for columns in the table)

Show status (displays extensive server status information)

Show Create/database/table;

Show grants; (Show permissions granted to users)

Show Errors/warings; (Display server error, warning)

||| Describe table name = = equivalent to ==show columns from table name

2

1.0 Select Distinct column name from table name;

2.0 Limit Usage:

Eg:limit 5; (Limit display of the first 5 lines of the current)

Eg:limit 5 (Start line), 5; (limit displayed 5 rows)"parameters are all starting from 0, 5 for 6 lines"

starting from 5.0, use the new syntax: limit 4 offset 3; (indicates 4 rows starting from 3 rows)

About ORDER BY ordering: Eg:order by Price,name;

Only the price value is sorted by name, and if the price value is unique, name is not sorted.

   Use the order by and limit combinations to select the maximum,

ASC (Ascending) <----------------> Reverse DESC ( sort only the columns directly ahead of them )

3

1.0 WHERE Price < = 10; This is a correct statement that can be used.

2.0 mismatch check: where ID <> 1003; The return value is a result other than 1003.

3.0 between and and constraints include a start value and an end value.

4.0 and OR mix when used. and has a high priority, query and statement first. To solve this problem, you can use parentheses to limit it.

5.0 wildcard character% like "%";-----------------------> cannot represent null.

|

|--------------->like matches the entire column, and the corresponding row is not returned if the matched text appears in the column values.

        |

       |---------------> Regular Expressions: REGEXP-------> If compared to like, the row returns, in contrast to like.

|-------------> Generally do not write the case, but if the difference, then binary.

6.0 matching: where name REGEXP ' [123] TON ';

|-------------> corresponds to 1 Ton, 2 Ton, (3 ton No, remember) |

|-----> corresponds to another form of an or statement, equivalent to [1|2|3] ton

The escape character "\ \" [A-z] represents the range A through Z

7.0 * characters commonly used character class *

            

8.0 about matches:

*--->0 or multiple matches

+---->1 or multiple matches

? ----->0 or 1 matches

{n}----> specified number of matches

{n,}----> not less than a specified number of matches

{N,M}---> Match number range

9.0 operator for text:

^ Beginning of the text

The end of the $ text

[[: <:]] The beginning of the word

[[:]: The end of the word

10.0 about Stitching: combine multiple column values into a single value (+,| | )

But MySQL does not, you need to use the concat () function to implement

|---->eg:select concat (name, ' (', Country, ') ')

|----> The result is: Name (country)

Arithmetic operators: +,-,*,/

11.0 * Common Text processing functions *

* About Soundex () function *

|------>soundex () returns the value of the Soundex of a string (pronounced comparisons, similar to syllables, characters)

|------>eg:select name from table where name = ' Y.lie ' (no return value)

|-->where Soundex (name) =soundex (' Y.lie ') (the result of the query will appear)

* About the difference between having and where

|--------->having supports all where operations, filtering groupings, which are filtered after grouping.

|--------->where Filter rows, and filter the array before grouping.

4

  1.0 * Common Date and time functions *

2.0 about Full-text search:

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.