Uncategorized

MySQL Database Metadata

MySQL Database Metadata

Database Metadata is basically ‘data about data’. Relational databases store data in the form of tables. Some examples of MySQL relational database metadata are as follows:

  • Information about tables in a database, table names, table size, etc.
  • Information about columns in the tables, keys like primary key, foreign keys, indexes, etc
  • Information about other database objects like stored procedures, triggers, etc.

Obtain Metadata

MySQL server offers two methods for obtaining the database metadata.

  • SHOW statements
  • INFORMATION_SCHEMA

The SHOW statements are standard MySQL-only feature. The SHOW statements require different statements for retrieving various metadata.

For example, to get the columns and the data types of columns in a table, we can use the following SHOW statement:

mysql> SHOW COLUMNS FROM City;

 

Get Database Metadata Show Columns

SHOW statements are more concise and are easier to remember.

INFORMATION_SCHEMA

INFORMATION_SCHEMA is a set of metadata usually referred to as database catalog. This is an information database that stores information about other databases on the MySQL server.

This database contains several read-only system views. To know more information about the schema:

https://www.testingdocs.com/mysql-information_schema-database/

 

—

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/