The COMMENT clause
All database components (and database themselves) should have a
COMMENT clause in their
ALTER statements, and a
*_COMMENT column in the information_schema. For
CREATE PROCEDURE do_nothing() COMMENT 'We''re lazy. Let''s do nothing!' BEGIN DO NULL; END;
SELECT ROUTINE_COMMENT FROM information_schema.ROUTINES;
In fact most database objects have those clauses in MySQL/MariaDB, but not all. Views are an exception.
Comments in code
MariaDB and MySQL have multiple syntaxes for comments. Including executable comments (commented code that is only executed on some MySQL/MariaDB versions).
One can use comments in stored procedures and triggers, and those codes are preserved:
CREATE PROCEDURE do_nothing() BEGIN -- We're lazy. …