I have a website xyz.com
that is going to be launched in an online server. I have three pages x
, y
and z
(suppose x
is for image gallery, y
is for video gallery, and z
is for another gallery). I need to have a comment section for each of the pages, and user input is going to be stored in database. There need not be any relation between the comments in different pages, or in another words, comment from one page doesn't have to relate with the comments in another pages. I want to deal them separately.
Now my question is:
Should I use one database and create just three different tables for each pages or should I create three completely different database each of them having one table? Which one is good practice?
You do not need to create the different databases and why would you?
Create 2 tables "galleries
" and "comments
"
galleries (id|title|name|type|date etc....)
Gallery type
can be "image" or "video" or etc...
when you load data for image(s) page do
select * from galleries where type='image'
and when for video
select * from galleries where type='video'
so on...
For comments:
create table
comments (id|comment_text|gallery_type...)
where gallery_type
is the foreign key
If your gallery types are lots you can always create a sperate table for gallery_types and give reference accordingly.
Use one database with as many tables as you need, there's no reason to create several databases for your project