1. SELECT * FROM 表名 WHERE 1 AND [ORDER BY DESC LIMIT]
2. INSERT INTO 表名 (字段列表) VALUES (值列表)
3. UPDATE 表名 SET 字段=值,字段=值 WHERE 1 AND
4. DELETE FROM 表名 WHERE 1 AND
WHERE 条件可用的参数
类别 |
运算符 |
说明 |
比较运算符 |
=,<,>,<=,>=,<> |
比较两个表达式 |
逻辑运算符 |
AND ,OR, NOT |
组合两个表达式的运算结果或取反 |
范围运算符 |
BETWEEN,NOT BETWEEN |
搜索值是否在范围内 |
列表运算符 |
IN,NOT IN |
查询值是否属于列表值之一 |
字符匹配符 |
LIKE ,NOT LIKE |
字符串是否匹配 % _ [] [^] |
未知值 |
IS NULL ,IS NOT NULL |
查询值是否为NU |
SELECT * FROM `adminuser` WHERE 1 and `xingming` like ‘张%‘
SELECT * FROM `adminuser` WHERE 1 and `id` BETWEEN 10 and 20
SELECT * FROM `adminuser` WHERE 1 and `id` in (10,20)