I have made this table:
CREATE TABLE `Users` (
`userID` varchar(10) NOT NULL,
`fName` varchar(25) NOT NULL,
`lName` varchar(30) NOT NULL,
`emailAddress` varchar(100) NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

And then this:
CREATE TABLE `Courses` (
`courseID` varchar(10) NOT NULL,
`courseName` varchar(30) NOT NULL,
PRIMARY KEY (`courseID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Now I want to create this:
CREATE TABLE `StudentCourses` (
`studentID` varchar(10) NOT NULL,
`courseID` varchar(10) NOT NULL,
PRIMARY KEY (`studentID`,`courseID`),
INDEX (`studentID`, `courseID`),
FOREIGN KEY (`studentID`) REFERENCES `Users` (`userID`) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (`courseID`) REFERENCES `Courses` (`coursesID`) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Which is supposed to be a table where both fields are needed to identify a row and the values of these two fields come from the two tables given earlier.

But I get "Error code 1005, SQL state HY000: Can't create table '.\thedatabase\studentcourses.frm' (errno: 150)"

I'm sure this can be done. Can anyone help?