O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Other Compound Operations

Some SQL-based databases include a wider range of operations that can be performed on two query result sets. These are MINUS or EXCEPT, in which the result contains only the rows from the first result that do not appear in the second, and INTERSECT, in which the result contains only rows that appear in both results.

MySQL does not understand these keywords, but there are ways to perform these operations using other techniques.

Performing a MINUS

The MINUS operator usually is placed between two queries. The result of the first query is returned, excluding any identical rows that are produced by the second query.

Using a similar example to the others in this chapter, you could use MINUS to find only first_name values ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required