Citation :
CREATE TABLE `categories` (
`index_cat` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(12) NOT NULL,
PRIMARY KEY (`index_cat`)
)
TYPE = innodb
COMMENT = 'la table categories';
CREATE TABLE `images` (
index_images MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, format VARCHAR(12), teinte VARCHAR(12) NOT NULL, index_cat SMALLINT UNSIGNED,
INDEX idx(index_cat),
PRIMARY KEY (index_images),
CONSTRAINT fk_index_cat FOREIGN KEY (index_cat) REFERENCES categories (index_cat) ON DELETE CASCADE
)
TYPE = innodb
COMMENT = 'la table images';
CREATE TABLE `tag_es` (
index_es MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
tags_es VARCHAR(32) NOT NULL, index_images MEDIUMINT UNSIGNED,
INDEX idx(index_images),
PRIMARY KEY (index_es),
CONSTRAINT fk_index_images FOREIGN KEY (index_images) REFERENCES images (index_images) ON DELETE CASCADE
)
TYPE = innodb
COMMENT = 'la table espagnole';
CREATE TABLE `tag_fr` (
index_fr MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
tags_fr VARCHAR(32) NOT NULL,
index_images MEDIUMINT UNSIGNED,
INDEX idx(index_images),
PRIMARY KEY (index_fr),
CONSTRAINT fk_index_images FOREIGN KEY (index_images) REFERENCES images (index_images) ON DELETE CASCADE
)
TYPE = innodb
COMMENT = 'la table francaise';
|