Book Image

SQL Server on Linux

Book Image

SQL Server on Linux

Overview of this book

Microsoft's launch of SQL Server on Linux has made SQL Server a truly versatile platform across different operating systems and data-types, both on-premise and on-cloud. This book is your handy guide to setting up and implementing your SQL Server solution on the open source Linux platform. You will start by understanding how SQL Server can be installed on supported and unsupported Linux distributions. Then you will brush up your SQL Server skills by creating and querying database objects and implementing basic administration tasks to support business continuity, including security and performance optimization. This book will also take you beyond the basics and highlight some advanced topics such as in-memory OLTP and temporal tables. By the end of this book, you will be able to recognize and utilize the full potential of setting up an efficient SQL Server database solution in your Linux environment.
Table of Contents (19 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Overview of aggregate functions


Data summarizing is one of the most common scenarios for SQL use in business environments. It is also very important for developers, report creators, and information workers. SQL Server has several built-in aggregate functions, such as AVG, SU, and MIN, to perform summarizing data operations. Basically, those operations are taken using multiple values to produce a single (scalar) value (for example, the average function on a column with 10,000 values will always produce a single output):

Function

Example

Description

MIN

MIN (ListPrice)

Finds the smallest value in a column

MAX

MAX (Grade)

Finds the largest values in a column

SUM

SUM (TotalSales)

Creates a sum of numeric values in a column (non-null)

AVG

AVG (Size)

Creates an average of numeric values in a column (non-null)

COUNT

COUNT (OrderID)

COUNT (*)

COUNT with column name counts the number of data and ignores nulls

COUNT (*) counts the number of rows in the table

 

The following query uses four out of five aggregate functions...