문서의 이전 판입니다!
-- MySQL 5.0.1 이상/MariaDB 5.1 이상
-- 테이블 정보
SELECT
*
FROM
information_schema.tables
WHERE
table_schema = '{데이터베이스}'
ORDER BY
table_name ASC
;
-- MySQL 5.0.1 이상/MariaDB 5.1 이상
-- 컬럼 정보
SELECT
*
FROM
information_schema.columns
WHERE
table_schema = '{데이터베이스}' AND table_name = '{테이블}'
ORDER BY
ordinal_position ASC
;
-- MSSQL 2005 이상
-- 테이블 정보
SELECT
*
FROM
sys.tables
ORDER BY
name ASC
;
-- MSSQL 2005 이상
-- 컬럼 정보
SELECT
*
FROM
sys.columns
WHERE
object_id = OBJECT_ID('{테이블}')
ORDER BY
column_id ASC
;
-- Oracle 8i 이상/Tibero 4 이상
-- 테이블 정보
SELECT
*
FROM
all_tables
ORDER BY
table_name ASC
;
-- Oracle 8i 이상/Tibero 4 이상
-- 컬럼 정보
SELECT
*
FROM
all_tab_columns
WHERE
table_name = '{테이블}'
ORDER BY
column_id ASC
;
-- PostgreSQL 7.4 이상
-- 테이블 정보
SELECT
*
FROM
information_schema.tables
WHERE
table_catalog = '{데이터베이스}' AND table_schema = 'public'
ORDER BY
table_name ASC
;
-- PostgreSQL 7.4 이상
-- 컬럼 정보
SELECT
*
FROM
information_schema.columns
WHERE
table_catalog = '{데이터베이스}' AND table_name = '{테이블}' AND table_schema = 'public'
ORDER BY
ordinal_position ASC
;