MySQL Chinese reference manual

Source: Internet
Author: User
Tags character set manual mysql version table name

MySQL contains extensions that may not be found in other SQL databases. Be aware that if you use them, your code will not be compatible with other SQL Servers. In some cases, you can write code that includes MySQL extensions, but it's still portable, by using the/*! . * * form the annotation. In this case, MySQL will perform lexical analysis and execute the code within the annotation as if it were any other MySQL statement, but the other SQL Server will ignore the extension. For example:

SELECT/*! Straight_join * * col_name from Table1,table2 WHERE ...

If you're in '! ' After adding a version number, the syntax will only be executed if the MySQL version is equal to or newer than the version number used:

CREATE/*!32302 Temporary */TABLE (a int);

The above means that if you have 3.23.02 or newer, then MySQL will use temporary keywords.

The MySQL extensions are listed below:

Field type Mediumint, SET, enum, and different blob and text types.

Field Properties Auto_increment, BINARY, unsigned, and Zerofill.

By default, all string comparisons are case insensitive and are determined by the current character set (the default is iso-8859-1 Latin1) sort order. If you don't like this, you should use the binary attribute or declare the column with the binary coercion, which causes the MySQL server host to be sorted according to the ASCII order.

MySQL maps each database to a directory below the MySQL data directory, mapping the database table to the database file name under the database directory. This has 2 implications:

Database names and table names are case-sensitive in MySQL on the case-sensitive file name of the operating system (like most Unix systems). If you have difficulty remembering the table name, accept a consistent convention, such as always creating the database and table in lowercase names.

A database, table, index, column, or alias can start with a number (but not only by numbers).

You can use standard system commands to back up, rename, move, delete, and copy tables. For example, rename a table and rename it. MyD ",". Myi "and". frm "files are the corresponding tables.

In SQL statements, you can use Db_name.tbl_name syntax to access tables in different databases. Some SQL servers provide the same functionality but call them the user space. MySQL does not support similar in CREATE TABLE ralph.my_table ... The tablespace in the My_tablespace.

Like is allowed on numeric columns.

Use into outfile and straight_join in a SELECT statement. See 7.12 Select Syntax.

Sql_small_result the option in a SELECT statement.

EXPLAIN Select Gets a description of how the table is joined.

Use the index in a CREATE TABLE statement, the index on the field prefix, and use index or key. See 7.7 CREATE TABLE syntax.

CREATE table uses temporary or if not EXISTS.

Use COUNT (DISTINCT list), where "list" is more than one element.

Use the Change col_name, drop col_name, or drop INDEX inside an ALTER TABLE statement. See 7.8 ALTER table syntax.

In an ALTER TABLE, the statement uses ignore.

Use multiple add, alter, DROP, or change clauses in an ALTER table statement.

Use a drop TABLE with the keyword if exists.

You can discard multiple tables with a single DROP TABLE statement.

The limit clause of the DELETE statement.

The delayed clause of the INSERT and replace statements.

The low_priority clause of the INSERT, REPLACE, delete, and UPDATE statements.

Use the load DATA INFILE. In most cases, this syntax is compatible with Oracle's load DATA infile. See 7.16 LOAD DATA INFILE syntax.

OPTIMIZE Table Statement ...

Show statement. See 7.21 Show syntax (get information about tables, columns, etc.).

Strings can be surrounded by "" or "", not just "'".

Use the "\" escape character.

SET option statement. See 7.25 SET option 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.