Created
May 7, 2014 18:54
-
-
Save Kcchouette/cd5719ee0b965fe3303d to your computer and use it in GitHub Desktop.
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
# http://across.eliteheberg.fr/upload/original/1399487731.png | |
# use picture ; | |
CREATE TABLE User (user_ID int AUTO_INCREMENT(10) NOT NULL, username VARCHAR(20), password VARCHAR(30), PRIMARY KEY (user_ID) ); | |
CREATE TABLE Picture (picture_ID int AUTO_INCREMENT(10) NOT NULL, description TEXT, public BOOL, name VARCHAR(60), hash CHAR(128), PRIMARY KEY (picture_ID) ) ENGINE=InnoDB; | |
CREATE TABLE Tag (tag_ID int AUTO_INCREMENT NOT NULL, tags VARCHAR(100), hits INT(10), PRIMARY KEY (tag_ID) ); | |
CREATE TABLE upload (user_ID int AUTO_INCREMENT(10) NOT NULL, picture_ID INT(10) NOT NULL, PRIMARY KEY (user_ID, picture_ID) ); | |
CREATE TABLE caracteristique (picture_ID int AUTO_INCREMENT(10) NOT NULL, tag_ID INT NOT NULL, PRIMARY KEY (picture_ID, tag_ID) ); | |
ALTER TABLE upload ADD CONSTRAINT FK_upload_user_ID FOREIGN KEY (user_ID) REFERENCES User (user_ID); | |
ALTER TABLE upload ADD CONSTRAINT FK_upload_picture_ID FOREIGN KEY (picture_ID) REFERENCES Picture (picture_ID); | |
ALTER TABLE caracteristique ADD CONSTRAINT FK_caracteristique_picture_ID FOREIGN KEY (picture_ID) REFERENCES Picture (picture_ID); | |
ALTER TABLE caracteristique ADD CONSTRAINT FK_caracteristique_tag_ID FOREIGN KEY (tag_ID) REFERENCES Tag (tag_ID); | |
#a_uploadé = upload | |
#possède = caracteristique |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
password VARCHAR(30)*
tag_texte et pas tags*