How to complete the requirement by writing an oracle sql?

  • From: Quanwen Zhao <quanwenzhao@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 10 Apr 2023 22:52:45 +0800

Hello there,

I've a requirement about how to retrieve the final calc result from two
number of tables (A and B) from oracle database, such as:

table A:

TS_NAME       USED_SIZE(MB)

--------------       ------------------------
a                     10
b                     20
c                     30
d                     40
e                     50


table B:

TS_NAME       USES_SIZE(MB)
---------------      ------------------------
a                      2
b                      6
e                      20


I expect to acquire the result like this:

TS_NAME         USED_SIZE(MB)
---------------       -------------------------
a                       8
b                      14
c                      30
d                      40
e                      30

How to use the SQL to finish it?

Best Regards
Quanwen Zhao

Other related posts: