-
How can i solve the query...?
Emp Dept
=== ======
Ename - DeptNo
Eno - DName
DeptNo - Location
Count the number of employees in each department and get the department which has least number of employees
If a table has one column named as 'X' type integer
it contains 3,5,10,-2,15,41,2 and so on
If we a number (i.e., that given number is in the above list) as input, get the immediate biggest number for that given one. (Query only not PL/SQL script)
-
Code:
Select
Dept.Dname, A.Cnt
From
( Select Dept_No, Count(*) Cnt From Emp Group By Dept_No Order By 2) A,
Dept
Where
A.Dept_No = Dept.Dept_No And
Rownum < 2
;
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
-
For the 2nd Qn,
select min(x) from table_a where x > :b1;
where b1 is your input value.
Tamil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|