rajesh
rajesh

Reputation: 323

database select

I have 3 tables:

  1. film(film_id, filmname) PK (film_id)
  2. category(category_id, categoryname) PK (category_id)
  3. film_category(contains both primary keys (film_id) and (category_id))

The problem is that I want to select all filmname from film tables where category_id = 3.

How to do this mysql select?

Upvotes: 0

Views: 69

Answers (2)

Yaakov Shoham
Yaakov Shoham

Reputation: 10548

select
  film.filmname
from
  film
  join film_category
  on film.film_id = film_category.film_id
where
  film_category.category_id = 3

Further info.

Upvotes: 4

Amadan
Amadan

Reputation: 198324

SELECT filmname
FROM film NATURAL JOIN film_category
WHERE category_id = 3

Upvotes: 0

Related Questions