-
-
Save ihorvorotnov/df852eabe787d716af08 to your computer and use it in GitHub Desktop.
Example table for recursion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; | |
CREATE TABLE IF NOT EXISTS `users` ( | |
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'userID key for relations', | |
`login` varchar(32) NOT NULL, | |
`password` varchar(32) NOT NULL, | |
`paymentpassword` varchar(32) NOT NULL, | |
`email` varchar(32) NOT NULL, | |
`sponsorid` int(10) NOT NULL, | |
`authcode` varchar(32) NOT NULL, | |
`status` int(2) NOT NULL DEFAULT '0', | |
`datejoined` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `login` (`login`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=417 ; | |
INSERT INTO `users` (`id`, `login`, `sponsorid` ) VALUES | |
(1, 'harikaev', 2), | |
(2, 'magnit', 1), | |
(3, 'favorit', 1), | |
(4, 'monarh', 1), | |
(5, 'zeesta2304', 2), | |
(6, 'superrich', 2), | |
(7, 'oligarh', 3), | |
(8, 'Desire', 3), | |
(9, 'uspeh', 5), | |
(10, 'gloriya', 5), | |
(11, 'Mamulia', 6), | |
(13, 'unitedcash', 4), | |
(14, 'BLAGODAR', 4), | |
(15, 'komiz', 7), | |
(16, 'triumph', 7), | |
(17, 'Melody', 8), | |
(18, 'bayalig888', 8), | |
(19, 'STAGER', 13), | |
(20, 'aisultan', 13), | |
(21, 'VMESTE', 14), | |
(22, 'NEFERTITI', 14), | |
(23, 'Lady', 15), | |
(24, 'magnit99', 15), | |
(25, 'bogema', 16), | |
(26, 'kopram', 16), | |
(27, 'luch', 9), | |
(28, 'udacha', 9), | |
(29, 'ramazanshabanov', 10), | |
(30, 'LuckyStar', 10), | |
(31, 'priora', 27), | |
(32, 'vsegdauspeh', 27), | |
(33, 'Yuliia', 28), | |
(34, 'specialist', 28), | |
(35, 'luxury716', 17), | |
(36, 'enjoycash', 35), | |
(37, 'mariyaS', 18), | |
(38, 'money', 11), | |
(39, 'golden55', 37), | |
(40, 'alex4535', 23), | |
(41, 'goldmir', 40), | |
(42, 'verba', 24), | |
(43, 'istochnik888', 42), | |
(44, 'zea55', 19), | |
(45, 'Aliviya13', 20), | |
(46, 'urozhay288', 20), | |
(47, 'laguna288', 46), | |
(48, 'tais', 25), | |
(49, 'igilik88', 48), | |
(50, 'selena', 26); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected tree output:
(15, 'komiz', 7),
(23, 'Lady', 15),
(40, 'alex4535', 23),
(24, 'magnit99', 15),
(42, 'verba', 24),
(6, 'superrich', 2),
(11, 'Mamulia', 6),
(38, 'money', 11),
(3, 'favorit', 1),
(7, 'oligarh', 3),
(15, 'komiz', 7),
(23, 'Lady', 15),
(40, 'alex4535', 23),
(41, 'goldmir', 40),
(24, 'magnit99', 15),
(42, 'verba', 24),
(43, 'istochnik888', 42),
(16, 'triumph', 7),
(25, 'bogema', 16),
(48, 'tais', 25),
(49, 'igilik88', 48),
(26, 'kopram', 16),
(50, 'selena', 26);
(8, 'Desire', 3),
(17, 'Melody', 8),
(35, 'luxury716', 17),
(36, 'enjoycash', 35),
(18, 'bayalig888', 8),
(37, 'mariyaS', 18),
(39, 'golden55', 37),