-- Database schema
| genre : g_name [ TEXT ] primary_key , rating [ TEXT ] , most_popular_in [ TEXT ] | artist : artist_name [ TEXT ] primary_key , country [ TEXT ] , gender [ TEXT ] , preferred_genre [ TEXT ] artist.preferred_genre = genre.g_name | files : f_id [ INT ] primary_key , artist_name [ TEXT ] files.artist_name = artist.artist_name , file_size [ TEXT ] , duration [ TEXT ] , formats [ TEXT ] | song : song_name [ TEXT ] primary_key , artist_name [ TEXT ] song.artist_name = artist.artist_name , country [ TEXT ] , f_id [ INT ] song.f_id = files.f_id , genre_is [ TEXT ] song.genre_is = genre.g_name , rating [ INT ] , languages [ TEXT ] , releasedate [ TEXT ] , resolution [ INT ] |
-- -- What is the average duration of songs that have mp3 format and resolution below 800?

SELECT avg(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id  =  T2.f_id WHERE T1.formats  =  "mp3" AND T2.resolution   <  800;