Last active
November 25, 2021 17:27
-
-
Save dineshsonachalam/cd0d492097c367a8162453f5a991711e to your computer and use it in GitHub Desktop.
image_tagging_system.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS app_user ( | |
user_id SERIAL PRIMARY KEY, | |
email VARCHAR(255) NOT NULL, | |
password VARCHAR(255) NOT NULL | |
); | |
CREATE TABLE IF NOT EXISTS image ( | |
image_id SERIAL PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
created_by INT NOT NULL references app_user(user_id) | |
); | |
CREATE TABLE IF NOT EXISTS tag ( | |
tag_id SERIAL PRIMARY KEY, | |
name VARCHAR(255) NOT NULL | |
); | |
CREATE TABLE IF NOT EXISTS tag_map ( | |
tag_map_id SERIAL PRIMARY KEY, | |
image_id INT NOT NULL references image(image_id), | |
tag_id INT NOT NULL references tag(tag_id) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment