From the course: From Excel to SQL
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Using SUM in SQL
- One of the most popular functions in Excel is a sum function. Chances are, if you have some experience with Excel then you've probably used it to add up the contents of a column. So as you get started, let's just take a quick look at how this function works in the example, Excel spreadsheet. Here on the department sheet, we can use sum to add the number of desks across all departments. So you write equals SUM E two to 11 and then hit enter and you can see the number of desks is 606. Well, it just so happens that SQL has his own sum function that can be used to add up the numbers of a column just like you would in Excel. Let's open up DB Browser and take a look at how you can use the sum function in SQL. You start with select. And this time you're going to type sum open parentheses and then add the name of the column you want to sum. In this case, num_desks and then close parentheses. Next you add…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.