I'm working on my first project and got question about drawing database (MySQL).
In my db-construction main product info table got connections with categories and image tables via foreign keys, so I can't figure out how to connect few images in 1 table slot with another. I think about cloud-system image import, so I'm using varchar datatype, but there's problem with URL length. I want use 3-4 images in one table slot.
Here's my code:
create table images (
img_id bigint not null auto_increment,
bigimg_url varchar(255) null,
coverimg_url varchar(255) null,
primary key (img_id)
)engine=innoDB;
And here my main product info table:
create TABLE product(
img_id bigint,
cat_id bigint,
game_id bigint auto_increment not null,
gameName varchar(50) null,
gameDesc varchar(50) null,
price DECIMAL not null,
primary key (game_id),
foreign key (cat_id) references categories(cat_id),
foreign key (img_id) references images(img_id)
)ENGINE=innoDB;