Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between where and on in the external connection of Oracle after and?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. When tables are associated, some conditions are written in where, and some are written in and after the associated conditions. So what's the difference?

2. We guide that table associations are generally divided into two types: inline and outreach.

3. Let's look at inline first.

4. Prepare two tables for connection. Table A: test_tb_stid; Table B: test_tb_stscore;

5. The data in Table A are shown in the following figure:

6. The data in Table B are as follows:

7. Use the red field stid as an association condition

8. Inline, put the filter conditions first and then:

select a.*, b.* from test_tb_stid ainner join test_tb_stscore bon a.stid = b.stidand a.stid = 2

9. As a result, only one item was found:

10. Put the filter conditions where

11. When inline is found, there is no difference between and and where after this filter condition is placed.

12. Let's look at outreach again.

It is found that although filtering conditions are added, table a is still full. If you do not add this a.stid=1, you should match two out, as shown below:

Note the words of outreach: 1. The main table is always full. 2. The and condition after on only affects the content of the result, not the amount of the result.

13, filter conditions added to where

It directly affects the result set.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report