-1

How you do this in apex oracle? I already try using this

select br_book.title, br_publisher.name
from br_book left outer join br_publisher on br_book.publisherid=br_publisher.publisherid

and the result is not like i want to.

here the question and the result should be

Show the publisher name of each book title, including books that do not have publisher and publishers that have no published books. The expected result is provided.

Result
enter image description here

  • 1
    MYSQL or ORACLE? – P.Salmon Apr 29 '18 at 06:43
  • The syntax you're looking for is the FULL OUTER JOIN. The [actual Oracle RDBMS](https://www.w3resource.com/oracle/joins/oracle-full-outer-join.php) supports this syntax but [we have to fake it in MySQL](https://stackoverflow.com/questions/4796872/how-to-do-a-full-outer-join-in-mysql) – APC Apr 29 '18 at 07:57
  • 1
    Incidentally, please don't tag MySQL questions with `[oracle]`. The Oracle Corporation does indeed own MySQL but they are two separate products with different capabilities syntax. Using conflicting tags is confusing for other people looking at your question. – APC Apr 29 '18 at 07:59
  • Hi. Please [use text, not images/links, for text (including code, tables & ERDs)](https://meta.stackoverflow.com/q/285551/3404097). Use an image only for convenience to supplement text and/or for what cannot be given in text. Use edit functions to inline, not link, if you have the rep--make your post self-contained. And never give a diagram without a legend/key. – philipxy Apr 29 '18 at 08:34

2 Answers2

0

You should add the missing result with a left join iverted on the tables

select br_book.title, br_publisher.name
from br_book 
left join br_publisher on br_book.publisherid=br_publisher.publisherid
union 
select br_book.title, br_publisher.name
from br_publisher  
left br_book join  on br_book.publisherid=br_publisher.publisherid
where br_book.publisherid is null 

or add a right join

select br_book.title, br_publisher.name
from br_book 
left join br_publisher on br_book.publisherid=br_publisher.publisherid
right join br_publisher br_book join  on br_book.publisherid=br_publisher.publisherid
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
0

Technically, NULL is not a value. For this reason, NULL is always different from NULL. Try this:

select br_book.title, br_publisher.name
from br_book left outer join br_publisher on IFNULL(br_book.publisherid,'XyX') = IFNULL(br_publisher.publisherid, 'XyX')