zoukankan      html  css  js  c++  java
  • mysql查询表和字段的注释

    1,新建表以及添加表和字段的注释.
       create table t_user(
            ID INT(19) primary key auto_increment  comment '主键',
            NAME VARCHAR(300) comment '姓名',
            CREATE_TIME date comment '创建时间'
        )comment  = '用户信息表';

    2,修改表/字段的注释.
         alter table t_user comment  = '修改后的表注释信息(用户信息表)';
        alter table t_user modify column id int comment '主键ID';
       --注意:字段名和字段类型照写就行

    3,查询数据库所有表的详细信息(包括表的注释).
    use information_schema;
    select * from TABLES where TABLE_SCHEMA='my_db';
    --查询某一张表的
    use information_schema;
    select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME= 'auth_user';

    4,查询一张表的详细信息(包括字段注释,字段名称,类型等).
    use information_schema;
    select * from information_schema.columns where table_schema ='my_db'  and table_name = 'auth_user';

    注:还有一种方式:

    show create table table_name;
    use my_db;
    show full columns from auth_user;

  • 相关阅读:
    vue 虚拟列表
    图片验证
    md5 文件上传
    js中apply方法的使用
    js通过replace()方法配合正则去除空格
    使用bind()方法扩充作用域
    取数组最大最小值得方法
    css穿透点击
    为什么选择器li#id名/li.类名的写法
    子元素与父元素等高
  • 原文地址:https://www.cnblogs.com/JHblogs/p/6862754.html
Copyright © 2011-2022 走看看