Is it possible to replace a given string in all columns of a SQLite database using one simple query?
Let's say I have a table with the four columns name, age, income and friends:
+------+-----+--------+---------+
| name | age | income | friends |
+------+-----+--------+---------+
| John | 20 | 10 | 0 |
+------+-----+--------+---------+
| Jane | 25 | 20 | 0 |
+------+-----+--------+---------+
| June | 20 | 40 | 20 |
+------+-----+--------+---------+
And I want to replace all instances of "20" with "40" in the whole table using one simple query. Something like:
UPDATE table SET ALL-COLUMNS = 40 WHERE ALL-COLUMNS = 20
Is this possible to achieve using SQLite? Or do I have to create one query for each column?
UPDATE table SET age = 40 WHERE age = 20
UPDATE table SET income = 40 WHERE income = 20
UPDATE table SET friends = 40 WHERE friends = 20
Aucun commentaire:
Enregistrer un commentaire