I must write a Query like this in MySQL:
SELECT * FROM Tab1 EXCEPT SELECT * FROM Tab1 WHERE int_attribute_of_Tab1>0
but MySQL doesn't support the keyword EXCEPT. Is there a standard mode to use correctly another operator that simulate the except in MySQL?
MySQL does not support the EXCEPT operator.
Since MySQL does not provide support for MINUS operator. However, we can use a LEFT JOIN clause to simulate this operator. We can use the following syntax to simulate the MINUS operator: SELECT column_list FROM table1.
NOTE: MySQL does not provide support for the INTERSECT operator. This article shows us how to emulate the INTERSECT query in MySQL using the JOIN and IN clause. The following are the rules for a query that uses the INTERSECT operator: The number and order of columns in all the SELECT statements must be the same.
You could use NOT IN
SELECT * FROM Tab1 WHERE id NOT IN ( SELECT id FROM Tab1 WHERE int_attribute_of_Tab1>0 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With