
正文
mysql怎么查找表注释 mysql如何查表
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
怎么查看在mysql表中查看表中的注释
MySQL
查看表结构简单命令。
一、简单描述表结构,字段类型desc
tabl_name;
显示表结构,字段类型,主键,是否为空等属性,但不显示外键。
二、查询表中列的注释信息
select
*
from
information_schema.columns
where
table_schema
=
'db'
#表所在数据库
相关问答
Q1: “mysql”表的定义有注释吗?
有的mysql怎么查找表注释,用如下方法mysql怎么查找表注释:
1、创建表的时候写注释
create table test1
(
field_name int comment '字段的注释'
)comment='表的注释'mysql怎么查找表注释;
2、修改表的注释
alter table test1 comment '修改后的表的注释'mysql怎么查找表注释;
3、修改字段的注释
alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行
4、查看表注释的方法
--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
5、查看字段注释的方法
--show
show full columns from test1;
--在元数据的表里面看
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
Q2: 请问在Navicat for mysql 中如何显示一张表中的每个字段的注释呢?
使用Navicat
for
mysql
建表mysql怎么查找表注释的时候mysql怎么查找表注释,点击设计表mysql怎么查找表注释的时候,创建字段mysql怎么查找表注释的最下面mysql怎么查找表注释你可以添加注释,完成以后工具就会自动生成注释。就跟phpMyAdmin一样的。
Q3: mysql怎么查看表结构和注释
MySQL
查看表结构简单命令。
一、简单描述表结构,字段类型desc
tabl_name;
显示表结构,字段类型,主键,是否为空等属性,但不显示外键。
二、查询表中列的注释信息
select
*
from
information_schema.columns
where
table_schema
=
'db'
#表所在数据库
and
table_name
=
'tablename'
;
#你要查的表
三、只查询列名和注释
select
column_name,
column_comment
from
information_schema.columns
where
table_schema
='db'
and
table_name
=
'tablename'
;
四、#查看表的注释
select
table_name,table_comment
from
information_schema.tables
where
table_schema
=
'db'
and
table_name
='tablename'
ps:二~四是在元数据表中查看,我在实际操作中,常常不灵光,不知为什么,有了解的大侠请留印。
五、查看表生成的DDL
show
create
table
table_name;
Q4: mysql查看表注释 sql语句怎么写?
mssql查询:
SELECT so.[id] AS ObjectID,
so.[name] AS ObjectName, so.XType,
(CASE WHEN (LEFT(text, 2) = '/*')
AND (charindex('*/', text) 0) THEN substring([text], 3, patindex('%*/%', text) - 3)
ELSE '' END) AS Comments
FROM syscomments AS sc full join sysobjects AS so ON so.[id] = sc.[id]
WHERE so.[xtype] = 'U' OR so.[xtype] = 'V'
mysql表注释查询:
select table_name,table_comment from information_schema.tables where table_schema = 'image' and table_name ='tableName'
Q5: MySql中怎样给字段、列添加注释?怎样查看字段或列的注释?
在MySQL数据库中,
字段或列的注释是用属性comment来添加。
创建新表的脚本中,
可在字段定义脚本中添加comment属性来添加注释。
示例代码如下:
create table test(
id int not null default 0 comment '用户id'
)
如果是已经建好的表,
也可以用修改字段的命令,然后加上comment属性定义,就可以添加上注释了。
示例代码如下:
alter table test
change column id id int not null default 0 comment '测试表id'
给表的字段或列添加注释已经知道了,
那么如何来查看已有表的所有字段的注释呢?
可以用命令:show full columns from table 来查看,
示例如下:
show full columns from test;
关于mysql怎么查找表注释和mysql如何查表的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。






