1

0

Please login or register to vote for this query.

(click on this box to dismiss)

Hinduism Meta

Q&A about the site for followers of the Hindu religion and those interested in learning more about Hinduism

create table #ACTOR (name varchar(max), age int, salary int)
create table #MOVIE (title varchar(max), studioname varchar(max),
directorname varchar(max), budget int, movieyear int)
create table #APPEARS (actorname varchar(max), movietitle varchar(max))
insert into #ACTOR values
('Tom', 45, 10000000), ('Denzel', 45, 11000000), ('Ryan', 27, 8000000),
('Seth', 31, 4000000), ('Brad', 45, 15000000), ('George', 45, 15000000),
('Meryl Streep', 55, 12000000), ('Jim', 45, 9000000), ('Chris', 25, 5000000),
('Keanu', 40, 5000000)
insert into #MOVIE values
('MovieA', 'StudioA', 'DirectorA', 100000000, 2000),
('Movie1', 'Studio1', 'Director1', 100000000, 2000),
('MovieB', 'StudioA', 'DirectorA', 10000000, 2002),
('MovieC', 'StudioA', 'DirectorA', 100000000, 2003),
('MovieD', 'StudioB', 'DirectorB', 100000000, 2004),
('MovieE', 'StudioB', 'DirectorB', 100000000, 2006),
('MovieF', 'StudioB', 'DirectorA', 100000000, 2007),
('MovieG', 'StudioC', 'DirectorC', 100000000, 2008),
('MovieH', 'StudioC', 'DirectorB', 100000000, 2010),
('MovieI', 'StudioD', 'DirectorD', 100000000, 2011),
('MovieJ', 'StudioD', 'DirectorA', 100000000, 2012),
('MovieK', 'StudioE', 'DirectorC', 100000000, 2012),
('MovieL', 'StudioC', 'DirectorC', 10000000, 2009),
('MovieM', 'StudioD', 'DirectorA', 101000000, 2009),
('MovieN', 'StudioE', 'DirectorB', 101000000, 2009),
('MovieO', 'StudioE', 'DirectorD', 90000000, 2009),
('MovieP', 'StudioF', 'John Huston', 90000000, 2009),
('MovieQ', 'StudioF', 'John Huston', 90000000, 2010),

('Movie', 'Studio', 'Steven Spielberg', 10000000, 1990),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1991),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1992),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1993),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1994),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1995),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1996),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1997),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1998),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 1999),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2000),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2001),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2002),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2003),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2004),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2005),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2006),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2007),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2008),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2009),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2010),
('Movie', 'Studio', 'Steven Spielberg', 10000000, 2010)

insert into #APPEARS values
('Tom', 'MovieA'), ('Ryan', 'MovieA'), ('Chris', 'Movie1'), ('Keanu', 'Movie1'),
('Tom', 'MovieB'), ('Tom', 'MovieC'),
('Denzel', 'MovieB'), ('Denzel', 'MovieC'), ('Denzel', 'MovieD'), ('Ryan', 'MovieD'),
('Meryl Streep', 'MovieE'),
('Meryl Streep', 'MovieB'),
('Meryl Streep', 'MovieC'),
('Jim', 'MovieJ'), ('Jim', 'MovieK'),
('Brad', 'MovieG'), ('Brad', 'MovieL'), ('Brad', 'MovieM'),
('George', 'MovieP'), ('Brad','MovieP'), ('George', 'MovieQ'),
('Chris', 'MovieE'), ('Chris', 'MovieC')






select a.name from #actor a
where a.name <> 'Meryl Streep'
AND
(

select count(*) from
(

(select movietitle
from #appears
where actorname = a.name)
intersect
(select movietitle
from #appears
where actorname = 'Meryl Streep')

) temp


) >= 2


























drop table #actor
drop table #movie
drop table #appears

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results