Product Information > JADE External Interface Developer’s Reference > Chapter 2 - Using External Interfaces > Many-to-Many Relationship
Many-to-Many Relationship

In these examples, the Book and Author classes have been included in the view. The Author class has an allBooks property that is a dictionary. The Book class has an authors property that is an array. These examples also create the Book_authors table, which contains author_oid, book_oid, and number.

The SQL statements in the following example list a book and all its authors.

SELECT * FROM Book, Book_authors, Author
    WHERE Book.oid = Book_authors.book_oid
    AND Book_authors.author_oid = Author.oid
    AND Book.name = 'War of the Worlds'

The SQL statements in the following example list the first author of all books.

SELECT * FROM Book, Book_authors, Author
    WHERE Book.oid = Book_authors.book_oid
    AND Book_authors.author_oid = Author.oid
    AND Book_authors.number = 1

The SQL statements in the following example list an author and its books.

SELECT * FROM Author, Author_allBooks, Book
    WHERE Author.oid = Author_allBooks.author_oid
    AND Author_allBooks.book_oid = Book.oid
    AND Author.name = 'HG Wells'