MYSQL-DML Introduction (Beginner)

Source: Internet
Author: User


The following diagram is a description of some of the components that are part of the MySQL service. It's still more detailed, so it's often a good idea to take a look at MySQL's entire architecture and get a bit more impressed.

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/76/43/wKiom1ZOe4PCv9OOAAoKxCn2N6Q538.jpg "title=" Mysql Architecture.jpg "width=" 720 "height=" 468 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:720px;height:468px; "alt=" Wkiom1zoe4pcv9ooaaokxcn2n6q538.jpg "/>


Here's an introduction to one of the points in this diagram, "SQL Interface (Database Interface)-DML."

In layman's terms, external access to internal data would have to use the statement of this interface to manipulate the data in the database,

Statements are also classified into many categories, including DDL (database definition Statement) DML (Database manipulation statements), and so on. The operation statement is nothing more than adding and deleting. Divided into the following categories:


INSERT

    [low_priority | delayed | high_priority] [ignore]     [into] tbl_name [(Col_name,...)]     {VALUES | VALUE}  ({expr | default},...), (...),...      [ on duplicate key update      col_name=expr         [, col_name=expr] ... ] 
    [low_priority | delayed | high_priority] [ignore]     [into] tbl_name    set col_name={expr | default},  ...    [ ON DUPLICATE KEY UPDATE       COL_NAME=EXPR        [, COL_NAME=EXPR] ... ] 
[Low_priority |    High_priority] [IGNORE] [into] tbl_name [(Col_name,...)]    SELECT ... [on DUPLICATE KEY UPDATE col_name=expr [, col_name=expr] ...]

DELETE

Single-table Syntax:

[Low_priority] [QUICK] [IGNORE]    From Tbl_name [WHERE where_condition] [ORDER by ...] [LIMIT Row_count]

Multiple-table Syntax:

[Low_priority] [QUICK]    [IGNORE] tbl_name[.*] [, tbl_name[.*]] ... From Table_references [WHERE where_condition]

DELETE [low_priority] [QUICK] [IGNORE] from tbl_name[.*] [, tbl_name[.*]] ... USING table_references [WHERE where_condition]

SELECT

      [ALL | DISTINCT | DISTINCTROW ]       [HIGH_PRIORITY]      [STRAIGHT_JOIN]       [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]       [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]    select_expr  [,  select_expr  ...]     [FROM table_references    [WHERE where_condition]     [GROUP BY {col_name | expr | position}       [ASC | DESC], ... [WITH ROLLUP]]    [HAVING  Where_condition]    [order by {col_name | expr | position}       [ASC | DESC],&NBSP, ...]     [limit&nbsP {[Offset,] row_count | row_count offset offset}]     [procedure procedure_name (argument_list)]    [into  outfile  ' file_name '         [character set charset_name]         export_options      | into  DUMPFILE  ' file_name '       | into var_name [, var_ Name]]    [for update | lock in share mode]]

UPDATE

Single-table Syntax:

[Low_priority] [IGNORE] table_reference SET col_name1={expr1| DEFAULT} [, col_name2={expr2|    DEFAULT}] ...    [WHERE Where_condition]    [ORDER by ...] [LIMIT Row_count]

Multiple-table Syntax:

UPDATE [low_priority] [IGNORE] table_references SET col_name1={expr1| DEFAULT} [, col_name2={expr2|    DEFAULT}] ... [WHERE Where_condition]

Grammatical explanations

[Low_priority | DELAYED | High_priority]

The storage engine performs the priority for MyISAM and memory Read- write, low priority, high priority,-

The default is low priority-MY.CNF configuration parameters are in effect Low_priority_updates=1 | Temporary parameters effective Mysqld--low-priority-updates=1

[IGNORE]

Determine if there is a presence, not inserted, otherwise inserted

[on DUPLICATE KEY UPDATE]

Update field values by key or index

[WHERE Where_condition]

Conditional judgment

[GROUP by]

Group Filter Sort by SELECT Field

[ORDER by]

Field Filter Sort

[LIMIT]

Qualifying Rows | [Offset] Line offset

[ASC | DESC]

ASC Sort Ascending DESC Sort Descending

[Having]

Conditional judgment on GROUP by filtered data

[PROCEDURE]

Stored Procedures

[Sql_cache | Sql_no_cache]

Whether to use the cache

Query_cache_type This can be set to (can only be a number) option meaning

0 (OFF, do not cache or re-get results)

1 (on, cache all results except SELECT Sql_no_cache ... Query

2 (DEMAND, cache only SELECT Sql_cache ... Query)




SELECT Values_to_display

from table_name

WHERE Expression

GROUP by How_to_group

Having expression

ORDER by How_to_sort

LIMIT Row_count

Please refer to the official manual for more details . http://dev.mysql.com/doc/

This article is from the Linux learning blog, so be sure to keep this source http://antman.blog.51cto.com/8497132/1715130

MYSQL-DML Introduction (Beginner)

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.