
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Column Functions in DB2 Explained with Example
The DB2 COLUMN functions are also known as aggregate functions. These functions take the values from a particular column of multiple rows and return a single value.
Below is the list of some most commonly used COLUMN functions.
COLUMN FUNCTION |
DESCRIPTION |
SUM |
Finds the sum of column values |
COUNT |
Count the number of column values |
AVG |
Finds the average of column values |
MAX |
Finds the maximum value in the column |
MIN |
Finds the minimum value in the column |
The COLUMN function can only be used in the SELECT query. For example, if we have to find the average of all the ORDER_TOTAL for the orders placed on 15-08-2020 from the ORDERS table, then we can use the below query.
Example
SELECT AVG(ORDER_TOTAL) FROM ORDERS WHERE ORDER_DATE = ‘15-08-2020’
Advertisements