Collections:
Use Multiple Columns in GROUP BY in Oracle
Can Multiple Columns Be Used in GROUP BY in Oracle?
✍: FYIcenter.com
You can use multiple columns in the GROUP BY clause as shown in the following example. It returns how many employees are having the same salary in each department:
SQL> SELECT department_id, salary, count(*) 2 FROM employees GROUP BY department_id, 3 salary HAVING count(*) > 1; DEPARTMENT_ID SALARY COUNT(*) ------------- ---------- ---------- 90 17000 2 50 3200 4 50 2200 2 50 3600 2 80 10500 2 80 9000 2 50 2700 2 ......
⇒ Use Group Functions in ORDER BY Clause in Oracle
⇐ Count Duplicated Values in a Column in Oracle
2019-10-27, 1667🔥, 0💬
Popular Posts:
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Somet...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...