Angus Angus - 1 year ago 44
Python Question

Insert statement at row where MyCol is x

I have 2 columns MyCol and NewCol. MyCol has already been populated, and may have duplicates (it's not the primary key). I need to insert a value y into NewCol at all rows where MyCol = x. I'm stuck here and not sure how to implement this.

Answer Source

This is just an update statement

SET NewCol = Y
WHERE MyCol = x

Why exactly could you not find this in ANY introduction to SQL - book, article, reference, team-mate etc?