write down the sql query?

Table Name : emp1
empid empname
1 bala
2 guna

Table Name : emp2
empid empname
1 <Null>
2 <Null>

Solution : emp1 names are updated in emp2, write a query?

Answers were Sorted based on User's Feedback



write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / dhana

update e2 set e2.empname = e1.empname
from emp2 e2,emp1 e1
where e1.empid = e2.empid

Is This Answer Correct ?    8 Yes 1 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / vidya

update emp2 set empname =e.empname from emp1 e where
e.empid =emp2.empid

Is This Answer Correct ?    1 Yes 1 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / a

Update emp2 set empname = (Select empName from emp1 where
emp2.empid =emp1.empid)

Is This Answer Correct ?    2 Yes 2 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / vicky

update emp2 e2 set e2.empname = (select e1.empname from
emp1 e1 where e2.empid=e1.empid)

Is This Answer Correct ?    0 Yes 0 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / saravanan

update w set w.ename=q.ename from empn1 w,
(select e.ename,e.empid from empn e,empn1 a where
a.empid=e.empid) q where w.empid=q.empid

Is This Answer Correct ?    0 Yes 1 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / rajesh.a

Update e2
set e2.empname=e1.empname
from
emp2 e2 inner join emp1 e1 on e1.empid=e2.empid

Is This Answer Correct ?    0 Yes 1 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / pradip jain

update e2
set e2.name= e1.name
from emp2 e2
join emp1 e1 on e1.id=e2.id

Is This Answer Correct ?    0 Yes 1 No

write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Nam..

Answer / rafi

Insert in to emp2 values as select * from emp1;

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More SQL Server Interview Questions

What are the difficulties faced in cube development? : sql server analysis services, ssas

0 Answers  


How to write a query with an inner join in ms sql server?

0 Answers  


I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration

0 Answers  


What number sorts of privileges are accessible in sql?

0 Answers  


What does sql server mean?

0 Answers  






What types of integrity are enforced by a foreign-key constraint

1 Answers  


What is the difference between char and varchar2 datatype in sql?

0 Answers  


What is the difference between in and exists. Ex: select * from emp where empno in(....) and select * from emp where empno exists(....) What is the difference between a Join and Union and Union and UnionAll.

5 Answers   ABC, Accenture,


How do you maintain database integrity where deletions from one table will automatically cause deletions in another table?

0 Answers  


What is the recursive stored procedure in sql server?

0 Answers  


Tell me what is difference between view and materialized view?

0 Answers  


How to execute the cursor queries with "open" statements?

0 Answers  


Categories