SQL query execution
This section will be decicated to explain how to retrieve the data recorded in the tables trough queries execution. We will see step-by-step the SELECT statement clauses, how to filter the required information, how to order and group the results and how to retrieve data from multiple independent tables from a single statement using relationships
SELECT statement
SELECT, is the DML command that allows you to query the data from the database tables and return the records in a table called result set. In this section we will see the main clauses and operators in the handling of statements.
ORDER BY clause
ORDER BY is the SELECT clause that allows us to sort out the records in ascending or descending order. This clause will always be placed at the end of the statement
GROUP BY statement and aggregate functions
Aggregate functions allow you to perform operations on a result set by returning a single aggregate value. GROUP BY is used to group the results according to the selected column,they are often used with aggregate functions
TOP, ALL and DISTINCT clauses
The TOP, ALL and DISTINCT clauses, often known as predicates, are clauses used in queries, generally located in the SELECT before the FROM and used for filtering records
JOIN clause
JOIN is the clause that allows us to execute queries and return data from several independent but related tables through Foreign Keys. In this section we will see the different types of JOIN and how to apply them
Subquery
A SUBQUERY is a nested query within another SELECT, SUBQUERY, or within other SQL statements such as INSERT, UPDATE, or DELETE. They can be located in any of the main clauses of a query (SELECT, FROM or WHERE)
UNION statement
UNION is a statement or operator that allows you to join two or more SELECTs by concatenating the execution results into a single result set