I'm trying to do exercise 16 from sql-ex.ru which says:

Find the pairs of PC models having similar speeds and RAM. As a result, each resulting pair is shown only once, i.e. (i, j) but not (j, i).

Result set: model with higher number, model with lower number, speed, and RAM.

I tried to follow hints from their page but my solution fails on second checking database. I have no idea what may be wrong. Could you please give me any hints?

Here is my proposed solution:

select pc1.model, pc2.model, pc1.speed, pc1.ram
from pc pc1
inner join pc pc2 on (pc1.speed = pc2.speed and pc1.ram = pc2.ram and pc1.model <> pc2.model)
where pc1.model > pc2.model