A SQL Training

From: Devrim GUNDUZ <devrim(at)oper(dot)metu(dot)edu(dot)tr>
To: PostgreSQL Mailing Lists-SQL <pgsql-sql(at)postgresql(dot)org>
Subject: A SQL Training
Date: 2002-07-16 17:18:36
Message-ID: Pine.LNX.4.44.0207161957450.30332-100000@oper.metu.edu.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi,

Today, one of my teacher asked me a question for a practice... I could not
solve it :)

Here it comes:

We are given the name of the grandfather in a family. Let's call him A. A
has n sons, each son has children .

for example.
A -> Grandfather
/ \
/ \
B C
/\ / \ \
/ \ D E F
G H
...

We are given the data like ('A','B'),('C','D')...

Now, we do not know how many children are in the list. How could we list
this family tree in "tree" formt by only using SQL?

Best regards.

--

Devrim GUNDUZ

devrim(at)oper(dot)metu(dot)edu(dot)tr
devrim(dot)gunduz(at)linux(dot)org(dot)tr

Web : http://devrim.oper.metu.edu.tr
-------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alain Lavigne 2002-07-16 17:24:38 Need help on a troublesome query plan
Previous Message Josh Berkus 2002-07-16 16:36:31 Re: Indexing UNIONs