MySQL Update Query using a left join

后端 未结 4 1002
一生所求
一生所求 2020-12-06 04:37

Table Schema

Table Name: file_manager_folder

Rows: id , parentId, name

My query

4条回答
  •  时光取名叫无心
    2020-12-06 05:13

    I think this should be solved using a unique constraint/index on the parentid and name columns. Otherwise, anyone with INSERT/UPDATE access to the table can circumvent your business rule.

    CREATE UNIQUE INDEX blah_uk ON FILE_MANAGER_FOLDER(parentId, name) USING BTREE
    

提交回复
热议问题