SQL 문 구 를 사용 하여 MySQL,SQL Server,Oracle 의 모든 데이터베이스 이름과 표 이름,필드 이름 을 조회 합 니 다.

MySQL 에서 모든 데이터베이스 이름과 테이블 이름 조회
모든 데이터베이스 조회

show databases;
지정 한 데이터베이스 의 모든 표 이름 조회

select table_name from information_schema.tables where table_schema='database_name' and table_type='base table';


지정 한 표 의 모든 필드 이름 조회

select column_name from information_schema.columns where table_schema='database_name' and table_name='table_name';


지정 한 표 의 모든 필드 이름과 필드 형식 을 조회 합 니 다.

select column_name,data_type from information_schema.columns where table_schema='database_name' and table_name='table_name';


SQLServer 에서 모든 데이터베이스 이름과 테이블 이름 조회
모든 데이터베이스 조회

select * from sysdatabases;


현재 데이터베이스 의 모든 테이블 이름 조회

select * from sysobjects where xtype='U';
xtype='U':       ,xtype='S':       。


지정 한 표 의 모든 필드 이름 조회

select name from syscolumns where id=Object_Id('table_name');


지정 한 표 의 모든 필드 이름과 필드 형식 을 조회 합 니 다.

select sc.name,st.name from syscolumns sc,systypes st where sc.xtype=st.xtype and sc.id in(select id from sysobjects where xtype='U' and name='table_name');


Oracle 에서 모든 데이터베이스 이름과 테이블 이름 조회
모든 데이터베이스 조회
Oralce 는 라 이브 러 리 이름 이 없고 표 공간 만 있 기 때문에 Oracle 은 데이터베이스 이름 조회 지원 을 제공 하지 않 고 표 공간 이름 조회 만 제공 했다.

select * from v$tablespace;--     (      )


현재 데이터베이스 의 모든 테이블 이름 조회

select * from user_tables;


지정 한 표 의 모든 필드 이름 조회

select column_name from user_tab_columns where table_name = 'table_name';--      


지정 한 표 의 모든 필드 이름과 필드 형식 을 조회 합 니 다.

select column_name, data_type from user_tab_columns where table_name = 'table_name';-
SQL 문 구 를 사용 하여 MySQL,SQL Server,Oracle 의 모든 데이터베이스 이름과 표 이름,필드 이름 의 SQL 문 구 를 조회 합 니 다.간단명료 합 니 다.

좋은 웹페이지 즐겨찾기