How to list/show tables in MySQL database?

Learn, how to list/show tables in MySQL database?
Submitted by Apurva Mathur, on November 30, 2022

MySQL is simply a database management system, the two terms which are important here is database and management. So, the database is a collection of data, we can assume it is a hard copy file but when it comes to manage the data electronically the database comes into the picture. And, the other term is management which means a way to store that crucial data.

What is Database?

A database is a collection of data, we can assume it is a hard copy file but when it comes to manage the data electronically then the database comes into the picture.

You can consider a database is like a folder where you'll store all your tables and under your tables, you'll have your rows and column

Before listing the tables, it is important to select a database, for this first we will write a USE statement, which will select the database.

To select a database, we can use SQL's USE command.

Syntax:

Follow the given syntax to select (use) a database from the list of multiple databases.

USE DATABASE_NAME;

Example:

MySQL | List/Show tables (1)

In the given picture we have many databases and at a time we can work on only a single database. So, if I want to use the "student" database then I'll simply write,

USE student;
MySQL | List/Show tables (2)

After selecting the database, we will use following command to list down all the tables,

SHOW TABLES from DATABASE_NAME;

Taking the above database as an example, if I want to list down all the tables of the database named as student then in such case my query will be,

SHOW TABLES from students;
MySQL | List/Show tables (3)


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.