sql 创建表

步骤一:创建数据库并指定字符集

CREATE DATABASE database_name DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

步骤二:选择要操作的数据库

USE database_name;

步骤三:创建表格

-- auto-generated definition
create table i5_xxxxxxxxxxx
(
    id               int auto_increment
        primary key,
    mapping_id       int default 0 not null comment '关联ID',
    json_content     longtext      null,
    is_sync          int default 0 not null,
    last_update_time int default 0 not null,
    constraint i5_xxxxxxxxxx_id_uindex
        unique (mapping_id)
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;

步骤四:查看表有没有成功

show tables;

修改表名称

rename table i5_xxxxx to i5_xxxxx_11;
rename table i5_xxxxx_mapping_json to i5_xxxxx_mapping_json_11;
posted @ 2024-12-23 15:02  Lafite-1820  阅读(2)  评论(0编辑  收藏  举报