Back

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

I am having a query like this in MySQL:

SELECT * 
FROM Tab1
EXCEPT
SELECT * 
FROM Tab1 
WHERE int_attribute_of_Tab1>0

However, MySQL does not support the keyword EXCEPT. Is there any standard mode to use precisely another operator that simulate the except in MySQL?

1 Answer

0 votes
by (12.7k points)

You could use NOT IN, refer to the following code:

SELECT * 
FROM Tab1
WHERE id  NOT IN (
    SELECT id 
    FROM Tab1 
    WHERE int_attribute_of_Tab1>0
)

Interested in SQL?  Register to this SQL Certification course and get certified.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...