Вы можете создать свою базу данных следующим образом.
Эта схема позволяет назначать несколько категорий и добавлять несколько изображений, которые можно отслеживать по отдельности.
CREATE TABLE BlogPost
(
blogPostNr INT NOT NULL,
author CHAR(40) NOT NULL,
categoryNr INT NOT NULL,
`date` DATETIME NOT NULL,
status CHAR(5) NOT NULL,
text VARCHAR(2000) NOT NULL,
title CHAR(100) NOT NULL,
userId SMALLINT NOT NULL,
CONSTRAINT BlogPost_PK PRIMARY KEY(blogPostNr)
);
CREATE TABLE Image
(
imageNr INT NOT NULL,
description CHAR(200) NOT NULL,
picture LONGBLOB NOT NULL,
source CHAR(60) NOT NULL,
CONSTRAINT Image_PK PRIMARY KEY(imageNr)
);
CREATE TABLE BlogPostHasImage
(
blogPostNr INT NOT NULL,
imageNr INT NOT NULL,
CONSTRAINT BlogPostHasImage_PK PRIMARY KEY(blogPostNr, imageNr)
);
CREATE TABLE Category
(
categoryNr INT NOT NULL,
categoryName CHAR(20) NOT NULL,
CONSTRAINT Category_PK PRIMARY KEY(categoryNr)
);
ALTER TABLE BlogPost ADD CONSTRAINT BlogPost_FK FOREIGN KEY (categoryNr) REFERENCES Category (categoryNr) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE BlogPostHasImage ADD CONSTRAINT BlogPostHasImage_FK1 FOREIGN KEY (blogPostNr) REFERENCES BlogPost (blogPostNr) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE BlogPostHasImage ADD CONSTRAINT BlogPostHasImage_FK2 FOREIGN KEY (imageNr) REFERENCES Image (imageNr) ON DELETE RESTRICT ON UPDATE RESTRICT;