[SOLVED] Select a list of keys of a table in MySQL

Issue

Say I have a table “products” and I would like to check if this table has any indexes, foreign keys etc

A “DESCRIBE products” would give some information.

Field        Type           Null    Key    Default   Extra
productCode  varchar(200)   NO      MUL    NULL  
description  varchar(500)   NO             NULL 

Mainly the key field in the case. But defenietly no references and what table is linked to who etc etc.

What is the best way to get such information via SQL about a table?

Thanks

Solution

You can use

SHOW CREATE TABLE products

which gives you the query for creating the table. The most informative.

Answered By – Jai

Answer Checked By – Cary Denson (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *