Home > OS >  How can I comment on a table - MariaDB
How can I comment on a table - MariaDB

Time:04-24

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?

CodePudding user response:

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';
  • Related