Solution to second query:

SQL> SELECT * FROM emp;

     EMPID      MGRID     SALARY NAME
---------- ---------- ---------- ----------
         1                  1000 A
         2          1        500 B
         3          1       1500 C

SQL> SELECT *
  2  FROM emp e1
  3  WHERE mgrid IS NOT NULL
  4  AND salary > (     SELECT salary
  5             FROM emp e2
  6             WHERE e2.empid = e1.mgrid);

     EMPID      MGRID     SALARY NAME
---------- ---------- ---------- ----------
         3          1       1500 C

Regards
Naveen

-----Original Message-----
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 10:39 AM
To: Multiple recipients of list ORACLE-L


Hi List,

I need the queries for the following requirements.  Can anybody help me
please?

1.  A table has two columns "Code" and "Type".  Form a query to swap the
values of these columns.

2.  A table contains empid, salary, mgr_id.   Form a query to select the
employees who have the salary more than their manager's salary.  And if the
mgr_id is null then that record should not be selected.

Thanks and Regards,

Ranganath
WARNING: The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee.  Access to this message
by anyone else is unauthorised.  If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in
error. Thank you.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Krishnaswamy, Ranganath
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. 
Before opening attachments please check them for viruses and defects. MindTree 
Consulting Private Limited (MindTree) will not be responsible for any viruses or 
defects or any forwarded attachments emanating either from within MindTree or outside. 
If you have received this message by mistake please notify the sender by return  
e-mail and delete this message from your system. Any unauthorized use or dissemination 
of this message in whole or in part is strictly prohibited.  Please note that e-mails 
are susceptible to change and MindTree shall not be liable for any improper, untimely 
or incomplete transmission.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Naveen Nahata
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to