Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update all values in a column with a single Update query?

Tags:

sql

I have a database table where I want to update all values in a column with a single update command. suppose I have a table TEST with having a column CITY,I want to update all values in City column with one value. What is the Query? if city has values like: sydney, brooklyn, manhatton then update command replace all these values with manhatton.

like image 268
Jason Clark Avatar asked Dec 12 '16 04:12

Jason Clark


1 Answers

You can do a blanket UPDATE, specifying no restrictions on which records to update:

UPDATE TEST
SET CITY = 'New Value'
like image 131
Tim Biegeleisen Avatar answered Oct 25 '22 13:10

Tim Biegeleisen