# Always write a SELECT WHERE query first
Wed Nov 10 2021
Here's a tip a mentor of mine once gave me: if you're ever going to do a SQL
UPDATE
in production, write a SELECT ... WHERE
query first.
Why? If you start typing UPDATE <table> ...
and you forget to add the WHERE
part or your WHERE
conditions are too broad, you're in big trouble.
Instead, first write out your SELECT ... WHERE
query, check the results are
what you expect them to be and only then go back and modify the first part of
your query to be an UPDATE
.
Newsletter
If you'd like to subscribe to my blog, please enter your details below. You can unsubscribe at any time.