A)
select decode(count(*), 0, \'N\', \'Y\') rec_exists
from (select \'X\'
from dual
where exists (select \'X\'
from sales
here you can check only y , n if we need to select a name as well that whether this name exists or not.
select name , decode(count(name),0, 'N', 'Y')
from table
group by name;
Here when it is Y only then it will return output otherwise it will give null always. Whts ths way to get the records not existing with N like in output we will get Name , N. When name is not existing in table