mysql连接查询拒绝服务漏洞_MySQL-连接查询
連接查詢
內連接查詢
JOIN/CROSS JOIN/INNER JOIN
通過ON連接
select u.id,u.username,u.email,u.sex,p.proName,COUNT(*) as TOTAL
from provinces AS p
JOIN cms_user AS? u
ON u.proId=p.id
where u.sex='男'
GROUP BY p.proName
HAVING count(*)>=1
ORDER BY u.id ASC;
多表的時候直接加JOIN ON
外連接
左外連接 left join
右外連接 right join
符合條件的查找出來,不符合條件的以NULL替代
select u.id,u.username,COUNT(*) as TOTAL
from provinces AS p
LEFT JOIN cms_user AS? u
ON u.proId=p.id
聯合查詢
union 去掉重復的
union all 簡單合并
select username from cms_user union select username from cms_admin;
子查詢
select id,username from employee where depId not in (select id from department)
使用符號=,>,=,<=,<>,!=,<=>
select id,username from student where score >=(select level from schoship where id=1);
exist/not exist
select id,username from employee where exists(select * from department where id =1)
運算符?? ANY?? SOME?? ALL
>,>=???? 最小? 最小?? 最大
=??????? 任意? 任意
<>,!=???????????????? 任意
將查詢結果寫入數據庫
create table test2(
id tinyint unsigned auto_increment key,
num tinyint unsigned
)select id,score from student;
字段名稱相同時才能賦值。
insert test1(id,num) select id,score from student
正則表達式查詢
關鍵字 regexp'匹配方式'
常用匹配方式
^ 匹配字符開始部分
$ 匹配字符串結尾的部分
. 代表任意一個字符,包括回車和換行
[]匹配字符集合中的任何一個字符
s1|s2|s3 匹配其中的任意一個字符串
* 代表0,1或者多個其前的字符
+ 代表1個或者多個其前的字符
string{N}字符串出現的N次
字符串{M,N}字符串最少出現M次,最多出現N次
select * from cms_admin where username REGEXp '^t';
總結
以上是生活随笔為你收集整理的mysql连接查询拒绝服务漏洞_MySQL-连接查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: fh admin mysql版本_mys
- 下一篇: java 时间轮算法_时间轮算法(Tim