- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we use MySQL ALTER TABLE command for adding comments on columns?
We can use ‘COMMENT’ keyword with ALTER TABLE command while modifying the column to add comments on columns. For example if we want to add comment in column ‘id’ of table ‘testing’ then following query will do it −
mysql> ALTER TABLE testing MODIFY id INT COMMENT 'id of employees'; Query OK, 0 rows affected (0.07 sec) Records: 0 Duplicates: 0 Warnings: 0
With following query it can be checked in the comment field of a column.
mysql> Show full columns from testing\G *************************** 1. row *************************** Field: id Type: int(11) Collation: NULL Null: NO Key: PRI Default: 0 Extra: Privileges: select,insert,update,references Comment: id of employees *************************** 2. row *************************** Field: Name Type: varchar(20) Collation: latin1_swedish_ci Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: 2 rows in set (0.05 sec)
- Related Articles
- How can we alter table to add MySQL virtual GENERATED COLUMNS?
- How can we alter table to add MySQL stored GENERATED COLUMNS?
- Can we alter order of columns in MySQL?
- ALTER table by adding AUTOINCREMENT in MySQL?
- What MySQL returns when we remove all the columns from a table by using ALTER TABLE command with DROP keyword?
- How can we add multiple columns, with single command, to an existing MySQL table?
- Set auto increment initial value for MySQL table using ALTER command
- Adding unique constraint to ALTER TABLE in MySQL
- How can we put comments in a column of existing MySQL table?
- How can we set PRIMARY KEY on multiple columns of a MySQL table?
- How can we set PRIMARY KEY on multiple columns of an existing MySQL table?
- Can we use ADD and CHANGE with ALTER Statement in MySQL?
- How can we alter a MySQL stored procedure?
- How can we alter a MySQL stored function?
- Can we use the word user for a MySQL table?

Advertisements