SELECT LEVEL, category_name FROM test CONNECT BY PRIOR category_id = main_category;