#zadanie 1
SELECT Reviewer.name, Movie.title, Rating.stars, Rating.ratingDate FROM
  (Rating INNER JOIN Reviewer ON Rating.rID=Reviewer.rID) INNER JOIN
  Movie ON Rating.mID=Movie.mID
ORDER BY name, title, stars;

#zadanie 2
SELECT title, max(stars) as stars FROM Movie INNER JOIN Rating
ON Movie.mID=Rating.mID
GROUP BY Movie.mID
ORDER BY title;


#zadanie 3
SELECT * FROM (SELECT title, AVG(stars) as stars FROM Movie INNER JOIN Rating
ON Movie.mID=Rating.mID
GROUP BY Movie.mID
ORDER BY stars DESC
LIMIT 3) maxi
ORDER BY title;

#zadanie 4
SELECT title, MAX(Rating.ratingDate) AS lastRating
               FROM Movie INNER JOIN Rating
ON Movie.mID=Rating.mID
GROUP BY Movie.mID
HAVING MAX(Rating.ratingDate)>MAKEDATE(2011, 21)
ORDER BY lastRating DESC;
