in Database

[MySQL] how to get table information

1. Table 목록 가져오기
SELECT table_name, table_rows, avg_row_length, table_collation
FROM information_schema.`TABLES` T
where table_schema = ‘테이블명’;

2. Table 정보 가져오기
SELECT column_name, column_default, is_nullable, data_type, character_maximum_length,
numeric_precision, numeric_scale, collation_name
FROM information_schema.`COLUMNS` C
where table_schema = ‘스키마명’
and table_name = ‘테이블명’
order by ordinal_position;

Write a Comment

Comment