你怎么看mysql客户端的表评论?

Mon*_*ded 21 mysql documentation database-design comments

我想看看各个领域的评论.通常我会从"描述"参数中得到一些东西.

mysql> describe metrics;
+-------+---------------------+------+-----+---------+----------------+
| Field | Type                | Null | Key | Default | Extra          |
+-------+---------------------+------+-----+---------+----------------+
| id    | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| ty    | int(10) unsigned    | NO   |     | NULL    |                |
| t     | bigint(20) unsigned | NO   |     | NULL    |                |
| s     | int(10) unsigned    | NO   |     | 60000   |                |
| e     | int(10) unsigned    | NO   |     | NULL    |                |
| c     | int(10) unsigned    | NO   |     | NULL    |                |
+-------+---------------------+------+-----+---------+----------------+
Run Code Online (Sandbox Code Playgroud)

小智 72

show full columns from <table_name>
Run Code Online (Sandbox Code Playgroud)

这是输出:

| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment
Run Code Online (Sandbox Code Playgroud)

我希望这对你有用

  • 这应该标记为正确的答案. (3认同)

Luk*_*der 12

此查询将为您提供比describe语句更多的信息:

SELECT * 
FROM information_schema.columns 
WHERE table_name = 'metrics'
AND table_schema = '...' -- Optionally, filter the schema as well, to avoid conflicts
Run Code Online (Sandbox Code Playgroud)


Mar*_*cki 7

您可以使用:

show create table <tablename>
Run Code Online (Sandbox Code Playgroud)