MySQL Learning Note (6-dml command)

Source: Internet
Author: User

Dml:insert, DELETE, UPDATE, SELECT

INSERT into:

INSERT [into] tbl_name [(col1,...)] {values| VALUE} (Val1, ...), (...),...

Attention:

Character type: quotation marks;

Numeric type: cannot use quotation marks;

SELECT:

(1) SELECT * from Tbl_name;

(2) SELECT col1, col2, ... from Tbl_name;

When displayed, the field can be displayed as an alias;

Col_name as Col_alias

(3) SELECT col1, ... from Tbl_name WHERE clause;

WHERE clause: Used to specify the selection criteria;

Col_name operator Value:

Age > 30;

Operator (1):

, <, >=, <=, = =,! =

Combination conditions:

and

Or

Not

Operator (2):

Between ... And ...

Like ' PATTERN '

Wildcard characters:

%: Any character of any length;

_: any single character;

Rlike ' PATTERN '

The regular expression matches the string pattern;

Is NULL

is not NULL

(4) SELECT col1, ...  from Tbl_name [WHERE clause] ORDER by col_name, Col_name2, ... [asc| DESC];

ASC: Ascending;

Desc: Descending;

DELETE:

DELETE from Tbl_name [WHERE where_condition] [ORDER by ...]        [LIMIT Row_count] (1) DELETE from Tbl_name WHERE where_condition

(2) DELETE from Tbl_name [ORDER by ...] [LIMIT Row_count]

UPDATE:

UPDATE [low_priority] [IGNORE] table_reference SET col_name1=value1 [, Col_name2=value2] ...  [WHERE Where_condition] [ORDER by ...] [LIMIT Row_count]


This article is from the "Wang Liming" blog, make sure to keep this source http://afterdawn.blog.51cto.com/7503144/1925921

MySQL Learning Note (6-dml command)

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.