|
Home >> FAQs/Tutorials >> MySQL Tutorials
MySQL Tutorial - Show All Indexes of a given Table
By: FYIcenter.com
(Continued from previous topic...)
How To Get a List of Indexes of a Given Table?
If you want to see the index you have just created for an existing table,
you can use the "SHOW INDEX FROM tableName" command to get a list of all indexes
in a given table. The tutorial script below shows you a nice example:
mysql> SHOW INDEX FROM TIP;
+------------+-------------+--------------+-------------+...
| Non_unique | Key_name | Seq_in_index | Column_name |...
+------------+-------------+--------------+-------------+...
| 0 | PRIMARY | 1 | id |...
| 1 | tip_subject | 1 | subject |...
+------------+-------------+--------------+-------------+...
2 rows in set (0.03 sec)
It's interesting to see that there is a default index for the primary key column.
(Continued on next topic...)
- What Are DDL Statements?
- How To Create a New Table?
- What Happens If You No CREATE Privilege in a Database?
- How To Get a List of All Tables in a Database?
- How To Get a List of Columns in an Existing Table?
- How To See the CREATE TABLE Statement of an Existing Table?
- How To Create a New Table by Selecting Rows from Another Table?
- How To Add a New Column to an Existing Table?
- How To Delete an Existing Column in a Table?
- How To Rename an Existing Column in a Table?
- How To Rename an Existing Table?
- How To Drop an Existing Table?
- How To Create an Index for a Given Table?
- How To Get a List of Indexes of a Given Table?
- How To Drop an Existing Index?
- How To Create a New View?
- How To Drop an Existing View?
|