Skip to content
Advertisement

SQL Query giving wrong output

I have written this code to find “For each year, count the number of movies in that year that had only female actors”.

I am getting this output –

When i had submitted this code, then i get response that “your output is wrong. when selecting non-female movies you should also include MID’s which have null PID’s in M_cast table as non-female movies too”. Hence i am a beginer in sql, i am not getting that where i am wrong. Please suggest me that where i need to modify this code.

Here is the schema – https://i.stack.imgur.com/sWRSN.png

Advertisement

Answer

You could use a UNION ALL with M_CAST where PID is NULL as per your requirement

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