SQL Query for Hierarchical data

Job ID: 35800582

Budget: $100 – $150 CAD

Anyone with expert SQL skills can do this very quickly

All queries should be supported to run on SQLlite DB

Max depth of this hierarchial data is 10

Query 1:

Given a ID query for list all of it's children (without using Recursion). Use \t represent the depth

eg: if id = 8 is passed
the output should be

'Balance Sheet',
'\tAssets',
'\tEquity',
'\tLiabilities',

if id = 2 is passed
the output should be
"Income Statement",
"\tExpense",
"\tNet Income",
"\tRevenue",
"\t\tProduct Revenue",
"\t\tServices Revenue"

Query 2:
If company_id=1 is passed it should list all the hierarchy (Without recursion)
like below. Use \t represent the depth

'Account',
'\tBalance Sheet',
'\t\tAssets',
'\t\tEquity',
'\t\tLiabilities',
'\tIncome Statement',
'\t\tExpense',
'\t\tNet Income',
'\t\tRevenue',
'\t\t\tProduct Revenue',
'\t\t\tServices Revenue',
'Department',
'\tAll Departments',
'\t\tGeneral & Administrative',
'\t\t\tFinance & Accounting',
'\t\t\tHuman Resources',
'\t\t\tOperations',
'\t\tMarketing',
'\t\tProduct',
'\t\t\tDesign',
'\t\t\tEngineering',
'Scenario',
'\tActuals',
'\tBudget'

I'll be attaching the schemas and some test data for you to match the outputs
Reminder: Do not use recursion

Max depth of this hierarchial data 10