Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone explain how to use MINUS operator in SQL?

1 Answer

0 votes
by (119k points)

In SQL, MINUS operator subtracts the result set of the first SELECT statement from the result set of the second SELECT statement. In short, MINUS operator returns the unique records of the first SQL query but not the common records and result set of second select queries.

Here is the syntax to use the MINUS operator in SQL:

SELECT column1, column2,……column

FROM table_name

WHERE condition

MINUS

SELECT column1, column2,……column

FROM table_name

WHERE condition;

MINUS operator is only used in Oracle and for other databases like the SQL Server, we can use the EXCEPT operator instead of MINUS.

You can go through this SQL Training  by Intellipaat to learn SQL and writing queries.

Related questions

0 votes
1 answer
0 votes
1 answer
asked May 4, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked May 4, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked May 3, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked May 3, 2020 in SQL by Sudhir_1997 (55.6k points)

Browse Categories

...