Computer Science · Ch 9 — Structured Query Language (SQL)
Minus (−)
Minus (−)
The MINUS operation (also called set difference) is used to find rows that exist in the first table but not in the second table. It is represented by the symbol − (minus). Think of it as: "take everything from the first set, then remove anything that also appears in the second set."
Figure 9.6 illustrates this with the same Music/Dance circles used for Union and Intersect: only the crescent-shaped part of the Music circle that lies outside the overlap is shaded — the Dance circle and the overlap region are left unfilled.
MINUS is a set operation, just like UNION and INTERSECT. Both tables must have the same number of columns, and the corresponding columns must have compatible data types.
Example from the Textbook
Suppose we want the list of students who are participating only in Music, not in Dance. Applying the MINUS operation on the DANCE and MUSIC relations (Tables 9.18/9.19) gives the result the textbook shows as Table 9.22:
| SNo | Name | Class |
|---|---|---|
| 1 | Mehak | 8A |
| 3 | Lavanya | 7A |
| 5 | Abhay | 8A |
The textbook's own table is captioned "DANCE - MUSIC", but the rows it actually lists (Mehak, Lavanya, Abhay) are students in Music who are not in Dance — i.e. the data matches a MUSIC − DANCE result, not the printed caption. This is a genuine mislabelling in the source NCERT table, not an error introduced here; the figure (Figure 9.6, Music crescent shaded) is consistent with the table's data, just not with its caption.
Key Points to Remember
- MINUS is the set difference operation from mathematics. …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your NCERT textbook's own diagram.
Again the same two circles, but now only the crescent-shaped part of the Music circle that does NOT overlap with Dance is shaded — students who are in Music but NOT in Dance. …
| SNo | Name | Class |
|---|---|---|
| 1 | Mehak | 8A |
| 3 | Lavanya | 7A |