0

Simple SQL exercise

Hi, i’m learning sql and i dont know ho to solve this exercise. I have to print the total number of like the user “mike@gmail.com” got in his post and comment. Because “if a user get more then 300 likes in his post and comment, will became a gold user”. Thanks for the help! This is the database: -Users ( Username Email PRIMARY KEY) -Post( Id_post PRIMARY KEY Text User REFERENCES Users(email)) -Comment ( Id_comment PRMARY KEY Textcomment User_comment REFERENCES Users(email) Post REFERENCES Post(id_post) -Like_post ( User_putlike REFERENCES User(email) likep REFERENCES Post(id_post) -Like_comment ( User_putlike REFERENCES User(email) Likec REFERENCES Comment(id_comment)

12th Jul 2019, 11:15 AM
Matteo Rosana
Matteo Rosana - avatar
1 Antwort
+ 9
select u.email from users u join post p on p.email = u.email join comment c on c.email = u.email where p.email = 'mike@gmail.com' having count(p.email) >= 300
29th Aug 2019, 11:17 AM
r8w9
r8w9 - avatar