Download presentation
Presentation is loading. Please wait.
Published byReynard Price Modified over 8 years ago
1
1 SQL – IV Grouping data from tables in SQL –The concept of grouping –GROUP BY clause –HAVING Clause –Determining whether values are unique –Group by using the ROLLUP operator –Grouping by using the CUBE operator Sub-Queries –Using sub-query in the FROM clause. –Using correlated sub-query –Using multi column sub-query –Using sub-query in the CASE expression –Using sub-query in an ORDERBY clause –Using EXISTS/NOT EXISTS operator JOINS –Joining multiple tables –Inner join –Outer join –Cross join
2
2 –Guidelines for creating joins –Joining a table to itself Concatenating data from table columns Using the UNION, Intersect and Minus clause –Union clause –Intersect clause –Minus clause
3
3 Grouping data from tables in SQL –The concept of grouping SQL SELECT statements have: all, WHERE, DISTINCT, ORDER BY GROUP BY and HAVING. Theses are parallel to the order by and where clause, except that they act on record sets and not on individual records. –GROUP BY clause: It is another section of the select statement. This optional clause tells Oracle to group rows based on distinct values that exits for specified columns. SELECT col1, col2, col3 AGGREGATE_FUNCTION( ) FROM tablename WHERE GROUP BY col1, col2, col3 e.g., SELECT branch-no “Branch No.”, count (emp_no) “NO. Of Employees” FROM EMP_MSTR GROUP BY branch_no; SELECT branch-no “Branch No.”, type “Type”, count (acct_no) “NO. Of Accounts” FROM EMP_MSTR GROUP BY branch_no, type; –HAVING Clause –Determining whether values are unique –Group by using the ROLLUP operator –Grouping by using the CUBE operator
4
4
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.