MySQL Displaying columns from multiple tables Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of MySQL Displaying columns from multiple tables without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have two tables: book & publisher

book columns are: book_code, title, publisher_code

publisher columns are: publisher_code, publisher_name

I am trying to display each book title with it’s book_code, publisher_code, & publisher_name

so far this is what I have:

select book_code, title, a.publisher_code
from book a
inner join publisher p
on a.publisher_code = p.publisher_code;

I’m unsure how to also display the publisher_name

Answer

In mysql here is how I would have wrote it:

SELECT
  b.book_code,
  b.title,
  b.publisher_code,
  p.publisher_name
FROM
  book AS b
    JOIN publisher AS p USING (publisher_code);
We are here to answer your question about MySQL Displaying columns from multiple tables - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji