MySql Database Design example
I am creating a website that has the following type of users:
Authors
Users
Authors sell ebooks and users buy these ebooks.
How would I design the mysql database to do the following - Allow users to
buy authors' ebooks. - Allow authors to add/edit/delete ebooks.
I was thinking of the following:
User
- id
- username
- password
- email
- created
- lastlogin
Author
- id
- user_id (foreign key on User table)
- bio
Ebook
- author_id (foreign key on Author table)
- title
- description
- date added
Transactions (to store transactions of users actually buying ebooks)
- id
- user_id
- debit_amount
- credit_amount
- date
I am new to database design. Is that the best way to design this table?
No comments:
Post a Comment