--Three formats for connection queries select Ename, deptno,dname from EMP Natural join Dept;select ename, deptno,dname from EMP Join dept using (DEPTN o); Select Emp.ename, emp.deptno,dept.dname from EMP Join dept on emp.deptno!=dept.deptno;--Self-connect, treats a table as two tables for select E.ename,m.ename from EMP e-jo
1, left outside the connection to leave outer join, or leaving Jion,outer can be omitted to write, the bottom of the right connection and full connection is the same:The left outer join means that the data in the table on the left side of the right
1. Left OUTER JOIN: External Association
SELECT E.last_name, e.department_id, D.department_name
From Employees E
Left OUTER JOIN Departments D
On (e.department_id = d.department_id);
Equivalent to
SELECT E.last_name, e.department_id, D.department_name
From Employees e, departments D
WHERE e.department_id=d.department_
Recent BA user feedback has two seemingly very similar statements return the number of results is not the same, more strange, doubt is not hive bug
Query 1 Returns the number of results 6071
Select COUNT (Distinct reviewid) as dis_reviewcnt
from
(select A.reviewid from
bi.dpods_dp_reviewreport a left
outer join Bi.dpods_dp_reviewlog B on
a.reviewid=b.reviewid and b.hp_statdate= ' 2013-07-24 '
In the basic estimation process of all SQL statements, the calculation process of JOIN statements is the most complex, and JOIN statements are the focus of performance optimization. This article focuses on the calculation methods and inputs used by the DB2 optimizer for base estimation.
Introduction
The optimizer is the heart and soul of
The following articles mainly describe the result set estimation of JOIN statements in the DB2 optimizer. In actual operations, when the DB2 optimizer generates an execution plan for SQL statements, in actual operation, the result set generated by each step is estimated in size, which is the basis estimation of the optimizer.
In the basic estimation process of al
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.