java2db

Update column values of a table with sql



Update  column  or columns of a record , is one of the most frequent operations  in the real time. For each and every browser actions of a enterprise application , it is require to INSERT or UPDATE or DELETE the records from the database table.

Update column values of a table with sql Update column with WHERE clause :

To update column / columns a specific record/records  use WHERE clause with conditions.

Update column values of a table with sql Syntax:

UPDATE table_name SET column_1 = value ,column_2 = value ,.. WHERE condition/conditions ;

Update column values of a table with sql Example sql statement :

In the below table , the initial E_SALARY is ‘10000’  . Now we are updating the E_SALARY to ‘15000’  with the  UPDATE sql  statement.

 

E_NO
E_NAME
E_GENDER
E_SALARY
E_ADDRESS
E_JOIN_DATE
E_IN_TIME
1 Rose S F 10000 street10,xxx,UK 03-MAR-13 10-MAR-13 12.10.10.0
2 Tom M 15000 street11,xxx,UK 04-MAY-13 12-MAY-13 12.10.10.0

 

After the query execution  , E_SALARY value of ‘Rose S’ updated to ‘15000’ .So the result will be look like this.

 

E_NO
E_NAME
E_GENDER
E_SALARY
E_ADDRESS
E_JOIN_DATE
E_IN_TIME
1 Rose S F 15000 street10,xxx,UK 03-MAR-13 10-MAR-13 12.10.10.0
2 Tom M 15000 street11,xxx,UK 04-MAY-13 12-MAY-13 12.10.10.0

 

Update column values of a table with sql Update column without WHERE clause :

To update the column / columns of  all records , use the UPDATE sql statement without WHERE clause .

Update column values of a table with sql syntax :

UPDATE table_name SET column_1 = value ,column_2 = value ,.. ;

Update column values of a table with sql Example sql statement:

The above sql statement updates entire table records with ‘E_SALARY=15000′ and E_NAME=Rose S ‘ .

 

E_NO
E_NAME
E_GENDER
E_SALARY
E_ADDRESS
E_JOIN_DATE
E_IN_TIME
1 Rose S F 15000 street10,xxx,UK 03-MAR-13 10-MAR-13 12.10.10.0
2 Rose S M 15000 street11,xxx,UK 04-MAY-13 12-MAY-13 12.10.10.0



Related Posts :
Sql FOREIGN KEY constraint on table column
Sql CHECK constraint on table column
Sql NOT NULL constraint on table column
Sql UNIQUE constraint on table column
Sql PRIMARY KEY constraint on table column
Sql full outer join on tables with an example
Sql right outer join on tables with an example
Sql left outer join on tables with an example
   [will not be published]



^ <