Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available

Tags:

phpmyadmin

The error generated in phpMyAdmin is:

This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

What does this error message mean and how can I fix it?

like image 430
OldWest Avatar asked Sep 20 '13 17:09

OldWest


People also ask

Why can t edit table in phpMyAdmin?

If there are no unique columns or primary keys, functions such as edit, copy, delete, etc. are prohibited for performance and security reasons, as it can not be guaranteed that there are no multiple entries that can subsequently lead to problems.

How do I edit a table in phpMyAdmin?

Click on the table you wish to modify. Inside the table, you will see a list of columns. To the right of the column name, you will see a link called "Change" under the Actions. Click on the Change link for the column you wish to modify.

How do I set primary key in phpMyAdmin?

Adding a Primary Key to a New Table In phpMyAdmin. When creating a new table in phpMyAdmin, select PRIMARY from the Index dropdown on the column that will be the primary key. Check the box in the A_I column if this will be an auto incrementing key.

How do I edit rows in phpMyAdmin?

After you selected your database & table on the left side, you need to Browse that table (marked yellow). Then you can edit or delete rows. It is even possible to double click a value in a cell to directly edit it (newer versions).


3 Answers

I have been faced with this problem.

The cause is your table doesn't have a primary key field.

And I have a simple solution: Set a field to primary key to specific field that suits your business logic.

For example, I have database thesis_db and field thesis_id, I will press button Primary (key icon) to set thesis_id to become primary key field:

enter image description here

like image 196
Do Nhu Vy Avatar answered Sep 23 '22 09:09

Do Nhu Vy


This is not an error. PhpMyAdmin is just informing you, that there is no unique ID column in your result set. Depending on the type of query you sent, this is the desired behaviour.

It is not MySQL which is saying it needs a unique ID, if any combination of the columns in your result set is unique, the values of those columns can be used in an UPDATE or DELETE query. It is phpMyAdmin which says it does not have enough information to offer you the checkboxes and buttons you will normally see in a result set with unique ID.

like image 37
dr fu manchu Avatar answered Sep 19 '22 09:09

dr fu manchu


Simply create a new column, set the Name to whatever you like, set the Type to INT and check the box that says A_I.

diagram The A_I checkbox stands for AUTO_INCREMENT, which essentially means that sequence numbers are assigned automatically in that new column (see below).

 column1 | column2 | id
-----------------------
 value   | value   | 1
-----------------------
 value   | value   | 2
-----------------------
 value   | value   | 3
-----------------------
 value   | value   | 4

This column essentially acts as a reference for phpMyAdmin to delete rows from. If necessary, click on the unique button for this new column, although this happened automatically for me. After following the above steps, you should no longer have the error message and buttons should appear for editing rows in phpMyAdmin!

like image 21
Isaac Adni Avatar answered Sep 19 '22 09:09

Isaac Adni