Updating table in oracle
To update this single row I can run the following UPDATE statement: the UPDATE statement was able to find the one row in my Toy table that had the misspelled Toy Name.To update the row that was found I used the “SET” clause of the UPDATE statement, which set the new Toy Name to the correct spelling of “Magic Wand”.
Suppose I wanted to change all the prices of my Toys with a single UPDATE statement.
In my first TSQL script above, when I create the TOY table, there is typo in the first Toy Name.
I created a Toy Name of “Magic Wnd” when it should have been “Magic Wand”.
If you are not exactly sure what rows will be returned by your WHERE clause of an UPDATE statement, it best to take some precautions prior to executing your UPDATE statement.
What I like to do is to first execute a SELECT statement that contains the I plan to use in my WHERE clause of my UPDATE statement.
I say random rows because TSQL doesn’t guarantee order unless you have an order by clause.