modified SQL (favorites)