0
EN ENAME      CITY           SALARY        DNO JOIN_DATE
- ---------- ---------- ---------- ---------- ---------
E1 Ashim      Kolkata         10000          1
E2 Kamal      Mumbai          18000          2
E3 Tamal      Chennai          7000          1
E4 Asha       Kolkata          8000          2
E5 Timir      Delhi            7000          1

My attempt:

insert into table2(join_date) 
values('&date'); 

I know that update clause can be be used to update but at a time one row is possible

Are there any query such join_date column can be updated with a single query but for multiple rows?

Aniruddha Paul
  • 119
  • 1
  • 10

2 Answers2

1

you can directly update JOIN_DATE by this query

UPDATE table2 
set JOIN_DATE = date;

or

UPDATE table2 
set JOIN_DATE = date
where JOIN_DATE IS NULL;

date is given by user. such as

UPDATE table2 
set JOIN_DATE = '24-02-2014';
ravi chaudhary
  • 617
  • 4
  • 15
0

UPDATE table2 set JOIN_DATE = date

You need to make sure the date variable is set. A where clause will allow you to choose which row(s) get updated. See here.

Edit for Oracle

Community
  • 1
  • 1
Jake
  • 328
  • 2
  • 14
  • Bro ur query is working but all the rows are getting the same value.but i want to add different values for different rows with such a query that can be used to add different values to the join_date column – Aniruddha Paul Sep 29 '14 at 13:12
  • Updated. You just need to use a where clause. The syntax is in the link. – Jake Sep 29 '14 at 13:15
  • Example `UPDATE table2 set JOIN_DATE = date WHERE EN = 'E1'` – Jake Sep 29 '14 at 13:16