Primeira pergunta: SELECT id FROM table_a WHERE id IN (101, 103) GROUP BY id HAVING COUNT(DISTINCT id) = 2