If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > directors, actors, films (was "SqlPlus query. Need some help")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-06, 19:02
dbnewbee dbnewbee is offline
Registered User
 
Join Date: Apr 2006
Posts: 3
directors, actors, films (was "SqlPlus query. Need some help")

What i want to find is the following:

Find first and lastname for all female directors who have directed more than 5 movies,
and have used the same actor in all of their movies.

I've done the first part of this query which lists female directors with more than 5 movies:


select firstname, lastname
from person
where gender = 'F' AND personid in
(select personid
from participation
where partname = 'director'
group by personid
having count(personId)>5)
order by surname;


Now, how do I find the directors that have used the same actor in all of their movies?

directors, actors, films (was "SqlPlus query. Need some help")-db1.jpg

Last edited by dbnewbee; 04-23-06 at 19:28.
Reply With Quote
  #2 (permalink)  
Old 04-23-06, 20:34
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
HOMEWORK!

how do you define an actor? and when you say "have used the same actor in all of their movies" does this mean any actor or all actors?

by the way, you shouldn't have participation_id as the primary key of Participation -- the primary key should consist of the pair of columns person_id, film_id
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-23-06, 21:39
dbnewbee dbnewbee is offline
Registered User
 
Join Date: Apr 2006
Posts: 3
1. an actor is defined to participate in a film whenever partname = 'actor'.

2. Any actor is sufficient
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On