Let me start with reminding what metadata is. Metadata is data about data (see those examples to better understand this concept).
Data in relational databases is stored in structured manner, organized in tables and columns and extended with constraints on the data - primary and unique constraints, foreign keys, check constraints or data types. All those rules defined in a database are called database schema.
In case of relational databases metadata refers to information on their schema and all the other information regarding access, storage, built in programs or any other information about database elements or usage.
Typical metadata in databases
- Foreign keys
- User defined functions
- Stored procedures
- User groups
- Size of tables and indexes in KBs
- Number of rows in tables
- Connection history
- Query history
Most popular databases provide access to their metadata with a set of tables or views often called system catalog or data dictionary. Many of them implement or standard information schema. You can access those views using plain SQL.