예, 아래 구문을 사용하여 -
select * from information_schema.tables where table_name=yourTableName;
먼저 테이블을 생성하겠습니다 -
mysql> create table DemoTable1600 -> ( -> StudentId int, -> StudentFirstName varchar(20) -> ); Query OK, 0 rows affected (0.51 sec)
삽입 명령을 사용하여 테이블에 일부 레코드 삽입 -
mysql> insert into DemoTable1600 values(100,'Bob'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1600 values(101,'David'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1600 values(102,'Carol'); Query OK, 1 row affected (0.19 sec)
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)