Subject Re: Interbase DB Design Question...newbie zone.....
Author dbasch
Thanks again,
Well, that makes perfect sense
Already got the docs but I do need to get a good SQL book. I have
managed to understand pretty much everything including the stored
procedures, views, triggers, etc.... However, this one little nugget
of knowledge managed to elude me. Every example of joins I have
found on the net only shows 2 tables :{ . Now Its off to practice
this and work on normalization. I think this may take some time :)
Thanks so much....everyone involved in IB is so nice :)
Derek T Basch

--- In ib-support@y..., "Martijn Tonies" <m.tonies@u...> wrote:
> Hi,
>
> > OK, that makes sense to me. I have been programming SQL for a few
> > months now. One last question that I was working up to. What if I
> > have 3 tables. For instance, add an insurer table:
> >
> > #
> > 't_insurer'
> > pk_companyid
> > companyname
> >
> > fk_company in 't_car' references pk_companyid
> > #
> >
> > Now, how do I get the cars vin#, owners first and last name and
the
> > name of the insuring company. In other words, data from 3 tables.
>
> You just JOIN a little more ... :)
>
> One of my views has this FROM clause:
>
> from debiteur d
> join adres a on (d.relatieid = a.relatieid and a.adrescode = 2)
> join relatie r on (d.relatieid = r.relatieid)
> join land l on (a.landcode = l.landcode)
>
> As you can see - 3 joins are performed...
>
> Have a go at it - but do read a book, it helps a lot. Also,
download the
> InterBase documentation for the exact syntax - go to:
>
> http://www.ibphoenix.com/main.nfs?
a=ibphoenixApp&page=ibp_interbase_download
> #Docs
>
>
> With regards,
>
> Martijn Tonies
> InterBase Workbench - the developer tool for InterBase and Firebird
> http://www.interbaseworkbench.com
>
> Upscene Productions
> http://www.upscene.com
>
> "This is an object-oriented system.
> If we change anything, the users object."
>
> > Thanks again,
> > Derke T Basch
> >
> >
> >
> >
> > --- In ib-support@y..., "Martijn Tonies" <m.tonies@u...> wrote:
> > > Hi Derek,
> > >
> > > Read a book on SQL and look op the term JOIN.
> > >
> > > Here's a go at it:
> > >
> > > select car.make, owner.fname, owner.lname
> > > from t_car car join t_owner owner on (car.fk_owner =
> > owner.pk_ownerid)
> > >
> > >
> > > With regards,
> > >
> > > Martijn Tonies
> > > InterBase Workbench - the developer tool for InterBase and
Firebird
> > > http://www.interbaseworkbench.com
> > >
> > > Upscene Productions
> > > http://www.upscene.com
> > >
> > > "This is an object-oriented system.
> > > If we change anything, the users object."
> > >
> > >
> > > > Hello Everyone,
> > > > Ok here goes. I have 2 tables 't_car' and 't_owner'.
> > > > #
> > > > 't_car'
> > > > pk_vin
> > > > make
> > > > fk_owner
> > > >
> > > > 't_owner'
> > > > pk_ownerid
> > > > fname
> > > > lname
> > > >
> > > > fk_owner refrences pk_ownerid
> > > > #
> > > >
> > > > Now, I query 'select * from t_car'. I get in return
> > > > the car vin #, car make and the foreign key value of
> > > > the car owner.
> > > > I understand how to use the foriegn key referential
> > > > contraint to refer to the 'pk_ownerid' in the owner
> > > > table. What I dont understand is how to get the values
> > > > associated with that foriegn key.
> > > > (ex...'fname','lname').
> > > > So, here is the question, how do I get a cars vin #
> > > > and the associated owners first name and last name?
> > > > Thanks for the help,
> > > > Derek T Basch
> > > > Portland OR
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Yahoo! Finance - Get real-time stock quotes
> > > > http://finance.yahoo.com
> > > >
> > > >
> > > > To unsubscribe from this group, send an email to:
> > > > ib-support-unsubscribe@e...
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > ib-support-unsubscribe@e...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >