Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add comment to a column in MySQL?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 31.1k
    Comment on it

    Sometimes wee need to add a comment to a column for understanding purpose means to easily identify what is the use of that particular column.

    We can add comment to a column by two ways- at the time of table creation or by ALTER command after creating the table with the help of COMMENT attribute.

    1. At the time of table creation:
    CREATE TABLE `white_words` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `word` varchar(45) DEFAULT NULL COMMENT 'Use column to contain white words.',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    1. After creating table:
    ALTER TABLE white_words CHANGE COLUMN `word` `word` VARCHAR(45) NULL DEFAULT NULL COMMENT 'Use column to contain white words.';
    

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: