Skip to content

Commit e071587

Browse files
committed
added perc attended users in contest
1 parent e1c56d1 commit e071587

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Write your MySQL query statement below
2+
SELECT contest_id, ROUND((COUNT(DISTINCT user_id)*100)/(
3+
SELECT COUNT(user_id) FROM Users
4+
), 2) AS percentage
5+
FROM Register
6+
GROUP BY contest_id
7+
ORDER BY percentage DESC, contest_id;

SUBQUERIES/1341. Movie Rating.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Write your MySQL query statement below
2+
(SELECT name AS results
3+
FROM Users
4+
INNER JOIN MovieRating USING(user_id)
5+
GROUP BY user_id
6+
ORDER BY COUNT(rating) DESC, name
7+
LIMIT 1)
8+
9+
UNION ALL
10+
11+
(SELECT title as results
12+
FROM Movies
13+
INNER JOIN MovieRating USING(movie_id)
14+
WHERE MONTH(created_at) = '02' AND YEAR(created_at) = '2020'
15+
GROUP BY title
16+
ORDER BY AVG(rating) DESC, title
17+
LIMIT 1)

0 commit comments

Comments
 (0)