I need assistance creating a query for two tables.
- The first table - booksalready has an author (the author's name) and illustrator (illustrator) in the- authorand- illustratorcolumn.
- The second table - peoplealso has the name of the author in the- namecolumn.
- The third table - books_peoplehas the two columns- book_idand- author_idand a third column called- occupation
This is more of a conversion from having the authors directly in the books table to having a separate table creating a relation between two tables (one-to-many) ( table: books_authors ). I would also need help making the column of that relation submit the occupation.
Books Table:
+----+--------------+----------------+-----------------+ | id | title | author | artist | +----+--------------+----------------+-----------------+ | 1 | Tower of God | SIU | SIU | | 2 | Zippy Ziggy | KIM Eun-jung | HWANG Seung-man | | 4 | Beelzebub | Tamura Ryuuhei | Tamura Ryuuhei | +----+--------------+----------------+-----------------+
People Table:
+-------+-----------------+ | id | name | +-------+-----------------+ | 32 | SIU | | 4053 | KIM Eun-jung | | 4055 | HWANG Seung-man | | 28490 | Tamura Ryuuhei | +-------+-----------------+
Books_People Table
+----------+-----------+----------------+ | comic_id | person_id | occupation | +----------+-----------+----------------+
Expected result:
+----------+-----------+----------------+ | comic_id | person_id | occupation | +----------+-----------+----------------+ | 1 | 32 | author, artist | | 2 | 4053 | author | | 2 | 4055 | artist | | 4 | 28490 | author, artist | +----------+-----------+----------------+
What im trying to do here is "create" the rows after the relations have been made.
