Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

21.10. INFORMATION_SCHEMA

21.10.1. 查询表字段

			
SELECT 
    GROUP_CONCAT(COLUMN_NAME) AS fields
FROM
    INFORMATION_SCHEMA.Columns
WHERE
    table_name = 'mytable'
        AND table_schema = 'test';
			
			

21.10.2. 列出所有触发器

			
select trigger_schema, trigger_name, action_statement from information_schema.triggers

select * from information_schema.triggers where information_schema.triggers.trigger_schema like '%test%';			
			
select * from information_schema.triggers where information_schema.triggers.trigger_name like '%trigger_name%' and information_schema.triggers.trigger_schema like '%data_base_name%';			
			
			

21.10.3. 查看表数据尺寸

			
SELECT 
    table_name, data_length
FROM
    information_schema.tables
WHERE
    table_schema = 'netkilller'
ORDER BY data_length DESC
LIMIT 10;