mysql database design?
i am learning php and mysql from my own using INTERNET. i am having problem in designing database. suppose i am creating social networking kind of site , how to make database and tables . i am confused.
suppose i am creating many database like user account, user msgs, and user image.
last two database contains tables for each single user seperatly for storing their msgs and images.
or should i single database containg many tables but all user sharing same table for images and msg storing, it is quite messy.
plz give me some ideas
thank you
Comments
With all database design, you need to apply the same principals.
What outputs do you want?
Then what data is required for these, use plain English at this stage?
Normalise the data - if you don't know what this is, borrow a good database book from the library.
Now you can look at what tables and fields you require.
You only need one database to perform these task.
Create a table (lets say users) for user and create fields to uid (to uniquely identify a user), username, email, password, image (for image specify the path of that image - you don't need separate table for user images). Create another table for messages, and create columns such as senderid, reciverid, subject, and message so you can write queries to retrieve data when you want.
Don't try to store images in database. It is not a good practice. Instead, just put all user pictures in the hard disk and specify the path for that image in the image field in the users table.
I have created such a system for a project and now it works perfectly. If you want any help just ask.