Show Tables SQL Command

How to List the Tables in Your MySQL Database

SQL Illustration
 Getty Images

MySQL is open-source relational database management software that website owners and others use to organize and retrieve data from databases. A database consists of one or more tables with several columns, each containing information. In relational databases, the tables can cross-reference one another. If you run a website and use MySQL, you may need to view a complete list of tables in the database.

Using the MySQL Command Line Client

Connect to your web server and log in to your database. Pick the database you want to use if you have more than one. In this example, the database is named "Pizza Store."

$ mysql -u root -p
mysql> USE pizza_store;

Now use the MySQL SHOW TABLES command to list the tables in the chosen database.

mysql> SHOW TABLES;

This command returns a list of all the tables in the chosen database.

MySQL Tips 

  • Every MySQL command ends with a semicolon. If it is missing, the command does not execute.
  • The MySQL command line is not case sensitive, but commands are usually written in uppercase, while tables, databases, usernames, and text are usually in lowercase to make them easier to identify.

When to Use a Database

A database is a structured collection of data. Occasions when a database might come in handy when you are working on your website include:

  • If you have an online store, a database stores the products you sell, the customer information, and the orders.
  • A database for an online forum stores member names, forums, topics, and posts.
  • A blog uses a database to store blog posts, categories, comments, and tags.

Why Use MySQL

  • Because it is open-source software, it is free to everybody.
  • MySQL can be installed on lots of different platforms.
  • MySQL is usually included in most web-hosting packages.
  • It's easy to use.
  • It works well with PHP to add functionality to your website.
Format
mla apa chicago
Your Citation
Bradley, Angela. "Show Tables SQL Command." ThoughtCo, Feb. 12, 2018, thoughtco.com/show-tables-sql-command-2693987. Bradley, Angela. (2018, February 12). Show Tables SQL Command. Retrieved from https://www.thoughtco.com/show-tables-sql-command-2693987 Bradley, Angela. "Show Tables SQL Command." ThoughtCo. https://www.thoughtco.com/show-tables-sql-command-2693987 (accessed May 22, 2018).