Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to Query Min PK Value NOT in Table

Re: How to Query Min PK Value NOT in Table

From: simon <simon_at_simon.com>
Date: Thu, 23 Jun 2005 05:27:47 +0800
Message-ID: <42b9d7d1$1_2@rain.i-cable.com>


>
> in your scenario, your non-existent values should exist in another table:
> SEAT (a master list of seats)
>
> you also need an EVENT table
>
> your RESERVATION table then becomes an associative table that allows each
> SEAT to be booked once for each EVENT. if the RESERVATION is cancelled,
the
> RESERVATION row is deleted -- the SEAT and the EVENT still exist.
>
> you will then find available seats and blocks of seats by an outer-join on
> SEAT and RESERVATION (for a specific EVENT ID), likely with a GROUP BY and
> COUNT to determine number or adjacent seats
>
> you may want to google this newsgroup for previous recommendations on data
> modeling books
>
> ++mcs
>
>

Thx Mark,

My schema isnt the one you suggested but you do remind me of the use of PIVOT TABLE (functions as the SEAT table you suggested) and OUTER JOIN to generate the rows not in the table. Received on Wed Jun 22 2005 - 16:27:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US