是的,使用以下语法-
select * from information_schema.tables where table_name=yourTableName;
让我们首先创建一个表-
mysql> create table DemoTable1600 -> ( -> StudentId int, -> StudentFirstName varchar(20) -> );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1600 values(100,'Bob'); mysql> insert into DemoTable1600 values(101,'David'); mysql> insert into DemoTable1600 values(102,'Carol');
使用select语句显示表中的所有记录-
mysql> select * from DemoTable1600;
这将产生以下输出-
+-----------+------------------+ | StudentId | StudentFirstName | +-----------+------------------+ | 100 | Bob | | 101 | David | | 102 | Carol | +-----------+------------------+ 3 rows in set (0.00 sec)
获取某些行或列占用了多少磁盘空间-
mysql> select * from information_schema.tables where table_name='DemoTable1600';
这将产生以下输出
+---------------+--------------+---------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | TABLE_TYPE | ENGINE | VERSION | ROW_FORMAT | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | AUTO_INCREMENT | CREATE_TIME | UPDATE_TIME | CHECK_TIME | TABLE_COLLATION | CHECKSUM | CREATE_OPTIONS | TABLE_COMMENT | +---------------+--------------+---------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------+ | def | web | demotable1600 | BASE TABLE | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | NULL | 2019-10-19 14:34:46 | NULL | NULL | utf8_unicode_ci | NULL | | | +---------------+--------------+---------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------+ 1 row in set (0.00 sec)