'UPDATE Query without WHERE Clause
Can the UPDATE
query be used without a WHERE
clause? And if so in what conditions?
Solution 1:[1]
if you don't use the WHERE
clause all the records on the table will be affected
Solution 2:[2]
So, I think when you want to update the whole field for some kind of reasons like updating the status of users enrollment to free for all users.
UPDATE users SET status = "free";
Solution 3:[3]
The UPDATE
statement in SQL is used to update records in the table. We can modify one or multiple records (rows) in a table using UPDATE
statement. If you do not use WHERE
clause in UPDATE
statement, all the records in the table will be updated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Massimiliano Peluso |
Solution 2 | Muhammad Junaid |
Solution 3 | Purushothaman Srikanth |