Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you see field comments from mysql client?

I would like to see individual fields comments. Typically something I would expect from "describe" parameters.

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    |                | +-------+---------------------+------+-----+---------+----------------+ 
like image 621
MonoThreaded Avatar asked Oct 20 '11 11:10

MonoThreaded


People also ask

How do I show comments in MySQL?

Syntax Using # symbol In MySQL, a comment started with # symbol must be at the end of a line in your SQL statement with a line break after it. This method of commenting can only span a single line within your SQL and must be at the end of the line.

Are there comments in MySQL?

MySQL Server supports three comment styles: From a # character to the end of the line. From a -- sequence to the end of the line. In MySQL, the -- (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on).

What is /* in MySQL?

This is a type of comment. The /* is the beginning of a comment and */ is the end of comment. MySQL will ignore the above comment.

How do I see all information in MySQL?

The first command you will need to use is the SELECT FROM MySQL statement that has the following syntax: SELECT * FROM table_name; This is a basic MySQL query which will tell the script to select all the records from the table_name table.


2 Answers

show full columns from <table_name> 

This is the output:

| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment 

I hope this is useful for you

like image 76
Karl Avatar answered Oct 01 '22 15:10

Karl


This query will give you much more information than the describe statement:

SELECT *  FROM information_schema.columns  WHERE table_name = 'metrics' AND table_schema = '...' -- Optionally, filter the schema as well, to avoid conflicts 
like image 38
Lukas Eder Avatar answered Oct 01 '22 15:10

Lukas Eder