Command for viewing the MySQL table structure

Source: Internet
Author: User

What command should I use to view the Mysql table structure? The following describes the commands for viewing the Mysql table structure in detail. If you have encountered a similar problem in the Mysql table organization, you may wish to take a look.

Run the following command to view the Mysql table structure:

Desc table name;
Show columns from table name;
Describe table name;
Show create table name;

Use information_schema
Select * from columns where table_name = 'table name ';

By the way:
Show databases;
Use Database Name;
Show tables;

The original unique index AK_PAS_Name (PAC_Name) is in the tb_webparamcounter table,
Run the following SQL statement to modify the index:
Alter table tb_webparamcounter drop index AK_PAS_Name;
Alter table tb_webparamcounter add UNIQUE AK_PAS_Name (PC_ID, PAC_Name );

If you find that the index logic is incorrect, you need to add another field to execute
Alter table tb_webparamcounter drop index AK_PAS_Name;
Alter table tb_webparamcounter add UNIQUE AK_PAS_Name (PC_ID, PAC_Name, PAC_Value );
Note: The PC_ID, PAC_Name, and PAC_Value fields are not FOREIGN keys.
Otherwise, you must first drop foreign key and then redo the previous step.

By the way, oracle
Select * from v $ database;
Select * from all_users;
Select * from user_tables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.