From the course: Advanced SQL: High Performance Relational Divisions
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Relational division using nested subqueries - SQL Tutorial
From the course: Advanced SQL: High Performance Relational Divisions
Relational division using nested subqueries
- [Instructor] Our final solution technique involves double nesting of correlated EXISTS subqueries. Sounds complicated, right? Don't answer. It's a rhetorical question. Like many things in life, what seems to be the most complex at first may turn out to be the simplest. Let's begin with a familiar task and find candidates who have all skills. The key to this technique is to rephrase the task at hand from a positive form to a double negative one. Yes, it is counter-intuitive for most humans and it will seem strange at first. Find all candidates who have all skills is a positive statement, but it can be rephrased as find all candidates for whom there isn't a skill that they don't possess. Isn't, don't. Double negative. Pause the video and make sure it is clear why these two statements are equivalent. And believe it or not, that's pretty much it. This weird sounding double negative statement can be translated…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.