I can't get phpmyadmin and MySQL Workbench to allow me to update records in pretty much any view. Any view--even ones without an inner join (which is my ultimate objective)--cannot be edited/updated.
phpmyadmin shows: "Current selection does not contain a unique column. Grid edit, Edit, Copy and Delete features may result in undesired behavior." MySQL Workbench shows: "Read only" in the lower right corner.
(Yes, I know there have been lots of other posts on this topic, but they mostly just link to the MySQL 8 manual, which supposedly defines which views are updatable. But I can't figure out what I'm missing.)
STEPS TO REPRODUCE:
Create a simple table in MySQL 8:
CREATE TABLE `tbl_test` (
`id` int NOT NULL AUTO_INCREMENT,
`name` text,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Enter some data:
INSERT INTO `tobh_gis`.`tbl_test` (`name`) VALUES ('test');
Create a view based solely on this table, which does have a unique column (id)
CREATE VIEW `view_test` AS
select
`tbl_test`.`id` AS `id`,
`tbl_test`.`name` AS `name`
from `tbl_test`;
Try to edit the data (in phpmysqladmin): Head to "browse" and note the warning at the top of the screen
Try to edit the data (in MySQL Workbench): Select the view to edit--there will be a "Read Only" notice in the lower right-hand corner.
Related questions that are close but don't actually say how to create a view that's updatable in phpmysql or MySQL Workbench:
Unable to create an updatable MySql view
Updating MySQL view fails despite being updatable
MySQL Workbench Edit Table Data is read only (not relevant because my example (above) does have a primary key)