CREATE TABLE `Notes`
(
    `id`          int PRIMARY KEY AUTO_INCREMENT,
    `title`       varchar(50) NOT NULL,
    `content`     text        NOT NULL,
    `user_id`     int         NOT NULL,
    `last_viewed` datetime
);

ALTER TABLE `Notes`
    ADD FOREIGN KEY (`user_id`) REFERENCES `Users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;