In MySQL, to update a table in the default safe mode, one needs to update by use of a `WHERE` and a `KEY`.
How does one update a whole table?
I've used the following
set char_fld="HI",vchar_fld="Thiis is ok!"
where `pk_fld` is the `PRIMARY KEY` of `string_tbl`.
Is this a proper way to do it? Or may I encounter some problems in the near future?
Yes that is the 'proper' way to do it, or (better) simply turn off safe mode temporarily:
SET SQL_SAFE_UPDATES = 0;
update string_tbl set char_fld="HI",vchar_fld="Thiis is ok!";
SET SQL_SAFE_UPDATES = 1;
From [the manual](https://dev.mysql.com/doc/refman/8.0/en/mysql-tips.html#safe-updates):
> Enabling `sql_safe_updates` causes `UPDATE` and `DELETE` statements to produce an error if they do not specify a key constraint in the WHERE clause, or provide a LIMIT clause, or both.
> For beginners, a useful startup option is `--safe-updates` (or `--i-am-a-dummy`, which has the same effect). Safe-updates mode is helpful for cases when you might have issued an `UPDATE` or `DELETE` statement but forgotten the `WHERE` clause indicating which rows to modify.
Perhaps it would be better to disable safe mode entirely and live with the discipline of not forgetting your `where` clauses — that's hardly the only foot-gun you could shoot yourself with anyway!