Question

I created this table on MYSQL:

CREATE TABLE Enrolled (   
    snum int,      
    cname varchar(60),  
    PRIMARY KEY (snum,cname)  
    FOREIGN KEY (snum)  
    REFERENCES Student(id),  
    FOREIGN KEY (cname)  
    REFERENCES Class(name)  
) ENGINE = INNOdb;
  • How do I put a minimum and maximum number of rows? For example, If I want the table to have minimum 5 rows but not exceed 30 rows? (Each class needs at least 5 students but no more than 30 students)
  • How do I establish on MYSQL that each student must be enrolled in at least two courses?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top