Basic operation and basic form of mysql-common data

Source: Internet
Author: User

    • First, Introduction
    • Inserting data Insert
    • Third, update data updates
    • Iv. Deleting data Delete
    • Five, query data select
    • VI. Rights Management
First, Introduction

MySQL Data manipulation: DML

========================================================

In MySQL management software, you can use the DML language in SQL statements to implement data manipulation, including

    1. Inserting data by using insert
    2. Update to implement data updates
    3. Using Delete to implement data deletion
    4. Use Select to query data and.

========================================================

This section includes the following:

Inserting data
Update data
Delete data
Querying data

Inserting data Insert
1. Insert full data (sequential insert)    syntax One:    insert into table name (Field 1, Field 2, Field 3 ...) field N) VALUES (value 1, value 2, value 3 ...) Value n);    Syntax two:    INSERT into table name values (value 1, value 2, value 3 ...) Value n); 2. Specify field Insert data    syntax:    insert INTO table name (Field 1, Field 2, Field 3 ...) Values (value 1, value 2, value 3 ...); 3. Insert multiple record    syntax:    insert INTO table name values        (value 1, value 2, value 3 ...) Value n),        (value 1, value 2, value 3 ...) Value n),        (value 1, value 2, value 3 ...) Value n);        4. Insert query result    syntax:    insert INTO table name (Field 1, Field 2, Field 3 ...) Field N)                     SELECT (Field 1, Field 2, Field 3 ...) field N) from table 2                    WHERE ...;
Third, update data updates
Syntax:    Update table name set        field 1= value 1,        field 2= value 2,        where CONDITION; example:    update mysql.user set password= Password (' 123 ')         where user= ' root ' and host= ' localhost ';
Iv. Deleting data Delete
Syntax:    delete from table name         where conition; Example:    delete from Mysql.user         where password= ';
Five, query data select

Single-table query: http://www.cnblogs.com/ManyQian/p/9026285.html

Multi-table query: http://www.cnblogs.com/ManyQian/p/9026606.html

VI. Rights Management

#授权表user #该表放行的权限 for: All data, all tables under all libraries, and all the fields under the table db #该表放行的权限, for: a database, all tables under that database, and all the fields under the table Tables_priv #该表放行的权限. For: A table, and all fields under the table Columns_priv #该表放行的权限, for: A field # interpreted by the figure: User: Release db1,db2 and all of the db it contains: Release DB1, and all Tables_priv that DB1 contains: Release Db1.table1, and all columns_prive included in the table: Release Db1.table1.column1, release the field only

PS: Specific operation, subsequent updates ...

Basic operation and basic form of mysql-common data

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.