Home > Database > Mysql Tutorial > MySQL查看表结构的实际操作命令简介

MySQL查看表结构的实际操作命令简介

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:09:32
Original
1084 people have browsed it

以下的文章主要是对MySQL查看表结构的实际操作命令的实际操作步骤的描述,下面就是其具体方案的详细解析,希望在你今后的MySQL查看表结构的实际操作命令学习中会在所帮助。以下就是正文的主要内容描述。 如下: desc表名; showcolumnsfrom表名; describe表名;

以下的文章主要是对MySQL查看表结构的实际操作命令的实际操作步骤的描述,下面就是其具体方案的详细解析,希望在你今后的MySQL查看表结构的实际操作命令学习中会在所帮助。以下就是正文的主要内容描述。

如下:

<ol class="dp-xml">
<li class="alt"><span><span>desc 表名;  </span></span></li>
<li><span>show columns from 表名;  </span></li>
<li class="alt"><span>describe 表名;  </span></li>
<li><span>show create table 表名;  </span></li>
<li class="alt"><span>use information_schema  </span></li>
<li>
<span>select * from columns where </span><span class="attribute">table_name</span><span>=</span><span class="attribute-value">'表名'</span><span>;  </span>
</li>
</ol>
Copy after login

顺便记下:

<ol class="dp-xml"><li class="alt"><span><span>show databases; </span></span></li></ol>
Copy after login

use 数据库名;

<ol class="dp-xml"><li class="alt"><span><span>show tables; </span></span></li></ol>
Copy after login

MySQL查看表结构命令:原有一 unique索引AK_PAS_Name(PAC_Name)在表tb_webparamcounter中,执行以下sql修改索引

<ol class="dp-xml">
<li class="alt"><span><span>alter table tb_webparamcounter drop index AK_PAS_Name;  </span></span></li>
<li><span>alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name); </span></li>
</ol><br>
Copy after login

若发现索引的逻辑不对,还需要再加一个字段进去,执行

注意:这时的PC_ID,PAC_Name,PAC_Value 三个字段不是FOREIGN KEY否则必需先drop FOREIGN KEY,再重做上一步才行

查看存储过程;

<ol class="dp-xml"><li class="alt"><span><span>show procedure status; </span></span></li></ol>
Copy after login

顺便提下oracle

 

<ol class="dp-xml">
<li class="alt"><span><span>select * from v$database;  </span></span></li>
<li><span>select * from all_users;  </span></li>
<li class="alt"><span>select * from user_tables;  </span></li>
</ol>
Copy after login

以上的相关内容就是对MySQL查看表结构命令的介绍,望你能有所收获。


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template