Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
2. What will I learn?

Instruction

At the end of this course, you will be able to write complex window functions with ease. Just take a look at the following query, which allows us to see the sum of all payments made by one customer and, in a separate column, the lowest total payment made by any customer:

SELECT
  Customer.FirstName,
  Customer.LastName,
  SUM(SingleRental.PaymentAmount) AS Total Payments,
  FIRST_VALUE(SUM(SingleRental.PaymentAmount))
    OVER(
      ORDER BY
      SUM(SingleRental.PaymentAmount) ASC
      ROWS BETWEEN UNBOUNDED PRECEDING
        AND UNBOUNDED FOLLOWING
    ) AS MinTotalPayment
FROM SingleRental
INNER JOIN Customer
  ON Customer.Id = SingleRental.CustomerId
GROUP BY Customer.FirstName,
  Customer.LastName;

Such queries won't be a problem for you at all! But as we mentioned previously, there are some prerequisites. Let's start with a short quiz that will test your current T-SQL skills. If you know the answers to all the questions, this course is right for you! Don't worry, you won't have to write much: the quiz is going to be short and painless.

First, let's take a look at the tables we'll use for the quiz. We're going to work with information about dogs and their owners.

Exercise

Select all the information from the Owner table.

Each owner has an ID, a first and last name, and an age.