Given two tables created as follows

create table test_a(id numeric);

create table test_b(id numeric);

insert into test_a(id) values

insert into test_b(id) values

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


In SQL Server, PostgreSQL, and SQLite, this can be done using the except keyword as follows:

select * from test_a
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.


© 2017