最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL

来源:懂视网 责编:小采 时间:2020-11-09 19:04:15
文档

Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL

Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL:bitsCN.com desc 表名; show columns from 表名; describe 表名; show create table 表名; use information_schema select * from columns where table_name='表名'; 顺便记下: show databases; 也可以这样 use
推荐度:
导读Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL:bitsCN.com desc 表名; show columns from 表名; describe 表名; show create table 表名; use information_schema select * from columns where table_name='表名'; 顺便记下: show databases; 也可以这样 use

bitsCN.com 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 = ?bitsCN.com

文档

Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL

Mysql中返回一个数据库的所有表名,列名数据类型备注_MySQL:bitsCN.com desc 表名; show columns from 表名; describe 表名; show create table 表名; use information_schema select * from columns where table_name='表名'; 顺便记下: show databases; 也可以这样 use
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top