You might also store books in a LONGTEXT column in the database but bear in mind one implication of that. Suppose you have a single table holding books with columns to describe the book (what Cups showed above: title, isbn, etc.) and among them you have the content LONGTEXT column. As the amount of book data grows your SQL searches may become very slow. For example, you want to search by partial title like
SELECT * FROM books WHERE title LIKE '%80 days%';
If you have 10000 books then the database has to do full table scan of all book data. Suppose each book takes up 500KB, which means the database has to go through 5000000KB = 5000MB = 5GB of data just to find a list of books by title. Your only solution in that case is to index all columns that you will be searching and restrict your WHERE clauses so that those indexes will be used - and it may not be practical.
To resolve the issue you have to store the LONGTEXT column elsewhere - either in a separate file like Cups suggested - or in a separate table. Each solution has its vices and virtues.
Advantages of db:
- you can search the content of the books easily with mysql SELECT ... LIKE statements. This is not very powerful, though, but if a simple text search is all you need then you can consider this.
- you maintain data integrity as you can link the tables with a foreign key
- your db backups contain all book data (not just metadata)
Advantages of files:
- they are easy to offer for download without having to write any PHP scripts or engaging DB - just provide a link to the file
- easy to upload/download via FTP