I'm creating a web application, and I have an issue trying to figure out how to layout the database tables.
I'm not much of a databases guy, but here's the issue:
For example, I want the application to be have two interfaces. First one, you create a new book. Second one, you write a new entry / page in that book (or another).
I thought of having these three tables: Books, Authors, Entries.
Books
- book_id
- author_id
- title
Entries
- id
- author_id
- text
- datetime
- book_id
Authors
- author_id
- fullname
- username
Of course, tables are not complete. But I'm lost on how to build the relationships between tables well. I want the author to be able to create a new book (this is by creating first entry/page in that book, so Entries table has a new record, as well as Books.) Or, to add an entry/page to a book.
Also, I'm not sure if Books table should have an entry_id
column to track/count entries/pages in that book.
I know it might sound vague. But I didn't know what exactly to Google or specifically ask about. If there's a concept in SQL or a good book for a web programmer (I'm good at PHP) that focuses on building web applications with rather complex relations in database, that you can tell me about, would be much appreciated.
Thank you.