๐ Understanding Aggregate Functions in Oracle SQL (COUNT, AVG, SUM)

As part of my continued hands-on learning with Oracle Cloud, I explored aggregate functions in Oracle SQL. These functions are essential for analyzing data and generating meaningful insights from a database.
๐ฏ Objective
The goal of this activity was to:
Learn how to use aggregate functions
Perform calculations on database records
Understand data analysis using SQL
๐ป Step 1: Creating the Table
CREATE TABLE employees (
emp_id NUMBER,
emp_name VARCHAR2(50),
salary NUMBER
);
๐งช Step 2: Inserting Data
INSERT INTO employees VALUES (1, 'Ali', 50000);
INSERT INTO employees VALUES (2, 'Ahmed', 70000);
INSERT INTO employees VALUES (3, 'Sara', 60000);
๐ข Step 3: Counting Records
SELECT COUNT(*) FROM employees;
This query returns the total number of employees.
๐ Step 4: Calculating Average Salary
SELECT AVG(salary) FROM employees;
This gives the average salary of employees.
โ Step 5: Calculating Total Salary
SELECT SUM(salary) FROM employees;
This returns the total salary of all employees.
๐ก What I Learned
How to use COUNT, AVG, and SUM functions
Performing calculations directly in Oracle SQL
Extracting meaningful insights from data
๐ Conclusion
This activity helped me understand how aggregate functions work in Oracle SQL and how they can be used to analyze structured data efficiently. These concepts are essential for real-world database applications.





