Overview

Introduction

The Select Data module provides you with the instruction and server hardware to develop your hands on skills in the defined topics. This module includes the following exercises:

  1. Demonstrating the Use of Select Statement
  2. Performing Joins
  3. Using UNION and INTERSECT operators

Exercise 1 – Demonstrating the Use of Select Statement

In this exercise, you will learn the following in Microsoft SQL Server 2008 R2:

  • Extract data from tables using simple SELECT statements
  • Query data by using Inner Join, Left Outer Join, Right Outer Join, and Full
    Outer Join
  • Combine result sets by using UNION and INTERSECT operators

Exercise 2 - Performing Joins

You can retrieve data from two or more logically related tables using SQL Server Joins. The two main types of joins include inner join and outer join.

Inner Join

You can specify the Inner join either in the FROM or WHERE clause of your SELECT statement. The inner join return only the records from the tables being joined that matches the join condition.

Left Outer Join

Left outer join returns all the records from the left table in the results whether or not there is a matching row in the right table. For unmatched records, the row contains a null value in the respective columns.

Right Outer Join

Right outer join returns all the records from the right table in the results whether or not there is a matching row in the left table. For unmatched records in the left table, the row contains a null value in the respective columns of the left table.

Full Outer Join

The Full Outer join returns all the rows from the joined tables whether irrespective of matching values in the columns on which the join is performed.

Exercise 3 – Using UNION and INTERSECT operators

You can use the UNION operator to combine the results of two or more queries into a single result set. The final result set includes all the rows including the duplicates from the result sets of all the queries specified in the union, if the UNION clause contains the option ALL. If the option ALL is not specified in the UNION, then the duplicate rows are eliminated in the final result.

Comprehensive Learning

See the full benefits of our immersive learning experience with interactive courses and guided career paths.