Create a table with FK
CREATE TABLE `test`.`customer`( `id` MEDIUMINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, `account` VARCHAR(8), `parent_account` VARCHAR(8), UNIQUE INDEX `account` (`account`), PRIMARY KEY (`id`) );
ALTER TABLE `test`.`customer` ADD CONSTRAINT `fk_parent` FOREIGN KEY (`parent_account`) REFERENCES `test`.`customer`(`account`) ON
(
Read more... )