How to organize the database


I want to make a website where I start writing books. I want to build a function to add a chapter to a book.

I already made the database and the possibility to create a book. But I don't know how to organise the database. I want to be able to add chapters to a book. How can I do this in MySQL?

You can add a table named chapter with columns:

id INT 11 PK AI
number INT 11
title VARCHAR(255)
text TEXT
book_id INT 11

Book_id will be a foreign key from your book table. This way you can make new chapters for the books you want, the books_id indicates which book it's from, the title well that's obvious, text also obvious and the number would be the chapter number.