手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >Mysql中返回一个数据库的所有表名,列名数据类型备注
Mysql中返回一个数据库的所有表名,列名数据类型备注
摘要:desc表名;showcolumnsfrom表名;describe表名;showcreatetable表名;useinformation_s...

desc 表名;

show columns from 表名;

describe 表名;

show create table 表名;

use information_schema

select * from columns where table_name='表名';

顺便记下:

show databases;

也可以这样

use information_schema

select table_schema,table_name from tables where table_schema='数据库名'

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,再重做上一步才行

获取列名数据类型备注

SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT FROM information_schema.columns WHERE table_name = ?

【Mysql中返回一个数据库的所有表名,列名数据类型备注】相关文章:

Mysql数据库中对表操作sql语句总结

让MySQL支持中文排序的实现方法

SQLServer 2005 自动备份数据库的方法分享(附图解教程)

虚拟主机MySQL数据库的备份与还原的方法

MySQL 数据库优化的具体方法说明

VMware中Linux共享mysql数据库的方法

mysql数据库replace、regexp的用法

mysql中取字符串中的数字的语句

MySQL中几个常用的数据库操作函数

mysql mysqldump只导出表结构或只导出数据的实现方法

精品推荐
分类导航