AntiPattern
SQL Subquery Selection Pitfalls
sql-subquery-selection-pitfalls
Row selection via nested subqueries and set logic (IN/EXISTS, window functions, UNION ALL, and LIMIT-in-subqueries) can misfilter or race, especially with composite keys and transactional FK writes, leading to bloated queries, wrong row counts, or inconsistent updates.