-
SQL语言基础中包括生成笛卡尔积的指令
资源介绍
产生一个笛卡尔积
*
ENAME DNAME
------ ----------
KING ACCOUNTING
BLAKE ACCOUNTING
...
KING RESEARCH
BLAKE RESEARCH
...
56 rows selected.
EMP (14 行)
DEPT (4 行)
EMPNO ENAME ... DEPTNO
------ ----- ... ------
7839 KING ... 10
7698 BLAKE ... 30
...
7934 MILLER ... 10
DEPTNO DNAME LOC
------ ---------- --------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
“笛卡尔积
运算结果:
14*4=56行”
*
Cartesian Product (continued)
A Cartesian product is generated if a join condition is omitted. The example on the slide displays employee name and department name from EMP and DEPT tables. Because no WHERE clause has been specified, all rows (14 rows) from the EMP table are joined with all rows (4 rows) in the DEPT table, thereby generating 56 rows in the output.
Instructor Note
Demo: l4cart.sql
Purpose: To illustrate executing a Cartesian product.
SQL> SELECT ename, dname
2 FROM emp, dept;
ENAME DNAME
---------- --------------
KING ACCOUNTING
BLAKE ACCOUNTING
...
KING RESEARCH
BLAKE RESEARCH
...
56 rows selected.
- 上一篇: mac破解系统
- 下一篇: Access2003数据库应用基础教程