• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

an UPDATE query question.

 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A department entity is in a one to Many relationship with the Employee entity. A developer has been asked to write a query to update the set of employees who are in the department HR by setting their department to null.
Syntax fragments:

Set
e.department.name
('HR')
where
e.department
=null
Employee e
Update
IN

According to me its:
Update Employee e Where ('HR') IN e.department.name Set e.department=null

Please tell me how should the query be formed.
And any links for further learning such query formation would be appreciated.


thanks,
mallika
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Please need Help with this question..

A department entity is in a one to Many relationship with the Employee entity. A developer has been asked to write a query to update the set of employees who are in the department HR by setting their department to null.
Syntax fragments:

Set
e.department.name
('HR')
where
e.department
=null
Employee e
Update
IN

According to me its:
Update Employee e Where ('HR') IN e.department.name Set e.department=null

Please tell me how should the query be formed.
And any links for further learning such query formation would be appreciated.


thanks,
mallika
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[deleted]

I guess its an assignment question.
[ January 04, 2008: Message edited by: Adeel Ansari ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Update Employee e Set e.department=null Where e.department.name IN ('HR')

In is like SQL IN operator which check the specified values are in the right hand side list. The right hand side is usually the Fix set of values.

Where is the optional filtering condition. It should come to the last.

Thanks
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Narendra for the Reply..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic