-- 专辑父表 --- 曲目 子表 --- 一对多 alter table song add music_id int; update song set music_id = 1; alter table song ADD CONSTRAINT fk_user_music FOREIGN KEY (music_id) references music(id); -- 专辑 -- 短评 1 --M ALTER TABLE review ADD music_id int ; UPDATE review SET music_id =1; ALTER TABLE review ADD CONSTRAINT fk_music_review FOREIGN KEY(music_id) REFERENCES music(id); -- 专辑 -- 用户 -- M---M CREATE TABLE tb_music_user( id int AUTO_INCREMENT PRIMARY KEY , music_id INT , user_id INT, FOREIGN KEY (user_id) REFERENCES user(id), FOREIGN KEY (music_id) REFERENCES music(id) );