ALTER TABLE vub_details.detail_raw_sy_univ ADD COLUMN major varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci not NULL DEFAULT null comment '专业' AFTER is_calc;
时间: 2024-04-19 21:29:35 浏览: 87
您想要在vub_details.detail_raw_sy_univ表中添加一个名为major的varchar类型的列,其长度为500,字符集为utf8mb4,排序规则为utf8mb4_unicode_ci。该列不允许为空,并且默认值为null。该列的注释为'专业',并且将被添加在is_calc列之后。
相关问题
帮我将这4条sql合并为一条sql ALTER TABLE user_data_version_backup ADD COLUMN org_path varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '组织路径'; ALTER TABLE user_data_version_backup ADD COLUMN sex char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)'; ALTER TABLE user_data_version_backup ADD COLUMN portrait_url varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '融云小头像URL'; ALTER TABLE user_data_version_backup ADD COLUMN portrait_big_url varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '融云大图头像url';
你可以使用以下语句将这四条 SQL 合并为一条:
```sql
ALTER TABLE user_data_version_backup
ADD COLUMN org_path varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '组织路径',
ADD COLUMN sex char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)',
ADD COLUMN portrait_url varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '融云小头像URL',
ADD COLUMN portrait_big_url varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '融云大图头像url';
```
这样就能一次性添加这四个列到 `user_data_version_backup` 表中。
阅读全文