mysql—查询数据库表的数量】的更多相关文章

1.查看数据库表数量SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='dbname';  2.获取mysql下所有数据库表的数量 SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES GROUP BY table_schema; 3.获取指定数据库的表的数量 SELECT COUNT(*) TABLES, tabl…
本文转载自:http://hi.baidu.com/ajyajyajy/item/4e2a7f4dc83393d2c1a592c1 use DBNAMEgoselect * from sysobjects where xtype='U'; --这是查询所有表的信息select count(*) from sysobjects where xtype='U' --这是查询表的数量 ‍select a.name, b.rows from sysobjects a with(nolock) join…
一.查询所有数据库占用空间大小 SELECT TABLE_SCHEMA, CONCAT( TRUNCATE(SUM(data_length) / 1024 / 1024, 2), ' MB' ) AS data_size, CONCAT( TRUNCATE(SUM(index_length) / 1024 / 1024, 2), 'MB' ) AS index_size FROM information_schema.tables GROUP BY TABLE_SCHEMA ORDER BY d…
查询数据库的占用 SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB') AS 'Total Index Size' , CONCAT(ROUND(SUM(data_length)/(1024*1024), 2), ' MB') AS 'Total Data Size' FROM information_schema.TABLES where  table_schema like 'edb_a%' ; 查询表的占用 SELECT…
#======================================================================= #查询表信息 select table_name, table_comment, create_time, update_time from information_schema.tables where table_schema = (select database()); #=====================================…
1. mysql> describe tmp_log; +----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+----------------+ | id | int(20) unsigned | NO |…
1.建表语句sys_user CREATE TABLE `sys_user` ( `id` varchar(32) NOT NULL COMMENT '编号', `dept_id` varchar(32) DEFAULT NULL COMMENT '部门', `login_name` varchar(50) NOT NULL COMMENT '登录名', `password` varchar(100) NOT NULL COMMENT '密码', `salt` varchar(20) NOT N…
最近要查询一些数据库的基本情况,由于以前用oracle数据库比较多,现在换了MySQL数据库,就整理了一部分语句记录下来. 1.查询数据库表数量 #查询MySQL服务中数据库表数据量 SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES GROUP BY table_schema; #查询指定数据库表数量 SELECT COUNT(*) TABLES, table_schema FROM information_s…
MySQL查询数据表中数据记录(包括多表查询) 在MySQL中创建数据库的目的是为了使用其中的数据. 使用select查询语句可以从数据库中把数据查询出来. select语句的语法格式如下: select selection_list // 要查询的内容,选择哪些列 from table_list // 从什么表中查询,从何处选择行 where primary_constraint // 查询时需要满足的条件,行必须满足的条件 group by grouping_columns // 如何对结果…
本文介绍MySQL查看数据库表容量大小的命令语句,提供完整查询语句及实例,方便大家学习使用. 1.查看所有数据库容量大小 select table_schema as '数据库', sum(table_rows) as '记录数', , )) as '数据容量(MB)', , )) as '索引容量(MB)' from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index…