Interview Question
Software Engineer in TestsCountry: United States
Interview Type: Phone Interview
Also, fix the cases in my SQL.
If you do not use subquery, you will need a 3 table join (DVD a <--> Person <--> DVD b). both on OWNER_ID = PERSON_ID, where a.Title = 'superman' and select DISTINCT b.Title
SELECT DISTINCT b.Title
FROM (DVD a,Person p INNER JOIN Person p ON p.Person_id = a.Owner_ID) INNER JOIN DVD b ON p.PersonID = b.Owner_ID
WHERE a.Title = "Superman"
Write a query that returns the list of DVDs that belong to owners who own “Superman”
--> the list of DVDs should be distinct, and you only want the DVD Titles (At least when I was teaching assistance for a DB class, I make my student not to output useless stuff).
This line only give you SUPERMAN and nothing else. It is wrong. All, the where clause is wrong-.-
You should do subquery. first get the people with SUPERMAN, kindof like your query:
Then join them back and get all DVD title
- Mo Lam May 16, 2013