0

I want to update a complete column of a table in shortest way possible.

I created a table with attributes

ID(PRIMARY_KEY),NAME,AGE,CITY_ID

, and inserted all the data, but later added a new column named SALARY. Now i have to insert value of SALARY into each tuple without using individual UPDATE statement for each tuple

| ID | NAME   | AGE  | GENDER | OCCUPATIONID | CITYID | salary | class |
|  1 | JON    |   25 | MALE   |            1 |      3 |   NULL |  NULL |
|  2 | SARA   |   20 | FEMALE |            3 |      4 |   NULL |  NULL |
|  3 | VICTOR |   31 | FEMALE |            1 |      3 |   NULL |  NULL |
|  4 | JAINE  |   27 | FEMALE |            1 |      3 |   NULL |  NULL |
|  6 | PRANAV |   20 | MALE   |            5 |      6 |   NULL |  NULL |

this is the table

Brian
  • 117
  • 4

1 Answers1

0

You should create a relational update query to update data to all rows from one table too another. Ref: SQL update from one Table to another based on a ID match