Sample Header Ad - 728x90

How to alter column to make it primary key when one already exists mysql8?

0 votes
1 answer
1097 views
id | bigint unsigned | NO | PRI | NULL | auto_increment | | title | varchar(255) | NO | | NULL | | | category | varchar(255) | NO | | NULL | | | summary | varchar(10000) | NO | | NULL | | | detail | mediumtext | NO | | NULL | | | created_at | timestamp | YES | | NULL | | | updated_at | timestamp | YES | | NULL | | | image | mediumblob | YES | | NULL | | | image1 | mediumblob | YES | | NULL | | | image3 | mediumblob | YES | | NULL | | | phold | varchar(50) | NO | | NULL | | +------------+-----------------+------+-----+---------+----------------+ I have this database now,I want to make a one-one relationship with with another table with where I use column
( title )
to link specific data. When I run mysql> alter table tours add primary key (id,title); OR mysql> alter table tours add constraint pk_tours primary key (id, title); The error: ERROR 1068 (42000): Multiple primary key defined on both queries. I want another table named itinery where I use to link it with former table with help of volumn title ; I am using mysql 8 with laravel 8. Thanks
Asked by analogbeing (3 rep)
May 6, 2021, 05:33 AM
Last activity: May 6, 2021, 06:48 AM