Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Current database:

- When you have multiple layers of "companies" ( in a single table: Company) and every company has employees (table: Employee).

Request:

- List all company employees that have a random company as mother company, including their childs, all layers deep.

So you create a optional integer parentCompanyId on the Company for the inheritance ( that's easy)

How would you go further?

- You may not use a recursion of sql Queries (or in code) to procedurally get the parentCompany or "child companies" of all layers deep.

- You may change the database ( and you may use joins also)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: