Index: music/urls.py
===================================================================
--- music/urls.py	(revision 0e077ef003e82d99abd40219664904f8ce892305)
+++ music/urls.py	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -5,7 +5,11 @@
     path('album/', views.album_list, name='album_list'),
     path('artist/', views.artist_list, name='artist_list'),
-    path('artist/avg_track_duration', views.avg_track_duration, name='avg_track_duration'),
+    path('artist/avg-track-duration', views.avg_track_duration, name='avg_track_duration'),
+    path('artist/avg-track-price', views.avg_price_per_artist, name='avg_track_price'),
+    path('artist/most-popular', views.rank_list_artists, name='rank_list_artists'),
     path('track/', views.track_list, name='track_list'),
-    path('track/per_genre', views.tracks_count_per_genre, name='track_count_per_genre'),
-    path('customer/rank_list', views.rank_list_most_active_customers, name='rank_list_most_active_customers'),
+    path('customer/genre', views.most_listened_genre_per_customer, name='most_listened_genre_per_customer'),
+    path('media-type/percentage', views.media_type_percentage, name='media_type_percentage'),
+    path('track/per-genre', views.tracks_count_per_genre, name='track_count_per_genre'),
+    path('customer/rank-list', views.rank_list_most_active_customers, name='rank_list_most_active_customers'),
 ]
Index: music/views.py
===================================================================
--- music/views.py	(revision 0e077ef003e82d99abd40219664904f8ce892305)
+++ music/views.py	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -62,2 +62,43 @@
 
     return render(request, 'rank_list_most_active_customers.html', {'data': data})
+
+
+def avg_price_per_artist(request):
+    with connection.cursor() as cursor:
+        cursor.execute("SELECT * FROM avg_price_per_artist;")
+        rows = cursor.fetchall()
+
+    data = [{'name': row[0], 'avg_price_per_track': row[1]} for row in rows]
+
+    return render(request, 'avg_price_per_artist.html', {'data': data})
+
+
+def rank_list_artists(request):
+    with connection.cursor() as cursor:
+        cursor.execute("SELECT * FROM rank_list_artists;")
+        rows = cursor.fetchall()
+
+    data = [{'name': row[0], 'num_invoices': row[1]} for row in rows]
+
+    return render(request, 'rank_list_artists.html', {'data': data})
+
+
+
+def media_type_percentage(request):
+    with connection.cursor() as cursor:
+        cursor.execute("SELECT * FROM media_type_percentage;")
+        rows = cursor.fetchall()
+
+    data = [{'name': row[0], 'num_of_tracks': row[1], 'percentage': row[2]} for row in rows]
+
+    return render(request, 'media_type_percentage.html', {'data': data})
+
+
+def most_listened_genre_per_customer(request):
+    with connection.cursor() as cursor:
+        cursor.execute("SELECT * FROM most_listened_genre_per_customer;")
+        rows = cursor.fetchall()
+
+    data = [{'first_name': row[0], 'last_name': row[1], 'most_listened_genre': row[2]} for row in rows]
+
+    return render(request, 'most_listened_genre_per_customer.html', {'data': data})
Index: music/views/avg_price_per_artist.sql
===================================================================
--- music/views/avg_price_per_artist.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
+++ music/views/avg_price_per_artist.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -0,0 +1,8 @@
+CREATE VIEW avg_price_per_artist AS
+SELECT
+    ar.name,
+    COALESCE( ROUND(avg(t.unit_price), 2)::text, 'not enogu data') as avg_price_per_track
+FROM artist ar
+left join album a on ar.artist_id = a.artist_id
+left join track t on a.album_id = t.album_id
+group by ar.name
Index: music/views/media_type_percentage.sql
===================================================================
--- music/views/media_type_percentage.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
+++ music/views/media_type_percentage.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -0,0 +1,12 @@
+CREATE VIEW media_type_percentage AS
+with cte as (SELECT count(track_id) as total
+             FROM media_type mt
+                      left join track tr on mt.media_type_id = tr.media_type_id)
+SELECT mt.name                                          as media_type,
+       count(tr.track_id)                               as num_of_tracks,
+       round(count(tr.track_id) * 100.0 / cte.total, 2) as percentage
+FROM media_type mt
+         left join track tr on mt.media_type_id = tr.media_type_id
+         cross join cte
+group by mt.media_type_id, mt.name, cte.total
+order by percentage desc
Index: music/views/most_listened_genre_per_customer.sql
===================================================================
--- music/views/most_listened_genre_per_customer.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
+++ music/views/most_listened_genre_per_customer.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -0,0 +1,17 @@
+CREATE VIEW most_listened_genre_per_customer AS
+WITH genre_count AS
+         (SELECT c.customer_id, c.first_name, c.last_name, g.name as genre, count(tr.track_id) as num_songs_per_genre
+          FROM customer c
+                   left join invoice i on c.customer_id = i.customer_id
+                   left join invoice_line il on i.invoice_id = il.invoice_id
+                   left join track tr on il.track_id = tr.track_id
+                   left join genre g on tr.genre_id = g.genre_id
+          group by c.customer_id, c.first_name, c.last_name, g.genre_id, g.name
+          order by c.first_name, num_songs_per_genre desc),
+     ranked_genres AS (SELECT *,
+                              ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY num_songs_per_genre DESC) AS rn
+                       FROM genre_count)
+SELECT first_name, last_name, genre as most_listened_genre
+FROM ranked_genres
+WHERE rn = 1
+ORDER BY first_name, last_name;
Index: music/views/rank_list_artists.sql
===================================================================
--- music/views/rank_list_artists.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
+++ music/views/rank_list_artists.sql	(revision bfca48bdd486ce59ee78a865790e30637555f1ce)
@@ -0,0 +1,11 @@
+CREATE VIEW rank_list_artists AS
+    SELECT
+            (ar.name),
+            count(il.invoice_line_id)
+as num_invoices
+    FROM artist ar
+    left join album al on ar.artist_id = al.album_id
+    left join track tr on al.album_id = tr.album_id
+    left join invoice_line il on tr.track_id = il.track_id
+    group by ar.name
+    order by num_invoices desc
