How to ensure total participation for many to many relationship insertion in MySQL ?
Hey! Sololearn users, all i wanna achieve is to maintain foreign key for total participation. Lets consider simple example: Suppose i have schema student(sid,sname,sadd) course(cid,cname) and student-course(sid,cid) were student-course is bridge table for many to many relationship. Now what i want to achieve is if we insert a record in student table it should automatically insert referential relationship in student-course table if any record consists in course table and same for insertion on course. So it should look like student: 1 John US course: 1 DBMS 2 DSA student-course sid cid 1 1 1 2 Now if i insert a new student in student table it should maintain foreign key in student-course table with all courses as shown :(suppose new sid = 2) student-course sid cid 1 1 1 2 2 1 2 2 Also if i inserted a new record in course, it should maintain referential relationship with all student. So how can i achieve this ? Any efficient solution ?