mysql查看表结构命令
2015-11-02 14:21
661 查看
mysql查看表结构命令,如下:
desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;
use information_schema
select * from columns where table_name='表名';
顺便记下:
show databases;
use 数据库名;
show tables;
原有一unique索引AK_PAS_Name(PAC_Name)在表tb_webparamcounter中,
执行以下sql修改索引
alter table tb_webparamcounter drop index AK_PAS_Name;
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name);
若发现索引的逻辑不对,还需要再加一个字段进去,执行
alter table tb_webparamcounter drop index AK_PAS_Name;
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name,PAC_Value);
注意:这时的PC_ID,PAC_Name,PAC_Value三个字段不是FOREIGN KEY
否则必需先drop FOREIGN KEY,再重做上一步才行
顺便提下oracle
select * from v$database;
select * from all_users;
select * from user_tables;
desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;
use information_schema
select * from columns where table_name='表名';
顺便记下:
show databases;
use 数据库名;
show tables;
原有一unique索引AK_PAS_Name(PAC_Name)在表tb_webparamcounter中,
执行以下sql修改索引
alter table tb_webparamcounter drop index AK_PAS_Name;
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name);
若发现索引的逻辑不对,还需要再加一个字段进去,执行
alter table tb_webparamcounter drop index AK_PAS_Name;
alter table tb_webparamcounter add UNIQUE AK_PAS_Name(PC_ID,PAC_Name,PAC_Value);
注意:这时的PC_ID,PAC_Name,PAC_Value三个字段不是FOREIGN KEY
否则必需先drop FOREIGN KEY,再重做上一步才行
顺便提下oracle
select * from v$database;
select * from all_users;
select * from user_tables;
相关文章推荐
- win7 mysql 免安装版 配置注册问题
- mysqladmin: connect to server at 'localhost' failed
- mysqladmin: connect to server at 'localhost' failed
- MySQl 基本操作
- mysql max_allowed_packet 设置过小导致记录写入失败
- 实现MySQL版的urlencode与urldecode函数
- Ubuntu更改MySQL字符集UTF-8,正确显示中文
- [转]阿里云配置mysql远程连接
- 第十章 MySQL 常用函数
- 显示 metadata lock 信息的 mysql 插件
- mysql分表
- Mysql分库分表
- MyBatis+MySQL 返回插入的主键ID
- PASSION之Mysql集群(二)
- c#读取excel数据,同时存入mysql数据库
- MySQL 5.6 for Windows 解压缩版配置安装
- 【XAMPP】mysql数据库忘记管理员root密码
- mysql分库、分表、分区
- 【xampp】修改mysql默认端口号后无法访问
- mysql 用户表中多个host时的匹配规则