That was a looong journey to answer Linh’s question about user activity. The association between users
and books
is many-to-many, it means there’s a join table named books_users
with both foreign keys from the users
table (user_id
) and books
(book_id
). Here’s the table’s structure:
user_id | book_id | last_page | created_at |
2305 | 470 | 37 | 2019-07-24 20:05:37.660917 |
2319 | 45 | 146 | 2019-07-24 20:05:37.707183 |
Every time a user starts reading a new book a new record to the books_users
table is added. The created_at
column has a precise date when the...