
August 11th, 2012, 07:56 PM
|
 |
Contributing User
|
|
Join Date: Jun 2005
Posts: 221
Time spent in forums: 20 h 26 m 36 sec
Reputation Power: 0
|
|
|
AVG() in small groups
How do you use the AVG api in sql to manage grouped output? For example:
Given a SQL Table “Employee”
Name Salary City
John Doe 15000 Seattle
Jane Doe 30000 Redmond
Tim Wayne 25000 Seattle
Write a SQL query that would return the average salary per city in the format shown below:
City Salary
Seattle 20000
Redmond 30000
Select City, AVG(Salary) from Employee where ... I don't know the rest
Where city == city or something like that?
|