product table
| product_id | name | 
|---|---|
| 1 | t-shirt | 
| 2 | shirt | 
users table
| user_id | name | 
|---|---|
| 1 | sphinx | 
favorite table with a UNIQUE constraint on (user_id, product_id):
| user_id | product_id | 
|---|---|
| 1 | 2 | 
What is best way to query this table for user_id = 1
favorite_count: how many users added this product in favorite?
isfavorite: did user with user_id = 1 add this product as favorite?
Expected result:
| product_id | product_name | isfavorite | favorite_count | 
|---|---|---|---|
| 1 | t-shirt | false | 0 | 
| 2 | shirt | true | 1 | 
 
    