Why would someone create an id that has a reference in the same table to some other id ? What’s the point of self referencing tables ?
Example:
CREATE TABLE Student (
id INT AUTO_INCREMENT NOT NULL,
mentor_id INT DEFAULT NULL,
PRIMARY KEY(id)
) ENGINE = InnoDB;
ALTER TABLE Student ADD FOREIGN KEY (mentor_id) REFERENCES Student(id);
That table is pulled from doctrine project reference manual in section 5.8