How does a SQL query usually look like, and how is it executed?
Write a PostgreSQL query that summarizes active employees by operational department, then explain how PostgreSQL processes the query logically and executes it physically.
department_name, active_employee_count, and avg_active_salary.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| is_operational | BOOLEAN | Whether the department is operational |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department_id | INT | Employee department identifier |
| status | VARCHAR(20) | Employment status |
| salary | NUMERIC(12,2) | Annual salary |