From the course: SQL Essential Training

Calculating with functions - SQL Tutorial

From the course: SQL Essential Training

Calculating with functions

- I think before we say another word about SQL let's recognize what you've accomplished so far. You just got through joins. That's a job well done, and I know because joins were my biggest pain point when I first got started with SQL. Now think about the following request. How many customers do we have whose last name starts with S? To answer this request with SQL one approach would be to select the last name's field from the customer's table, order by last name, scroll down to the S names, and then count those names manually. Another approach would be to filter our results to return only Last names starting with S, using the where clause which would make the counting process easier. Both these methods require some sort of manual counting to get the answer to the request. In this chapter I'll show you how to use something called functions to simplify your calculations and eliminate the need for you to do any manual counting, functions are one of the most powerful features of SQL. With them, you can do complex calculations on your data with a single line of code. Let's take a look at some of the most commonly used functions in SQL including aggregate, string, date and time functions. Let's go.

Contents