General discussion

Locked

about Oracle

By pakwatun ·
tell me query of oracle
If we want to reterieve some data from a table whose salary is same take out their names like in Sql we have emp table reterive it from there

This conversation is currently closed to new comments.

13 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

about Oracle

by Hasse MCSE/Brainbench In reply to about Oracle

Hi!

I don't really know what you mean, and I strongly suggest you get a book on SQL.

Cause what you want to do is something like this.

select * from emp where salary = 20000;

Will return all employers with a $20000 salary.

select * from emp where salary > 60000;

Will return all employers with salary above $60000;

/Hasse

Collapse -

about Oracle

by pakwatun In reply to about Oracle

The question was auto-closed by TechRepublic

Collapse -

about Oracle

by alekstek In reply to about Oracle

If you just want the name of the employees substitute the * in the previous answer with the appropiate column:
Ex:

select name
from emp
where salary = 20000;

Collapse -

about Oracle

by pakwatun In reply to about Oracle

The question was auto-closed by TechRepublic

Collapse -

about Oracle

by wchaster In reply to about Oracle

This is a hard question to assertain the meaning ofit. Has this question been submitted for inclusion on the OCP?

If I read this correctly the points missed by the previos two are that a GROUP BY is required to match up employees with the same SALARY. I will add an ORDER BY to make then a little neater.

SELECT name FROM EMP
ORDER BY SALARY
GROUP BY SALARY;

Collapse -

about Oracle

by pakwatun In reply to about Oracle

The question was auto-closed by TechRepublic

Collapse -

about Oracle

by Todd Parker In reply to about Oracle

I think everyone missed the point of this email. Illiteracy at work.

IMHO

Collapse -

about Oracle

by pakwatun In reply to about Oracle

The question was auto-closed by TechRepublic

Collapse -

about Oracle

by alekstek In reply to about Oracle

or if you want to retrieve rows from a table that have a common value but you don't know this value:
select name, salary from emp
where salary in
(select salary from emp
group by salary
having count(*) > 1)
order by salary, name;

any wise comments todd ?

Collapse -

about Oracle

by pakwatun In reply to about Oracle

The question was auto-closed by TechRepublic

Back to Web Development Forum
13 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums