Queries

Bret Fledderjohn freelancer317 at gmail.com
Thu Feb 26 08:03:50 EST 2009


2009/2/26 Steve Holden <steve at holdenweb.com>

> Murray wrote:
> [top-posting corrected]
>
> > -----Original Message-----
> > From: Gary Herron [mailto:gherron at islandtraining.com]
> > Sent: Thursday, February 26, 2009 1:46 AM
> > To: mmcclaf; python-list at python.org
> > Subject: Re: Queries
> >
> > mmcclaf wrote:
> >> I have to make  some queries for 4 tables I have. The following
> >> relations are:
> >>
> >> Classes(class, type, country, numGuns, bore, displacement)
> >> Ships (name, class, launched)
> >> Battles (name, date)
> >> Outcomes (ship, battle, result)
> >>
> >> The three queries I'm stuck on are the following:
> >>
> >> 1. Find the classes that have only one ship as a member of that class
> >> (not all ships are listed in the Ship table)
>
> Investigate a GROUP BY solution that selects groups having a count of 1.

DISTINCT may be a simpler solution.

>
>
> >> 2. Find the countries that had both battleships and battlecruisers
> >> (those fall under type in Classes)
>
> Look at EXISTS for one possible solutions.
>
> >> 3. Find those ships that "lived to fight another day"; they were
> >> damaged in one battle, but later fought in another.
> >>
> >From your model description I don't even see where the position and
> attitude of each ship is stored, so I don't think I can give you any
> help at all with this one.
>
> >> The best way for me to understand would be relational algebra for each
> >> of the statements.
> >>
> >
> >
> > Sounds like a homework assignment.    Good luck with it.
> >
> > It is, however I was able to get the first 8 done, I am struggling with
> > these 3 particular ones. I have to make an SQL file based off of it,
> so this
> > seems to be a blockage in my works.
> >
> Good luck with the homework. Remember to acknowledge the help you've had
> from this list (particularly your earlier issues: here you just have
> hints).
>
> regards
>  Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC              http://www.holdenweb.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
- Bret
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090226/f0c69faf/attachment-0001.html>


More information about the Python-list mailing list