Testing SQL relations