172k views
0 votes
Write the query to display the average age by department from a table called "Teacher". The columns in this table are as follows: Name, Age, Salary, SSN, Department, Start_Date.

1 Answer

6 votes

Final answer:

To display the average age by department from the 'Teacher' table, use the SELECT and AVG functions along with the GROUP BY clause.

Step-by-step explanation:

To display the average age by department from the 'Teacher' table, you can use the SQL query:

SELECT Department, AVG(Age) AS Average_Age FROM Teacher GROUP BY Department;

This query selects the Department column and calculates the average age using the AVG() function. It then labels the average age column as 'Average_Age'. Finally, it groups the results by the Department column using the GROUP BY clause.

User Coolpasta
by
9.0k points