-
Notifications
You must be signed in to change notification settings - Fork 1
/
mangaDB_create.sql
48 lines (41 loc) · 1.16 KB
/
mangaDB_create.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
CREATE DATABASE IF NOT EXISTS MangawebDB;
USE MangawebDB;
CREATE TABLE Manga (
mangaID INT AUTO_INCREMENT PRIMARY KEY,
description TEXT,
author VARCHAR(255),
title VARCHAR(255),
published_date DATE
);
CREATE TABLE Chapter (
mangaID INT,
chapterNumber INT,
all_chapter_images_folder_location VARCHAR(500),
FOREIGN KEY (mangaID) REFERENCES Manga(mangaID),
PRIMARY KEY(mangaID, chapterNumber)
);
CREATE TABLE Individual_Chapter_Images (
mangaID INT,
chapterNumber INT,
imageNumber INT,
imageLocation VARCHAR(500),
PRIMARY KEY (mangaID, chapterNumber, imageNumber),
FOREIGN KEY (mangaID, chapterNumber) REFERENCES Chapter(mangaID, chapterNumber)
);
CREATE TABLE Category (
categoryName VARCHAR(255) PRIMARY KEY,
description TEXT
);
CREATE TABLE MangaCategory (
mangaID INT NOT NULL,
categoryName VARCHAR(255) NOT NULL,
PRIMARY KEY (mangaID, categoryName),
FOREIGN KEY (mangaID) REFERENCES Manga(mangaID),
FOREIGN KEY (categoryName) REFERENCES Category(categoryName)
);
create table User(
userID INT PRIMARY KEY,
name VARCHAR(255),
password VARCHAR(255),
profile_pic VARCHAR(300)
);