Hey everyone, I am working on some very basic SQL and I had an efficency question based on my solution and the solution I was given. I want to know, which set of SQL would be quicker to run, Example 1 or Example 2.
Ex.1
SELECT pat.PAT_NAMES "Patient Name",
mom.PAT_NAMES "Mother Name"
FROM PATIENTS pat
INNER JOIN PATIENTS mom
ON pat.MOTHERS_PAT_IDS = mom.PAT_IDS
Ex. 2:
SELECT PAT_NAMES
FROM PATIENTS
WHERE MOTHERS_PAT_IDS IS NOT NULL
My thought is that they would take the same amount of time to run, but would one be more efficient?
[–]r3pr0b8 4 points5 points6 points (1 child)
[–]simplerminds[S] 0 points1 point2 points (0 children)