代码之家  ›  专栏  ›  技术社区  ›  heymando073

如何对表格进行评论-MariaDB

  •  1
  • heymando073  · 技术社区  · 3 年前

    我一直在尝试对我创建的一个表进行评论 comment = 'this is a comment'

    但它总是会导致错误。我尝试了以下几种方式:

    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)
    );
    

    我该怎么做才能让桌面上的评论生效?

    1 回复  |  直到 3 年前
        1
  •  1
  •   nbk    3 年前

    你可以发表评论 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";
    

    所以在你的情况下

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