Home > Database > Mysql Tutorial > body text

How to query all tables in the database with mysql

WBOY
Release: 2022-04-06 17:15:34
Original
39358 people have browsed it

In mysql, you can use "select table name from information_schema.tables where table_schema=database" to query all tables in the database, and "information_schema.tables" can access database metadata.

How to query all tables in the database with mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How does mysql query all tables in the database

Use the select command to query all table names

The writing method is as follows:

select 表名 from information_schema.tables where table_schema='当前数据库'
Copy after login

How to query all tables in the database with mysql

[INFORMATION_SCHEMA database] comes with MySQL, which provides a way to access database metadata. What is metadata? Metadata is data about the data, such as database name or table name, column data type, or access permissions, etc.

Other terms sometimes used to describe this information include "data dictionary" and "system catalog."

In MySQL, [INFORMATION_SCHEMA] is regarded as a database, or to be precise, an information database. It holds information about all other databases maintained by the MySQL server. Such as database name, database tables, data types and access rights of table columns, etc.

In [INFORMATION_SCHEMA], there are several read-only tables. They are actually views, not base tables, so you won't be able to see any files related to them.

Recommended learning: mysql video tutorial

The above is the detailed content of How to query all tables in the database with mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template