工作中使用到的的MySQL查询语句记录。

1、根据表查询所在数据库
select table_schema from information_schema.tables where table_name ='你要查询的表名(注意要使用大写字母)';
select table_schema from information_schema.tables where table_name =''

查询重复数据
select userYoulunum from UcUser GROUP BY userYoulunum HAVING COUNT(*)>1

筛选数据
SELECT COUNT(1) FROM `usercenter20200530`.`UcUser` WHERE `userFlag` = 'S' AND `userYoulunum` IS NOT NULL;

SELECT COUNT(1) FROM `usercenter20200530`.`UcUserYouluNum` WHERE `useFlag` = '1';

测试,是为了发现错误而执行的过程。当你在一个程序中发现的BUG越多,就代表着——你没发现的BUG就越多。
原文地址:https://www.cnblogs.com/blog12357/p/15179582.html