views:

56

answers:

1

Hey today I was in a job interview where they gave us a tree with unknown structure(could b not binary) and i was asked to insert it to a database in a certain order where I could turn back the db into tree and show I have done it using ER model, every node in the tree has two data members data1 and data2

can someone answer or give me an hint for how it's done ?

EDIT: what I wrote is because every child has a father we should add relation between the nodes father and son because son has onley one father the son has a arrow one to one to his father ' i gave for everyy one of them an index and every sun had his father pointer and what does it got to do with the ER model ' i dont knoww too this is why i asked it here.

A: 

What was the position you interviewed for ?

There is no such technical term as an "ER model", it is a lay descriptive term. There are technical terms:

  • Data Model
  • the Relational Model (RM)
  • Entity Relation Diagram (ERD)
    Which is the Entities and Relations only; the Data Model minus the columns and datatypes
    Fair enough, it has been bastardised into "ER model" in some parts of the world.

If they actually asked you to provide an "ER model", they are not on the ball. But if they were on the ball, they would ask for EITHER a Data Model (unlikely for an interview) OR a ER Diagram (likely).

I think, these days, if anyone talks database, and they do not specify the type, Relational is expected.

If you talked "pointer" and "index" at the ER Diagram stage in an interview with me, I would be showing you the door. Thvia the FK e first demonstrates no understanding of the Relational Model; the second is too much detail at that high level of modelling. "Father/son" demonstrates that you do not understand B-Trees ("every member has two nodes") and Relational (the child references the parent anyway, you do not need additional work or "pointer")

When you have been give a clear acceptance/rejection notice for the job that you interviewed for, post again, I will supply the answer.

PerformanceDBA
c# programmer in an biotec firm in the middle east .and this was the question i was asked ...
yoav.str
Thanks. So it is programing job, but a db design question. And the acceptance/rejection ?
PerformanceDBA