美文网首页
MySQL基础语法

MySQL基础语法

作者: Jinx菜鸟之路 | 来源:发表于2023-07-13 09:23 被阅读0次

    表添加字段

    ALTER TABLE `dmp_sales_forecast`.ims_sales_forecast_demand_plan_order ADD COLUMN `product_desc` VARCHAR ( 200 ) NULL COMMENT '国内物料描述(产品描述)' AFTER `product_name`,LOCK = NONE;

    表&字段信息

    SELECT

    '订单系统',

    t.TABLE_SCHEMA as '库名/SCHEMA',

    t.TABLE_NAME as'表名',

    t.TABLE_COMMENT as '表注释',

    c.COLUMN_NAME as '列名',

    c.COLUMN_COMMENT as '列注释',

    c.COLUMN_DEFAULT as '默认值',

    c.IS_NULLABLE as '是否为空',

    c.COLUMN_TYPE as '列类型',

    c.NUMERIC_PRECISION as '数值精度(最大位数)',

    c.NUMERIC_SCALE as '小数精度',

    c.COLUMN_KEY as '主键',

    c.EXTRA as '额外说明',

    t.TABLE_ROWS

    FROM

    information_schema.TABLES t left join information_schema.`COLUMNS` c on t.TABLE_NAME = c.TABLE_NAME and t.TABLE_SCHEMA = c.TABLE_SCHEMA

    WHERE t.TABLE_SCHEMA='dmp_sales_order' and t.TABLE_ROWS > 0

    order by t.TABLE_NAME, c.COLUMN_NAME;

    相关文章

      网友评论

          本文标题:MySQL基础语法

          本文链接:https://www.haomeiwen.com/subject/gikmudtx.html