From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Showing indexes

Showing indexes

- If you want a list of the indexes for a specific table, you can use the show index statement. Here, I'm still using the scratch database and when I execute this, we have the indexes from the customer table in the scratch database and you notice that that table has one index and it's the primary key. Its worth noting that the show index statement has several forms. I can say show index or I can say show indexes like this and it works exactly the same. I can also use from, or I can use in and again, it works exactly the same. Any combination of index or indexes in or from, any of these will work the same. If you want a list of all the indexes in all the tables in a database, you can use the statistics table from the information schema database. We do this like this: Say select distinct and table name, index name, from, and the name of the database's information schema and the table names. We'll use a…

Contents