1.查询sjcenter数据库里开头为sj_demo和sj_onlyinv的所有表的总条数 select sum(table_rows) from (select table_name,table_rows from tables where TABLE_SCHEMA = 'sjcenter' order by table_rows desc) as b where b.table_name like 'sj_demo%' or b.table_name like 'sj_onlyinv'
查询所有表名:select t.table_name from user_tables t;查询所有字段名:select t.column_name from user_col_comments t;查询指定表的所有字段名:select t.column_name from user_col_comments t where t.table_name = 'BIZ_DICT_XB';查询指定表的所有字段名和字段说明:select t.column_name, t.column_name from
每个mysql都有一个库information_schema,里面有一张表TABLES存储了所有数据库表的信息,因此,可以从这张表中查看数据库大小和表大小 查询数据库大小 ,),'GB') as data from information_schema.tables where table_schema='esb'; 查询数据库中表大小 ,),'GB') as data from information_schema.tables where table_schema='esb' and tab
1.说明 在做显示数据的时候,一个字段会存那种逗号分割的字符串,那如何去根据逗号分割字符串去查询另一个表的数据呢? 首先我们查看一下需要显示的数据 select * from company where f_id in ('','','') select * from company where f_id in ('210,205,208') 现在我要根据另一张模板表中的一个字段查询他下面的公司,存的是字符串类型 这时 select * from company where f_id in (s
Mysql查询库.表存储量(Size) 1.要查询表所占的容量,就是把表的数据和索引加起来就可以了. SELECT SUM(DATA_LENGTH) + SUM(INDEX_LENGTH) FROM information_schema.tables WHERE table_schema='table_name'; 2.查询所有的数据大小 ), ), 'M') FROM tables; 3.查询某个表的数据 ),),'M') FROM tables WHERE table_schema='dat
MySQL不同数据库之间表的简单同步,实用轻量级数据如下案列展示:例如我现在主库上面有users .tenants两张表需要同步到备库上面主库1.确认主库数据条数 select count(*) from users select count(*) from tenants 2.将数据导出到文件,/data/目录必须具有mysql对应的权限 select * into outfile '/data/users20180205.txt' from users; select * into outf