Correct sql syntax and add the favorites table