반응형
SELECT
t1.table_name '테이블이름',
t1.table_comment '테이블설명',
column_name '칼럼',
column_type '칼럼타입',
CASE
WHEN column_key='PRI'
THEN 'Primary key'
WHEN column_key='UNI'
THEN 'Unique key'
WHEN column_key='MUL'
THEN 'Multiple'
ELSE '-'
END AS 키설정,
is_nullable 'NULL허용여부',
column_default '기본값',
extra '자동여부',
column_comment '칼럼설명'
FROM
(SELECT
table_name,
table_comment
FROM
information_schema.TABLES
WHERE table_schema = 'ireadingapi') t1,
(SELECT
table_name,
column_name,
data_type,
column_type,
column_key,
is_nullable,
column_default,
extra,
column_comment,
ordinal_position
FROM
information_schema.COLUMNS
WHERE table_schema = 'ireadingapi') t2
WHERE
t1.table_name = t2.table_name
ORDER BY
t1.table_name DESC, ordinal_position ASC
'Database' 카테고리의 다른 글
[MySQL/mariaDB] 구분자로 잘라서 행으로 반환하자. (feat. json_table()) (1) | 2022.05.20 |
---|---|
ORACLE connection leak 체크 쿼리 (0) | 2021.12.31 |
ORACLE 데이터 복구 ( as of timestamp 활용 ) (0) | 2021.12.31 |
ORACLE 테이블 명세 쿼리 (0) | 2021.12.31 |
MySQL 서브쿼리 subquery 성능이슈 (0) | 2021.12.30 |
댓글