Angus Angus - 4 months ago 8
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

This is just an update statement

UPDATE TABLENAME
SET NewCol = Y
WHERE MyCol = x

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