User:Mayurmisal0514/sandbox

What is database ? database is collection of information in logical and meaningful form.

What is SQl SQL is a structure query language. It is used to accessing and manipulating Database.

query by mm

to show all detail of employees whoes salary has maximum of that department whoes has maximum employees? select *from employees where salary in( select max (salary) from employees where department_id in( select department_id from employees group by department_id having count(department_id) =(select max(count(department_id)) from employees group by department_id))) and department_id in ( select department_id from employees group by department_id having count(department_id) =(select max(count(department_id)) from employees group by department_id))

to show all detail whoes salary has a maximum ? --using corelated subquery

select * from employees e where 1>=(select count (distinct salary) from employees ee where ee.salary>=e.salary

--using dense_rank select * from(select e.*, dense_RANK OVER (partition by department_id ORDER BY salary desc) as aa from employees e) where aa=1

-- using subquery

select * from employees where salary in (select max(salary) from employees group by department_id)