WebApr 18, 2024 · SELECT e1.* FROM emp e1 WHERE EXISTS ( SELECT 1 FROM ( SELECT deptno , MAX (sal) sal FROM emp GROUP BY deptno ) e2 WHERE e2.deptno = e1.deptno AND e2.sal = e1.sal ) ORDER BY deptno; This post has been answered by Paulzip on Apr 18 2024 Jump to Answer Locked due to inactivity on May 16 2024 Added on Apr 18 2024 10 … WebSep 29, 2024 · SELECT empno, ename, sal FROM emp WHERE sal >= 1500 AND sal <= 3000; Example: List the employee number and names of department 10, department 20 SELECT …
Top 130 SQL Interview Questions And Answers - Blogger
WebApr 11, 2024 · Consider a query to (ostensibly) find both the sum of all salaries for department 10 and the sum of all bonuses for all employees in department 10: select deptno, sum (sal) as total_sal, sum (bonus) as total_bonus from (select e. empno, e. ename, e. sal, e. deptno, e. sal * case when eb. type = 1 then.1 when eb. type = 2 then.2 else.3 end … WebAug 5, 2024 · select Emp.*, row_number () over (partition by deptno order by Salary DESC) rownumb from Employee Emp ) where rownumb = n; /*n is nth highest salary*/ Find nth highest salary in Oracle using RANK (): Oracle also provides a RANK function that just assigns a ranking numeric value (with 1 being the highest) for some sorted values. isis therapeutics
SQL语句学习(大数据)_Shadow️的博客-CSDN博客
WebSum salary group by department number SQL> create table emp 2 ( empno NUMBER (4) constraint E_PK primary key 3 , ename VARCHAR2 (8) 4 , init VARCHAR2 (5) 5 , job VARCHAR2 (8) 6 , mgr NUMBER (4) 7 , bdate DATE 8 , sal NUMBER (6,2) 9 , comm NUMBER (6,2) 10 , deptno NUMBER (2) default 10 11 ) ; Table created. WebAnswer: A, B. The SELECT statement can be used for selection, projection and joining. 2. Determine the capability of the SELECT statement demonstrated in the given query. SELECT e.ename, d.dname FROM emp e, dept d WHERE e.deptno = d.deptno AND e.sal > 1000; Selection. Filtering. Joining. Projection. WebSELECT (SUM (e.salary)/COUNT (d.dep_id)) AS Average, d.dep_name, d.dep_id FROM employee e, department d WHERE e.dept_no = d.Dep_id GROUP BY d.dep_id SELECT AVG (e.salary) AS Average, d.dep_name, d.dep_id FROM employee e, department d WHERE e.dept_no = d.Dep_id GROUP BY d.dep_id - 2010prashant September 20, 2013 Flag Reply … kerathermie