Write a query to fetch values in table test_a that are and not in test_b without using the NOT keyword

Given two tables created as follows

insert into test_a(id) values
  (10),
  (20),
  (30),
  (40),
  (50);
insert into test_b(id) values
  (10),
  (30),
  (50);

Write a query to fetch values in table test_a that are and not in test_b without using the NOT keyword.

select * from test_a
except
select * from test_b;

In Oracle, the minus keyword is used instead.

MySQL does not support the except function, so it is necessary to use not in.

note

http://stackoverflow.com/a/12438213/2545270

http://stackoverflow.com/questions/1662902/when-to-use-except-as-opposed-to-not-exists-in-transact-sql

results matching ""

    No results matching ""