Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I comment on a table - MariaDB

Tags:

sql

mysql

mariadb

I have been trying to comment on a table I have created with comment = 'this is a comment'

But it always results in an error. I have tried placing it in the following ways:

create table info comment = 'this is a comment about table info' (
...
); 
create table info (
places varchar(15) not null,
solar_system varchar(20),
primary key (places),
comment = 'this is a comment about table info'
);
create table info (
places varchar(15) not null,
solar_system varchar(20),
comment = 'this is a comment about table info',
primary key (places)
);
create table info (comment = 'this is a comment about table info',
places varchar(15) not null,
solar_system varchar(20),
primary key (places)
);

What should I do for the comment on the table to work?


1 Answers

you can comment columns and tables

CREATE TABLE example (
  example_column INT COMMENT "This is an example column",
  another_column2 VARCHAR(100) COMMENT "One more column"
) COMMENT="This is a comment about table";

so in your case

create table info (
    places varchar(15) not null,
    solar_system varchar(20),
    primary key (places)
) comment = 'this is a comment about table info';
like image 194
nbk Avatar answered Nov 29 '25 16:11

nbk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!