In this blog we are going to understand the important and basic concepts of SQL.
1.Union :
- Union operator selects only distinct values.
- Union removes duplicate records.
Example:
2.Union All:
- Union All keeps all records from each data sets.
- Union All is used to allow duplicate values.
Example:
3.Oder By:
- The Order By clause is used for sorting data in ascending and descending order based on one or more columns.
Example:
4.Group By:
- Group By is used to group the rows that have the same values.
- This clause is used with this SELECT statement.
- The Group By clause is used with aggregate functions like: COUNT , MAX, MIN, SUM, and AVG.
Example:
5.Subquery:
- Subquery is also termed as nested subquery.
- Subquery is nothing but query inside a query.
- While the statement containing a subquery is also called an outer query or outer select.
- In a subquery first, execute inner query and result pass to outer query then outer query executes.
Example:
2.Correlated subqueries:
- Correlated subquery is a subquery that uses values from the outer query.
- The inner query needs an outer query value. Then the result pass to the outer query.
- Correlated subquery depends upon the outer query and cannot execute on its own.
- In this query, By using the EXISTS operator we define correlated subquery.
Example:
No comments:
Post a Comment