查询类:
1.条件查询
使用逻辑查询 and or No
逻辑判断 大于(>) 小于(<) 等于(=) 大于等于(>=) 小于等于(<=)
2.模糊查询
使用like
selsect * from A where A.Key like "%S%" (s是要模糊查询的条件)
selsect * from A where A.Key like "S%" (查询以s开始的 模糊查询的条件)
使用--
selsect * from A where A.Key like "__" (__表示需要查询的长度)
selsect * from A where A.Key like "__%" (长度至少为2的)
使用rlike
select * from A where A.Key rlike “^S.*” (查询以S开始的)
select * from A where A.Key rlike "^s.*m$" (查询以s开始m结束的)
3.连接查询
select * from A inner join B (从A开始 每一个和B的所有表一次)
select * from A inner join B on A.Key=B.Key where “查询条件” (查询A.Key等于B.Key的 如果A.key和B.Key不相同 那就不查询不到)
select A.* from A left join B on A.Key=B.Key (查询A.Key等于B.Key的 如果A.key和B.Key不相同 则B的对应属性为null)
select A.* from A left join B on A.Key=B.Key (查询A.Key等于B.Key的 如果A.key和B.Key不相同 则A的对应属性为null)
select A.* from A left join B on A.Key=B.Key having A.Key="x" (查询A.Key等于B.Key的 如果A.key和B.Key不相同 则B的对应属性为null 的结果中A.Key为x的)