mysql5.7查看表结构命令show full columns from t_user
show full columns from t_user; 查看表全部结构。
Key = PRI 主键
Key = UNI 唯一索引
Key = MUL 普通索引
这张表的完整表结构长这样:
CREATE TABLE `t_user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `username` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'user name', `age` int(4) NOT NULL DEFAULT 20 COMMENT 'user age', `birthday_date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'user birthday', `remark` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'remark something', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'create time', `version` int(4) NOT NULL DEFAULT 0 COMMENT 'update version', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `idx_name`(`username`) USING BTREE, INDEX `idx_age_remark`(`age`, `remark`) USING BTREE, INDEX `idx_create_time`(`create_time`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC;
表结构截图:
表索引结构:
end.