db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Van Couvering <da...@vancouvering.com>
Subject Re: Derby minimum size tweaking: how far can I go?
Date Tue, 27 Mar 2007 17:40:26 GMT
Hm, I guess this would work.  It would be nice if some day we supported 
storing all tables in a single file...

David

Bryan Pendleton wrote:
>> Is there a way to reduce this number, by storing several/all tables 
>> into one 'data' file?
> 
> You could accomplish this in your application, by defining a single
> table with a very general physical schema, then using view definitions
> and careful application coding to store logically distinct records into
> the same physical table.
> 
> E.g., suppose you have two data types:
>  - EMPLOYEE (E_ID, E_NAME, E_SSN, E_DEPT_ID)
>  - DEPARTMENT (D_ID, D_NAME, D_MGR_ID)
> 
> Define a single table with the schema:
>   (ROW_TYPE, ID, NAME, E_SSN, E_DEPT_ID, D_MGR_ID)
> 
> Then define two VIEWs:
>  - EMP_VIEW as select ID as E_ID, NAME as E_NAME, E_SSN, E_DEPT_ID
>    where ROW_TYPE = 1
>  - DEPT_VIEW as select ID AS D_ID, NAME as D_NAME, D_MGR_ID
>    where ROW_TYPE = 2
> 
> And to store employee records, insert the correct set of columns
> and make sure that you set ROW_TYPE to 1, while for department
> records, insert the correct set of columns and make sure that
> you set ROW_TYPE to 2.
> 
> thanks,
> 
> bryan
> 
> 
> 

Mime
View raw message