Buradasın
PostgreSQL NOT IN with Subquery Usage
delftstack.com/howto/postgres/postgresql-not-in-with-subquery/Yapay zekadan makale özeti
- Basic Usage
- NOT IN operator reverses the results of IN operator
- Subquery must return multiple columns to check expression matches
- NOT IN returns true if expression isn't found in subquery data
- NULL Handling
- NULL values must be avoided in subquery data
- NOT IN works using AND operator with NULL values
- NULL values render all other true's false
- Alternative Solution
- NOT EXISTS operator can handle NULL values effectively
- EXISTS returns true if subquery returns any single row
- NOT EXISTS causes performance loss when used with NOT IN
- Performance Considerations
- Full join returns unmatched rows including NULL values
- NULL condition at end can be used to avoid NULL values
- NULL condition includes unmatched rows even if not NULL