首页 > 代码库 > MySQL常用SQL汇总(持续更新)
MySQL常用SQL汇总(持续更新)
自动生成ROWNUN
SELECT (@rowNO := @rowNo+1) AS rowno,a.uuid
FROM (SELECT * FROM h_log_proc) a,(SELECT @rowNO :=0) b
随机取记录
SELECT * FROM (SELECT (@rowNo :=@rowNo+1) AS rowno, pwd FROM pur_admininfo, (SELECT @rowNo := 0) b) tmp WHERE rowno=(SELECT ROUND(RAND() * 10000000 % (SELECT COUNT(*) FROM pur_admininfo))) LIMIT 1
去除水平制表符
#查询
#SELECT * FROM web_h_cus_info WHERE LOCATE(CHAR(10),address)>0;
#去除换行回车符
UPDATE `web_h_cus_info` SET `address` = REPLACE(REPLACE(`address`, CHAR(10),‘‘), CHAR(13),‘‘);
#去除空格
UPDATE `web_h_cus_info` SET `address`=REPLACE(`address`,‘ ‘,‘‘);
#去除水平制表符
UPDATE `web_h_cus_info` SET `address`=REPLACE(`address`,CHAR(9),‘‘);
MySQL常用SQL汇总(持续更新)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。