Great Videos Frederik and amazing explanation. I think this question can also be solved using left join, in case of large tables performance of join superceds to `not in` query. Select c.first_name From customers c left join orders o on c.id = o.cust_id where o.cust_id is Null
@frederikmuller Жыл бұрын
thanks for adding your solution and calling out possible performance improvements!
@seanwayland2 ай бұрын
I think the Join answer is faster than the nested query.
@SACHINKUMAR-px8kq Жыл бұрын
Thankyou so much sir
@HolaMexicoo Жыл бұрын
in this exampe, does the distinct keyword make any difference to whether the answer is right.
@frederikmuller Жыл бұрын
it won't make a difference to the solution being accepted but using distinct will make the sub-query more efficient as it doesn't pull duplicate rows
@nehadhami612 жыл бұрын
For left join why do we need to specify WHERE condition. Left join will be automatically displaying only the data which is only in "customers" table .
@pjtarheel Жыл бұрын
That’s not correct. Left join includes all records in the left table AND records with a match in the right table.
@frederikmuller Жыл бұрын
@@pjtarheel exactly. filtering to WHERE right_table.field IS NULL after left joining essentially checks for having no matches in the right table.