I'm new at SQL and having a problem about calculating averages in my SQL database. I have two columns (ID which is unique for that table and price for every ID), and I need to calculate averages for every ID individually. My table looks something like this:
ID PRICE
---------------
1. 500
1. 700
1. 840
1. 790
1. 800
2. 1500
2. 1480
2. 1620
2. 1700
2. 1560
(have much more ID numbers, but I'm guessing the solution is the same no matter how many ID is there, if there is a solution).
When I try to calculate average, it takes all values from PRICE column, but I need to calculate average for ID 1, ID 2, ID 3, ID 4…. individually, for later calculations. I tried to find the answer online, but I failed. Is it even possible to calculate that way averages or I need another approach?