gpt4 book ai didi

mysql - 如何创建没有主键的 int 列?

转载 作者:行者123 更新时间:2023-11-30 00:05:33 24 4
gpt4 key购买 nike

我在 phpmyadmin 工作,其中有一个包含以下列的 sql 表:

image_id, int(11), AUTO_INCREMENT, Primary key, Unique
image_name, text
photographer, text
collection, text

当我尝试向表中添加一个新的int列时,我想将其称为image_order,我总是最终得到属性:主键和独一无二的

自从我得到不需要的主键后,我做错了什么?我可以以某种方式删除主键以便输入重复的值吗?

最佳答案

如果您的 table 是

create table images
(
image_id int(11) AUTO_INCREMENT Primary key,
image_name text,
photographer text,
collection text
);

然后只需使用它来添加您的列

alter table images
add column image_order int

SQLFiddle demo

关于mysql - 如何创建没有主键的 int 列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24593998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com