DML:INSERT, DELETE, UPDATE, SELECT正則表達式
INSERT INTO:ide
INSERT [INTO] tbl_name [(col1,...)] {VALUES|VALUE} (val1, ...),(...),... 字符串
注意:it
字符型:引號;io
數值型:不能用引號;table
SELECT:class
(1) SELECT * FROM tbl_name;tab
(2) SELECT col1, col2, ... FROM tbl_name;di
顯示時,字段能夠顯示爲別名;view
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]