MySQL Learning notes (2/2)

Source: Internet
Author: User

Type of SQL

Ddl/dml/dql/dcl

Data definition Language (DDL): CREATE, DROP, ALTER

Used to define and manage data Objects (libraries, tables, indexes, views), including databases, data tables, and so on. For example: CREATE, DROP, Alter, and so on.

Data manipulation statements (DML): and data records in tables

Used for data that is more contained in database objects, such as INSERT, UPDATE, DELETE statements.

1. Inserting data

INSERT into table name ([Field list]) VALUES (Value list), (Value List 2), (Value List 3)

Characteristics:

    1. If the field list is not given after the table name, the value list must list the values of all fields and must be inserted in the default order in the table
    2. No single or double quotation marks are added to all fields that require the name of the Write field, but all values are suggested to be used as characters
    3. When inserting data, it is best to give the field list, and the value should correspond to the field list, not in the order of the fields in the table

For example:

INSERT Into CATS (pid,name) VALUES (' 2 ', ' J2SC '), (' 2 ', ' J2MC '), (' 2 ', ' EE '), (' 3 ', ' thinkphp ');

2. Modify/Update data

UPDATE table name SET field = ' Value ' [, field 2 = ' value 2 ',...] A condition is a condition that determines the record to be changed.

Specify a lot of bars

For example:

3. Delete data

DELETE from table name [condition]

The condition is: where ...

Data Query Language (DQL)

Used to query the data contained in a database object, it is able to query data of different complexity such as single table query, connection query, nested query, and collection query, and return the data to the client. For example: SELECT statement. (60%)

Data Control statement (DCL)

is the language used to manage the database, including administrative permissions and data changes. Example: Grant/revoke/commit/rollback and other statements

MySQL Learning notes (2/2)

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.