Skip to content
Advertisement

SQL Query, list from BOTH values?

Pretty sure this can be answered quite quickly but I just can’t seem to find a solution online. Might I add also (if you haven’t already figured out) that I’m a complete beginner.

The following query lists all movies starring Johnny Depp and all movies starring Helena Bonham Carter. How do I list all movies starring BOTH Johnny and Helena?

Thank you!

Advertisement

Answer

See if this works for you, aggregate the title and filter where there are only 2 – assuming a person can only star in a movie once.

Also note that using aliases improves the readability and string literals should be in ‘single’ quotes, double quotes are reserved for delimiters in most databases.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement