SQL Social-Network Modification Exercises

 
SQL Social-Network Modification Exercises

Extremely easy Modification Queries
The second question is a little tricky. If you have practice enough the select queries it would be a piece of cake. Have Fun. Don't cheat. You can try them to a local database (e.g. Access) if you have troubles.

Question 1
It's time for the seniors to graduate. Remove all 12th graders from Highschooler.
DELETE FROM Highschooler WHERE grade =12

Question 2
Delete all the tuples (ID1,ID2) from LIKES table where ID1 is friend with ID2, ID1 likes ID2 but not vice-verca.



DELETE FROM LIKES 
WHERE ID1 IN 
(SELECT L.ID1
FROM FRIEND F,LIKES L
WHERE F.ID1 = L.ID1 AND F.ID2 = L.ID2
AND F.ID1 NOT IN (SELECT ID2 FROM LIKES WHERE ID1=L.ID2 AND ID2=L.ID1))

Σχόλια

Δημοφιλείς αναρτήσεις