I was studying for a test until this question appeared
These are the tables (primary keys are in bold):
Employee
(id, name, emailAddress),Email
(emailId, senderId, receiverId, subject)EmailDetails
(emailId, date, status)The question states that:
Can someone please help me solving this out?
You can check only the email table, if an id is sender and receiver
SELECT DISTINCT senderID,receiverID FROM Email e
WHERE EXISTS (SELECT 1
FROM Email
WHERE receiverID = e.senderID AND senderIF = e.receiverID))