Junior — Middle
Have you used data grouping in databases for aggregation or analytics?
sobes.tech AI
Answer from AI
Yes, data grouping in databases is often used for aggregation and analytics. For example, using SQL queries with the GROUP BY operator, you can group records by a specific field and apply aggregate functions (SUM, COUNT, AVG, etc.) to obtain summary information.
Example:
SELECT department, COUNT(*) AS employee_count, AVG(salary) AS avg_salary
FROM employees
GROUP BY department;
This query groups employees by departments and shows the number of employees and the average salary in each department. This approach is widely used for reporting and data analysis.