2

I have table dapartment_dup where I want to update a record when I execute the query it gives me an error

My query is

update department_dup 
set dept_name = null
where dept_no = 'd010';

and the error is

21:17:21 update department_dup set dept_name = null where dept_no = 'd010' Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.000 sec

in the error message, it gives me the path but I can't understand where to reconnect?

Shadow
  • 33,525
  • 10
  • 51
  • 64
Hamza.S
  • 1,319
  • 9
  • 18

1 Answers1

1

In your IDE (probaly mysql Workbench ) You have safe mode enabled .. this mean that you can perform update or delet only using in where condition a column that is the primary key for the row .. In your case dept_no is not the primary key ..

SO if you want use the update code in you question you could disable the safe mode in you mysql Workbench

or add a conditio that involve you primary key column
assuming your primary key column is name your_key_col add AND your_key_col <>

update department_dup 
set dept_name = null
where dept_no = 'd010'
AND   your_key_col<>0;
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107