Hello
I am designing a table which will define the relationship between photos and albums. Each album has an id and also each photo has an id.
The following table defines this relationship:
CREATE TABLE photo_in_album (
Album_ID INT UNSIGNED NOT NULL,
Image_ID INT UNSIGNED NOT NULL,
Photo_Order INT UNSIGNED NOT NULL,
PRIMARY KEY (Album_ID, Image_ID)
) ENGINE=MYISAM DEFAULT CHARSET=latin1;
The user should be able to define the order of the photos inside an album. This is where Photo_Order column comes into play. This column defines the order of the photo inside the particular album.
Here is an example:
I have 5 photos (ids: 23, 8, 3, 9 and 5) in album 4.
The order of the photos in that album should be: 8, 9, 23, 5 and 3.
The table will then look like:
Album_ID Image_ID Photo_Order
4 23 3
4 8 1
4 3 5
4 9 2
4 5 4
I will then use the Photo_Order column to sort the photos
Does that sound like a good solution?
Will I have efficiency problems when the user changes the order of photos?
regards
David