INTRODUCTION TO SQL PROGRAMMING
Course Overview
In this SQL Programming training course, you learn how to optimize the accessibility and maintenance of data with the SQLprogramming language, and gain a solid foundation for building, querying, and manipulating databases. It will describe the standardlanguage, but also identify deviations from the standard in two widely-used database products, Oracle and Microsoft SQL Server.Choose between working with the PostgreSQL database product or Microsoft SQL Server as you practice these skills with the hands-onexercises.
The ability to write the SQL language — the cornerstone of all relational database operations — is essential for anyone who developsdatabase applications. Attend this three-day instructor-led course and learn to leverage all that the SQL language has to offer.
Course Objectives
You Will Learn How To:
- Write SQL code based on ANSI/ISO standards to build database structures
- Update database content with SQL and transaction handling
- Retrieve data with filter conditions and from multiple tables using various types of join
- Process data with row and aggregate functions
Course Prequisites
Target Audience
No previous experience required. This course was designed to teach you the fundamentals of the SQL language. You will learn SQL over 3 days with instructor-led training and hands-on experience using either the PostgreSQL database product or Microsoft SQL Server 2016.
Course Outline
SQL Overview
- Outlining SQL as the cornerstone of database activity
- Applying the ANSI/ISO standards
- Describing the fundamental building blocks: tables, columns, primary keys and foreign keys
Building the Database Schema
Creating tables and columns
- Building tables with CREATE TABLE
- Modifying table structure with ALTER TABLE
- Adding columns to an existing table
- Removing tables with DROP TABLE
Protecting data integrity with constraints
- Guaranteeing uniqueness with primary key constraints
- Enforcing integrity with foreign key constraints
- Imposing business rules with check constraints
Improving performance with indexes
- Expediting data retrieval with indexes
- Recommending guidelines for index creation
Manipulating Data
Modifying table contents
- Adding table rows with INSERT
- Changing row content with UPDATE
- Removing rows with DELETE
Applying transactions
- Controlling transactions with COMMIT and ROLLBACK
- Deploying BEGIN TRANSACTION in SQL Server
Working with the SELECT Statement
Writing Single Table queries
- Retrieving data with SELECT
- Specifying column expressions
- Sorting the result with ORDER BY
- Handling NULL values in expressions
Restricting rows with the WHERE filter
- Testing for equality or inequality
- Applying wildcard characters
- Avoiding NULL value pitfalls
Querying Multiple Tables
Applying the ANSI/ISO standard join syntax
- Matching related rows with INNER JOIN
- Including nonmatched rows with OUTER JOIN
- Creating a Cartesian product with CROSS JOIN
Combining results with set operators
- Stacking results with UNION
- Identifying matching rows with INTERSECT
- Utilizing EXCEPT to find nonmatching rows
Employing Functions in Data Retrieval
Processing data with row functions
- Conditional formatting with the CASE expression
- Utilizing the CASE expression to simulate IF tests
- Dealing with NULL values
Performing analysis with aggregate functions
- Summarizing data using SUM, AVG and COUNT
- Finding the highest/lowest values with MAX and MIN
- Defining the summary level with GROUP BY
- Applying filter conditions with HAVING
Constructing Nested Queries
Applying subqueries in filter conditions
- Correlated vs. noncorrelated subqueries
- Testing the existence of rows
Including subqueries in expressions
- Placing subqueries in the column list
- Creating complex expressions containing subqueries
- Handling subqueries that return no rows
Developing In-Line and Stored Views
Breaking down complex problems
- Selecting data from a query result set
- Subqueries in the FROM clause
Creating views in a database
- Building reusable code
- Updateable vs. non-updateable views