DEV Community

Carlos Estrada
Carlos Estrada

Posted on

Get list of tables in mysql

In this post I will share how to get the list of tables in mysql using 2 methods, the first one with the show sentence and the second with the information_schema

1. Using Show sentence

This is pretty straight forward just do the next sql query

-- Select your database
SHOW TABLES;
Enter fullscreen mode Exit fullscreen mode

And then you will get the list of tables.

2. Using the information_schema

For this one we will use the information_schema.

SELECT
  TABLE_NAME
FROM information_schema.tables
WHERE
    TABLE_SCHEMA = 'our_db'
Enter fullscreen mode Exit fullscreen mode

Here the our_db after the TABLE_SCHEMA is the name of our database where we want to get the list of tables.

Top comments (0)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay