Learn your way! Get started

SQL Server 2012, Part 8 of 9: T-SQL Select, Where, and Clauses

with expert Don Kiely

Watch trailer

Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 11/26/2012
Level Intermediate
Runtime 1h 38m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs Included
Sample code Included
Exams Included

Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More

Course description

In this course you’ll learn about the SELECT statement and its incredible flexibility when retrieving data from one or more database tables. You can shape the data you retrieve, and filter it using the WHERE clause. SQL Server rarely returns data in the order you want, so you can use the ORDER BY clause to sort it. Next you’ll learn some advanced ways to select data. With the GROUP BY clause, you can summarize the information in one or more tables, aggregating it various ways, if you wish. You’ll also learn how you can join the data together from multiple tables, efficiently including related data in the result sets.


This course assumes that you have at least a basic familiarity with the concept of relational databases and a basic understanding of what SQL Server is and the high-level tools in it, as well as how to create and manage objects using Management Studio. You should also have a basic understanding of how SQL Server implements security, including its authentication and authorization schemes, and how to assign permissions on securable objects to principals.

Learning Paths

This course is part of the following LearnNowOnline SuccessPaths™:
SQL Server Core

Meet the expert

Don Kiely is a featured instructor on many of our SQL Server and Visual Studio courses. He is a nationally recognized author, instructor, and consultant specializing in Microsoft technologies. Don has many years of teaching experience, is the author or co-author of several programming books, and has spoken at many industry conferences and user groups. In addition, Don is a consultant for a variety of companies that develop distributed applications for public and private organizations.

Course outline

Select, Where, Clauses, Tables

Data Selection with SELECT (17:11)
  • Introduction (01:28)
  • Transact-SQL Data Selection (01:49)
  • Schemas and Naming in SQL (02:53)
  • The SELECT Statement (00:26)
  • Demo: The SELECT Statement (01:14)
  • Semicolon vs. GO (01:48)
  • Demo: The Asterisk Symbol (01:28)
  • Demo: Concatenation (01:04)
  • Demo: Aliases (03:35)
  • Demo: Distinct (00:55)
  • Summary (00:25)
The WHERE Clause (19:48)
  • Introduction (00:54)
  • Demo: The WHERE Clause (00:36)
  • Comparison Operators (01:50)
  • Demo: LIKE and Wildcards (04:36)
  • Demo: BETWEEN Operator (01:11)
  • Demo: Test for Null (00:46)
  • Three-Valued Logic: Nulls (01:56)
  • Demo: AND, OR, NOT Operators (02:11)
  • Demo: Operator Precedence (01:43)
  • Demo: Overriding Precedence (01:10)
  • Demo: IN Operator (02:11)
  • Summary (00:39)
  • Introduction (01:15)
  • Demo: ORDERBY (03:26)
  • Demo: GROUPBY and Aggregates (01:34)
  • Demo: Count (03:39)
  • Demo: GROUPBY (02:18)
  • Demo: ORDERBY with GROUPBY (00:53)
  • Demo: HAVING Clause (02:17)
  • Demo: Top Clause (01:34)
  • Demo: Top, Ties and PERCENT (01:36)
  • Summary (00:24)
Joining Tables (22:02)
  • Introduction (01:19)
  • Demo: Cross Join (04:08)
  • Demo: How Joins Work (01:40)
  • Demo: Joins with WHERE Clause (01:41)
  • Join Notation (01:06)
  • Demo: JOIN Clause (01:26)
  • Demo: Alias Tip (01:45)
  • Inner Joins (00:43)
  • Demo: INNER JOIN (02:41)
  • Demo: Multiple Table Joins (02:13)
  • Demo: Joins and Aggregates (02:43)
  • Summary (00:32)
Outer and Self Joins (20:04)
  • Introduction (01:15)
  • Demo: Outer Joins (02:01)
  • Demo: Left Outer Join (02:55)
  • Demo: Right Outer Join (01:01)
  • Demo: Full Outer Join (01:50)
  • Demo: Combining Joins (04:14)
  • Demo: Two Left Joins (01:38)
  • Self Joins (01:17)
  • Demo: Self Joins (03:23)
  • Summary (00:25)