사용자 도구

사이트 도구


사이드바

기술문서:레퍼런스:쿼리:기본:테이블-컬럼_정보

문서의 이전 판입니다!


테이블/컬럼 정보

최소 지원 버전은 약간의 차이가 있을 수 있습니다.

MySQL/MariaDB

-- MySQL 4.0 이상/MariaDB 5.1 이상
-- 테이블 정보
SELECT
	*
FROM
	information_schema.tables
WHERE
	table_schema = '{데이터베이스}'
ORDER BY
	table_name ASC
;

-- MySQL 4.0 이상/MariaDB 5.1 이상
-- 컬럼 정보
SELECT
	*
FROM
	information_schema.columns
WHERE
	table_schema = '{데이터베이스}' AND table_name = '{테이블}'
ORDER BY
	ordinal_position ASC
;

MSSQL

-- MSSQL 2000 이상
-- 테이블 정보
SELECT
	*
FROM
	sys.tables
ORDER BY
	name ASC
;

-- MSSQL 2000 이상
-- 컬럼 정보
SELECT
	*
FROM
	sys.columns
WHERE
	object_id = '{OBJECT_ID}';
ORDER BY
	column_id ASC
;

Oracle/Tibero

-- Oracle 8i 이상/Tibero 6 이상
-- 테이블 정보
SELECT
	*
FROM
	all_tables
ORDER BY
	table_name ASC
;

-- Oracle 8i 이상/Tibero 6 이상
-- 컬럼 정보
SELECT
	*
FROM
	all_tab_columns
WHERE
	table_name = '{테이블}'
ORDER BY
	column_id ASC
;

PostgreSQL

-- PostgreSQL 7.3 이상
-- 테이블 정보
SELECT
	*
FROM
	information_schema.tables
WHERE
	table_catalog = '{데이터베이스}' AND table_schema = 'public'
ORDER BY
	table_name ASC
;

-- PostgreSQL 7.3 이상
-- 컬럼 정보
SELECT
	*
FROM
	information_schema.columns
WHERE
	table_catalog = '{데이터베이스}' AND table_schema = 'public' AND table_name = '{테이블}'
ORDER BY
	ordinal_position ASC
;