movie database in sql code example
Example 1: movie database sql queries
select Title from Movie m
inner join (select MovieID,sum(Rating) Rate from Ratings group by movieid having count(UserID)>39 order by sum(Rating) DESC limit 20) tbl
on m.MovieID=tbl.MovieID
order by tbl.Rate desc
Example 2: movie database sql queries
select director
from movies inner join stars_in_movies
where star_id=%s and movie_id = id;
Example 3: movie database sql queries
select first_name,last_name
from stars_in_movies inner join stars
where movie_id=%s and star_id=id;