文件名称:产生一个笛卡尔积-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:24:56
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.