-- describe current database
        SELECT 'Tables',COUNT(*)  AS `Count` FROM INFORMATION_SCHEMA.TABLES WHERE table_type='BASE TABLE' AND table_schema=DATABASE()
    Union ALL
        SELECT 'Views',COUNT(*) AS `Count` FROM INFORMATION_SCHEMA.VIEWS WHERE table_schema=DATABASE()
    Union ALL
        SELECT 'Procedures',Count(*) AS `Count` FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_schema=DATABASE() AND routine_type='PROCEDURE'
    Union ALL
        SELECT 'Functions',Count(*) AS `Count` FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_schema=DATABASE() AND routine_type='FUNCTION'
    Union ALL
        SELECT 'Triggers',Count(*) AS `Count` FROM INFORMATION_SCHEMA.`TRIGGERS` WHERE trigger_schema=DATABASE()
    Union ALL
        SELECT 'Events',COUNT(*) AS `Count` FROM INFORMATION_SCHEMA.`EVENTS` WHERE EVENT_SCHEMA=DATABASE()
    ;

-- tables with triggers
    SELECT event_object_table AS `Table`, COUNT(*) AS `Count`
    FROM INFORMATION_SCHEMA.`TRIGGERS` WHERE event_object_schema=DATABASE()
    GROUP BY 1;
-- tables with triggers details
    SELECT event_object_table AS `Table`, CONCAT_WS(' ', action_timing, event_manipulation) AS `Type`, COUNT(*) AS `Count`
    FROM INFORMATION_SCHEMA.`TRIGGERS` WHERE event_object_schema=DATABASE()
    GROUP BY 1,2;
-- tables triggers names
    SELECT event_object_table AS `Table`, group_concat(trigger_name) AS `triggers`
    FROM INFORMATION_SCHEMA.`TRIGGERS` WHERE event_object_schema=DATABASE()
    GROUP BY 1;

-- columns seprated by comas
    SELECT col.table_name, t.table_type, count(*) AS `columns_num`, group_concat(col.column_name  SEPARATOR ', ') AS `columns`
    FROM INFORMATION_SCHEMA.COLUMNS col
        JOIN INFORMATION_SCHEMA.TABLES t ON t.table_name=col.table_name AND t.table_schema=col.table_schema
    WHERE col.table_schema = DATABASE()
    GROUP BY 1,2;

-- rows per table
    -- mysql 8.0
    WITH
      tbl AS (SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type='BASE TABLE' AND table_schema=DATABASE()),
    SELECT table_name,count(*) AS `rows` FROM tbl GROUP BY 1;

