Oracle DISTINCT: Deduplicate Aggregates

In Oracle database, the DISTINCT keyword can be used to eliminate duplicate values from the results of aggregate functions. For example, when using the SUM function to calculate the sum of a column, the DISTINCT keyword can be added within the function to ensure that the result does not include any duplicate values. For example:

SELECT SUM(DISTINCT column_name)
FROM table_name;

The statement will sum up the values in a column of the table, ensuring that duplicate values are not counted in the process.

bannerAds