Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
If yes how do i differentiate between the profile pic and pics of photo album .. my database table design for profile pic is

Column Name Data Type Allow Nulls
PhotoId bigint No
PhotoPath nvarchar(150) Yes
CandidateId bigint No
IsDefault bit Yes
IsDeleted bit Yes
CreatedUser int Yes
CreatedDt datetime Yes
LastModUser int Yes
LastModDt datetime Yes
Posted

One or two tables depends how different the requirements for those tables are. When adding the profile picture if you need different kind of information than with photo album rows, then it could be better to separate those tables. If the data is similar then just add a descriptive column as Abhinav suggested.
 
Share this answer
 
Comments
Member 7764639 5-Apr-11 22:04pm    
okay . but i hav already live site .. so may be i need to take a different table .. also how do i put constrain of max 5 photos in photo album.
Wendelius 6-Apr-11 15:37pm    
If the database is live, adding the table may be necessary. Although if you add columns which allow null values, the existing programs may not be affected as long as they don't fetch everything (SELECT * ...) and so on. SO to be on the safe side (if you don't have the control over the applications), add a new table.

Just wondering, why the vote 2 for this answer if it was helpful?
Member 7764639 7-Apr-11 6:42am    
so how should my new table design be
a user can upload max of 5 photos in his album.and only 1 album per user
Wendelius 7-Apr-11 13:57pm    
Dpeends on the overall situation. If you already have a user table then you could simply create a table having columns:
- userid
- picture
Now the tricky part is that you cannot directly restrict the table having more than 5 rows per user so you should check how many picture the user has (like: SELECT COUNT(*) from Pictures WHERE UserID = @UserId) and if the count is 5 then don't allow any more pictures in the user interface.
Member 7764639 7-Apr-11 23:16pm    
but then if a user wants to delete a photo on wt condition i remove it ?
I would recommend adding another boolean for IsProfile picture.
You should not need to create another table unless there is some other specific solution you are looking for.
 
Share this answer
 
Comments
Member 7764639 3-Apr-11 1:10am    
okie .. but how to change bit value for IsProfile pic while uploading profile pic
i have two different pages for uploading profile pic and photo album
if the database is live it is preferable to add another table
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900