0
Updating Data - SQL
Hi everybody! I've got a question here in this lesson. To update John's salary, we can use the following query: UPDATE Employees SET Salary=5000 WHERE ID=1; We learned that we should NOT forget the WHERE statement, because "If you omit the WHERE clause, all records in the table will be updated!" What if I forgot the WHERE part? Does that mean I have to type all the salaries all over again or is there any way to undo this? Thanks in advance!
3 ответов
+ 2
Backup is good solotion
+ 1
Yes, salary in all rows will be updated. No, you can't undo this, only write data again. But if you will have a backup of database - it's will be very nice!
0
In some database engines you can undo your last 'transaction' with the ROLLBACK command. (Unless autocommit is enabled.)