Programming/Database
SQL Update 사용해보기
휘탱
2017. 6. 14. 23:35
- Update
업데이트 테스트하기 위해 아이템 추가
insert into item value(0, '싸구려 검');
update item
set name = '엄청난 검'
where name = '싸구려 검';
컨트롤 + 엔터로 쿼리를 시전하면!
에러가 발생함.
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.
해결방법
1. 명령어 사용하기
set sql_safe_updates = 1; 기본 값에서 0으로 변경후 업데이트 하기
set sql_safe_updates = 0; 을 선언하면 끝.
2. 옵션 변경하기
set sql_safe_updates = 0;
update item
set name = '엄청난 검'
where name = '싸구려 검';
Update 결과
싸구려 검이 엄청난 검으로 변경됨.
반응형