2016/05/09 (Database)

Source: Internet
Author: User

Dml:

The statement that adds SQL data to the table is the insert

INSERT into < table name > (column name) values (value list)/increase the properties of the corresponding column

Mull and null values are different in the database

Insert into table name (column name) Select to table column from to table name/copy data

Update table name set Column A = new column A where filter condition/change existing data

If you want to delete data, simply put the value to null

Ignoring where will change all the values of column A in the table

Delete from table name where filter condition/delete row of data or multiple rows

TRUNCATE TABLE name/delete all data directly and cannot be restored

Simple data query (DQL)

All values and null additions in MySQL are null

Projection operation: Select column A from table name

Table prefix name: Select P.name from table name as P

Column Aliases: Select Column A as a from table name as T

Pagination Processing:

Select column A from table name limit start sequence number to return the number of rows that need to be displayed

Where the limit in MySQL represents where the fixed number of rows starts to appear

Draining duplicate data: SELECT DISTINCT column A from table name

Select action:

Select Column name from table name where condition (single condition)

Select column A, column B from table name where condition A and condition B (multi-condition)

Computed columns:

Select column A + column B from table name

Select action:

SELECT * FROM table name where column a=100 is executed when column a=100 is true

Fuzzy query (like):

SELECT * FROM table name where column A like ' condition '

% denotes wildcard character (contains 0 or more characters)

_ indicates that only a single character can be used

Whether the query value in the database is null cannot be =null but uses is null or is not NULL

Sort operation (order by):

SELECT * FROM table name order BY column A/column A in ascending order

SELECT * FROM table name order BY column A desc/column A descending sort

2016/05/09 (Database)

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.