+ 2
SQL aggerate
find this difficult Retrieve the average length of a track in seconds for tracks greater than 1 MB. I have: SELECT AVG(Milleseconds*1000) AS AvrgTrack FROM Track WHERE Bytes*8000 > 1000000 the answer is 270.3458 I get 269.92215 I have used Bytes*8 giving me 270.03397
8 odpowiedzi
+ 1
This one took me a while. here's what worked for me.
SELECT AVG (Milliseconds/1000)
FROM Track
WHERE Bytes > 1024*1024
0
Could be a little accuracy problem.
1 MB is 1048576 bytes.
0
Yes I have used both Bytes*1024*1024 and Bytes*1048576 Both give me the same answer
Bytes*8 gives me 270.03397
I am brining to think its how my query is structured is the problem
0
I believe my query is not aggregating the Milliseconds correctly.
0
Thank you that was the one method I did think about
0
Retrieve the average length of a track in seconds for tracks greater than 1 MB.
Ans; SELECT AVG(Milleseconds/1000) AS AvrgLength FROM Track WHERE Bytes > 1024*1024
0
SELECT AVG (Milliseconds/1000)
FROM Track
WHERE Bytes > 1024*1024
How "Milliseconds/1000"??? transfer of milliseconds in seconds in the condition
0
a in the source table, values in milliseconds