SQLConfigurationSQLConfiguration





SQL-Query Basics  «Prev  Next»
Lesson 1

Introduction to SQL Query Basics, Cursors, and Views

This module contains information about queries that are needed as a basis for the rest of the modules in this course.
Depending on your prior experience with SQL Server 2012, some of this information may already be familiar to you.

Learning objectives

After completing this module, you will be able to
  1. Describe how to execute your queries
  2. Compare and contrast batch queries with single queries
  3. Describe the purpose of and how to use system catalogs in your queries
  4. Write logic within your queries
  5. Describe how to construct SQL statements dynamically
In the next lesson, you will learn how to execute your queries.



There are a number of topics in SQL Server that depend on other knowledge, which is a challenge in organizing a course like this. For example, there are things you are about to learn how to do in queries that would be easier if you knew about
  1. user-defined functions,
  2. or scripting, or
  3. variables,
but at the same time it is difficult to teach about functions without knowing a few T-SQL statements to put in there.
Besides, some of these statements are things that might help a beginning user see some real possibilities, so I am going to start in on some more interesting things here as an introudction. Some of the concepts in this module are going to challenge you with a new way of thinking. You already had a taste of this dealing with joins, but you have not had to deal with the kind of depth that I want to challenge you with in this module. Even if you do not have that much procedural programming experience, the fact is that your brain has a natural tendency to break complex problems down into their smaller subparts (sub-procedures, logical steps) as opposed to solving them whole, for example as a set. While SQL Server 2012 supports procedural language concepts now more than ever, my challenge to you is to try to see the question as a whole first. Be certain that you cannot get it in a single query.