티스토리 뷰

Skill/postgreSQL

postgresql] column명과 type조회

진열사랑 2024. 9. 20. 11:27

select C.table_name
,C.column_name
,C.data_type
,C.numeric_precision
,C.numeric_scale
,PD.DESCRIPTION
from INFORMATION_SCHEMA.COLUMNS C
, PG_STAT_USER_TABLES PS
, PG_DESCRIPTION PD
, PG_ATTRIBUTE PA
WHERE 1=1
AND PS.SCHEMANAME IN ('sppdb', 'spsdb')
AND PS.RELID = PD.OBJOID
AND PD.OBJSUBID != 0
AND PD.OBJOID = PA.ATTRELID
AND PD.OBJSUBID = PA.ATTNUM
AND C.TABLE_NAME = PS.RELNAME
AND C.COLUMN_NAME = PA.ATTNAME
and (C.column_name like '%fee%'
or C.column_name like '%amount%'
or C.column_name like '%vat%')
and C.numeric_precision < 10

'Skill > postgreSQL' 카테고리의 다른 글

postgresql CTE  (0) 2024.10.11
PostgreSQL) Sequence 생성, 활용, 초기화  (0) 2024.10.07
postgresql DDL  (0) 2024.08.23
postgresql 목록 갯수  (0) 2024.08.22
postgresql 집계함수 사용  (0) 2024.04.03
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함