【文件属性】:
文件名称:从多个表中获取数据-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2021-04-25 19:38:15
SQL 基础
从多个表中获取数据
*
EMPNO DEPTNO LOC
----- ------- --------
7839 10 NEW YORK
7698 30 CHICAGO
7782 10 NEW YORK
7566 20 DALLAS
7654 30 CHICAGO
7499 30 CHICAGO
...
14 rows selected.
EMP
DEPT
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
*
Data from Multiple Tables
Sometimes you need to use data from more than one table. In the slide example, the report displays data from two separate tables.
EMPNO exists in the EMP table.
DEPTNO exists in both the EMP and DEPT tables.
LOC exists in the DEPT table.
To produce the report, you need to link EMP and DEPT tables and access data from both of them.
Instructor Note
In the slide, the DEPTNO column can come from either the EMP or the DEPT table.