So I'm learning SQL at Khan Academy and I can't get my code to work properly to complete the third step of the Playlist maker challenge. I'm supposed to use a nested subquery with an IN operator. I pasted my code below.
The first two sql statements are valid for the steps 1 and 2 of the challenge. The third and fourth statements are my attempts at completing the third step. How do I correct it to complete the challenge?
SELECT title FROM songs WHERE artist = "Queen";
SELECT name FROM artists WHERE genre = 'Pop';
SELECT name FROM artists WHERE genre IN ( SELECT title FROM songs WHERE artist = 'Queen');
SELECT title FROM songs WHERE artist IN ( SELECT name FROM artists WHERE artist LIKE 'Pop');
Guessing a little bit, because you don't provide schema data here, but
3.should probably be:Which would return all artists that also have a song in any genre where Queen wrote a song. Similarly, for
4.:Ought to give you all song titles for all artists if their genre starts with 'Pop'.