Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > design question...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 10995 of 11205
Post > Topic >>

design question - type heirarchy with supertype queries

by nflacco <mail.flacco@[EMAIL PROTECTED] > Apr 23, 2008 at 02:48 PM

Is there a convient way to do a supertype/subtype heirarchy in mysql
and do queries on the supertype to return sets of subtypes?

For example, suppose I have a table with several types of military
hardware:

Table:
Id----Type--------Price
1.....Mig-15.....$20
1.....Mig-17.....$32
1.....Su-27......$80
1.....T-72........$20

What I'd like to be able to do is say:
SELECT FROM Table Where Type=Mig
instead of
SELECT FROM Table Where Type=Mig-15 or Type=Mig-17

Of course, we have to assume we have a type heirarchy:

Airplane
--Mig
----Mig-15
----Mig-17
--Su
----Su-27
Tank
--T
----T-72

What's the best way to represent this type heirarchy in the database
so as to require the minimum amount of queries to get a meaningful
result like all subtypes of Mig?

Thanks in advance,
Nick
 




 4 Posts in Topic:
design question - type heirarchy with supertype queries
nflacco <mail.flacco@[  2008-04-23 14:48:28 
Re: design question - type heirarchy with supertype queries
--CELKO-- <jcelko212@[  2008-04-23 15:03:52 
Re: design question - type heirarchy with supertype queries
Hugo Kornelis <hugo@[E  2008-04-24 00:09:14 
Re: design question - type heirarchy with supertype queries
nflacco <mail.flacco@[  2008-04-23 17:38:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 5:03:20 CDT 2008.