2017-04-23 13 views
1
USE ccva1; 

CREATE TABLE art_piece(
art_inventory_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 
artist_id INT(11) NOT NULL, 
gallery_id INT(11) NOT NULL, 
art_collection VARCHAR(4) NOT NULL, 
art_genre VARCHAR(50)NOT NULL, 
art_title VARCHAR(50)NOT NULL, 
art_medium VARCHAR(50)NOT NULL, 
art_acquired VARCHAR(200)NOT NULL, 
art_date_acquired INT(10)NOT NULL, 
art_appraisal_value VARCHAR(20), 
art_size_inches VARCHAR(65), 
art_size_centimeters VARCHAR(50), 
art_image VARCHAR(500)NOT NULL, 
art_modified_by VARCHAR(30) NOT NULL, 
art_modified_date VARCHAR(30), 
INDEX art_piece_ind(artist_id), 
FOREIGN KEY (artist_id) 
REFERENCES artist(artist_id) 
ON DELETE CASCADE, 
INDEX art_piece1_ind(gallery_id), 
FOREIGN KEY (gallery_id) 
REFERENCES gallery(gallery_id) 
ON DELETE CASCADE, 
INDEX art_piece2_ind(artist_id), 
FOREIGN KEY (art_modified_by) 
REFERENCES admin(admin_user_name) 
ON DELETE CASCADE) 
ENGINE = INNODB; 




CREATE TABLE art_exhibition(exhibition_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 
gallery_id INT(11) NOT NULL, 
exhibition_name VARCHAR(200) NOT NULL, 
exhibition_date VARCHAR(60) NOT NULL, 
exhibition_time VARCHAR(30) NOT NULL, 
exhibition_description VARCHAR(3000) NOT NULL, 
exhibition_image VARCHAR(65) NOT NULL, 
exhibition_modified_by VARCHAR(30)NOT NULL, 
exhibition_modified_date VARCHAR(30), 
INDEX gal_ind(gallery_id), 
FOREIGN KEY (gallery_id) 
REFERENCES gallery(gallery_id), 
INDEX artist_ind(artist_id), 
FOREIGN KEY (artist_id) 
REFERENCES artist(artist_id), 
CONSTRAINT admin_unique UNIQUE (admin_user_name) 
) ENGINE = INNODB; 

答えて

0

art_exhibitionartist_idという列がありません。

artistというテーブルがあると仮定して、適切なタイプ(おそらくint)のカラムを定義してから、外部キー制約を定義してください。

+0

TABLEアーティスト(artist_idのINT(11)UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY、 artist_last_name VARCHAR(50)NOT NULL、 artist_first_name VARCHAR(50)NOT NULL、 artist_bio VARCHAR(500)、 artist_modified_by VARCHAR(30)を作成しますNULL NOT、 artist_modified_date VARCHAR(30)NOT NULL、 CONSTRAINT FK_artist_ind FOREIGN KEY(artist_modified_by) REFERENCES管理(admin_user_name) UPDATE CASCADE ON DELETE CASCADE ON)。 –

+0

表art_exhibition(exhibition_idのINT(11)UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY、 gallery_idのINT(11)NOT NULL、 exhibition_name VARCHAR(200)NOT NULL、 exhibition_date VARCHAR(60)NOT NULL、 exhibition_time VARCHAR(30)を作成しますNULL、 exhibition_description VARCHAR(3000)NULL NOT、 exhibition_image VARCHAR(65)NOT NULL、 exhibition_modified_by VARCHAR(30)NOT NULL、 exhibition_modified_date VARCHAR(30)、 INDEXのgal_ind(gallery_id)、 FOREIGN KEY(gallery_id)NOT REFERENCES gallery(gallery_id)、 CONSTRAINT admin_unique UNIQUE(admin_user_name) )ENGINE = INN ODB; –

+0

申し訳ありません。私はそれを固定し、それを取ることを忘れた。 –

関連する問題