mysql学习笔记(6-DML命令)
DML:INSERT, DELETE, UPDATE, SELECT
创新互联公司专业为企业提供广昌网站建设、广昌做网站、广昌网站设计、广昌网站制作等企业网站建设、网页设计与制作、广昌企业网站模板建站服务,十年广昌做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
INSERT INTO:
INSERT [INTO] tbl_name [(col1,...)] {VALUES|VALUE} (val1, ...),(...),...
注意:
字符型:引号;
数值型:不能用引号;
SELECT:
(1) SELECT * FROM tbl_name;
(2) SELECT col1, col2, ... FROM tbl_name;
显示时,字段可以显示为别名;
col_name AS col_alias
(3) SELECT col1, ... FROM tbl_name WHERE clause;
WHERE clause:用于指明挑选条件;
col_name 操作符 value:
age > 30;
操作符(1) :
>, <, >=, <=, ==, !=
组合条件:
and
or
not
操作符(2) :
BETWEEN ... AND ...
LIKE 'PATTERN'
通配符:
%:任意长度的任意字符;
_:任意单个字符;
RLIKE 'PATTERN'
正则表达式对字符串做模式匹配;
IS NULL
IS NOT NULL
(4) SELECT col1, ... FROM tbl_name [WHERE clause] ORDER BY col_name, col_name2, ... [ASC|DESC];
ASC: 升序;
DESC: 降序;
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]
网站题目:mysql学习笔记(6-DML命令)
网页网址:http://azwzsj.com/article/jjsgse.html