--- Christopher Petrilli <[EMAIL PROTECTED]> wrote:
> On Tue, 22 Feb 2005 08:58:45 -0800 (PST), Jay
> <[EMAIL PROTECTED]> wrote:
> >
> > This is probably going to be hard but you did ask...
> >
> > SQLite version 3.0.8
> > Enter ".help" for instructions
> > sqlite> create table x( a text );
> > sqlite> insert into x(a) values('one');
> > sqlite> create view y as select a from x;
> > sqlite> select * from y;
> > one
> > sqlite> insert into y(a) values('two');
> > SQL error: cannot modify y because it is a view
> > sqlite>
> >
> > It would be really nice if I could join multiple tables into a view
> > and insert data into the view. :)
>
> And which table did you plan for the data to go into? What you're
> asking for is data partitioning, really. That's a totally different
> concept, and I suspect outside the goals of SQLite.
I wanted it to read my mind and do what I want of course! ;)
Inserting to a calculated column would be impossible.
You would have to make some assumptions to get it to work:
* There's a one to one relationship in the joins.
* no calculated columns
* columns in source tables not references get NULL
* join columns all get the same value
For normalized data it doesn't seem too difficult:
create view v from
select a.x, b.y
from a
inner join b on a.unique_id = b.unique_id
insert into v(x,y) values( 1, 2 )
is equal to:
insert into a(x,id) values( 1,null );
get rowid from insert;
insert into b(y,id) values(2,rowid);
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com