Modify bookshelf trigger to make a relational database

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify bookshelf trigger to make a relational database

leomachado666
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Modify bookshelf trigger to make a relational database

Alessandro  Vernet
Administrator
Hi Leo,

You only want each author to be added once to the the `authors` table, even if they have written multiple books; is that what you're saying?

Assuming this is the case, I imagine that you could start by deleting potentially existing authors, as you do for your bookshelf table:

delete from authors where name = extractValue(new.xml, '/form/details/author');

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Modify bookshelf trigger to make a relational database

leomachado666
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Modify bookshelf trigger to make a relational database

Alessandro  Vernet
Administrator
Hi Leo,

It is hard to know exactly what is going on just with this message, as it really isn't very specific. But, do you really need to insert authors in a separate "authors" table? Isn't it enough to have the data in the "bookshelf" table? Then if you want to get all the authors, you can do a SELECT DISTINCT author FROM bookshelf.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet