2018. 1. 16. 16:04 IT/MySQL
MySQL 테이블 정보 및 테이블 컬럼 가져오기. 컬럼 합치기.
1 테이블 검색.
select * from INFORMATION_SCHEMA.tables
where table_schema='계정명';
→ show tables;
2. 컬럼 검색.
select * from INFORMATION_SCHEMA.columns
where table_schema='계정명'
and table_name='테이블명'
order by ordinal_position;
→ show full columns from 테이블명;
3. 컬럼명 한줄로 합치기.
select GROUP_CONCAT(column_name, ' ') from INFORMATION_SCHEMA.columns
where table_schema='계정명'
and table_name='테이블명'
show variables like 'group_concat_max_len';
3.2. GROUP_CONCAT size 설정.
SET @@group_concat_max_len = 2048 ;
'IT > MySQL' 카테고리의 다른 글
MyISAM, InnoDB 비교 (0) | 2018.01.30 |
---|---|
MySQL Object(Stored Procedure, Function) 실행시 접근 문제 (0) | 2018.01.17 |
Mysql db_helper (0) | 2017.01.31 |
MySQL 내장 함수. 숫자 함수, 문자 함수. (0) | 2017.01.20 |
Mysql 세자리 콤마 찍기. (0) | 2016.11.16 |