# Introduction To PrologThe Movie Database

## How The Facts Are Stated

The bold text in the four examples below indicates the format of the facts in the movies database.

```movie(M,Y) = movie M came out in year Y movie(american_beauty, 1999).``` ```director(M,D) = movie M was directed by director D director(american_beauty, sam_mendes).``` ```actor(M,A,R) = actor A played role R in movie M actor(american_beauty, kevin_spacey, lester_burnham).``` ```actress(M,A,R) = actress A played role R in movie M actress(american_beauty, annette_bening, carolyn_burnham).```

Write queries to answer the following questions. Remember to press the semi-colon after each result until all the possible answers are revealed.

1. In which year was the movie American Beauty released?
2. Find the movies released in the year 2000.
3. Find the movies released before 2000. ( eg movie(X, Y), Y<2000. )
4. Find the movies released after 1990.
5. Find an actor who has appeared in more than one movie. (2 queries with the same variable for actor, different for movie and role. You must also state that the first movie variable cannot equal the second).
6. Find a director who has directed a movie in which the actress Scarlett Johansson appeared.
7. Find an actor who has also directed a movie.
8. Find an actor or actress who has also directed a movie.(Use the semi-colon to separate out the two queries, actors will be found first)
9. Find the movie in which John Goodman and Jeff Bridges were co-stars.
10. Find the movies in which Steve Buscemi and John Goodman were both actors.

Add rules to the database to do the following,

1. released_after(M, Y) - the movie was released after the given yeaar
2. released_before(M, Y) - the movie was released before the given year
3. same_year(M1, M2) - the movies are released in the same year
4. co_star(A1, A2) - the actor/actress are in the same movie