Given two table employee and department
EMP
----------------
empid deptid(fk)
Dept
---------------------
deptid(pk) deptname
que-Write a query to find count of employee in each
department.
Expected Output-
deptid countofEmployee
---------------------------
10 57
20 20
30 15
Answer Posted / anithaletchumi
select d.deptid,count(e.empid) as countofEmployee from
department d left outer join employee e on
d.deptid=e.deptid group by d.deptid
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.
What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?
15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.
What is archive log in Oracle?
What is rich query?
How remove data files before opening a database?
What is a Garbage Collection? and what is full recursive Garbage collection?
How to assign data of the deleted row to variables?
How many types of tables are there in oracle?
What are joins, explain all types of joins?
How do we create privileges in oracle?
How to get execution statistics reports on query statements?
What is the relation of a user account and a schema in oracle?
Explain the use of log option in exp command.
What is the oracle implicit cursor?