Difference between revisions of "SYNTAX FOR GROUP HAVING ORDER BY"
Jump to navigation
Jump to search
(Created page with "SELECT ... AGRIGATEDFUNCTION() FROM TABLE1, ... WHERE < CONDITION> GROUP BY COL1, COL2... HAVING <AGG> ORDER BY '''' FIND SALARY BASED ON EACH DEPARTMENT NUMBER''' NOTE: THE...") |
|||
Line 18: | Line 18: | ||
FROM CUST | FROM CUST | ||
GROUP BY CITY, GENDER | GROUP BY CITY, GENDER | ||
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]] |
Revision as of 22:18, 18 November 2017
SELECT ... AGRIGATEDFUNCTION() FROM TABLE1, ... WHERE < CONDITION> GROUP BY COL1, COL2... HAVING <AGG> ORDER BY
' FIND SALARY BASED ON EACH DEPARTMENT NUMBER NOTE: THE SAME COLUMN USED THE THE SELECT STATEMENT "DEPTNO" SHOULD BE USED IN THE GROUP BY
SELECT DEPTNO, SUB(SALARY) "TOTAL SALARY" FROM EMP GROUP BY DEPTNO
DISPLAY THE NUMBER OF MALES AND FEMALES FROM EACH CITY ' TABLE > CUST > COLUMN GENDER, CITY
SELECT CITY, GENDER, COUNT(*) "NUMBER OF CUSTOMERS" FROM CUST GROUP BY CITY, GENDER