文件名称:什么是等值连接?-复杂查询技术-连接
文件大小:671KB
文件格式:PPT
更新时间:2024-05-15 15:58:09
sql
什么是等值连接? EMP DEPT … … * 外键FK 主键PK Equijoins To determine an employee’s department name, you compare the value in the DEPARTMENT_ID column in the EMPLOYEES table with the DEPARTMENT_ID values in the DEPARTMENTS table. The relationship between the EMPLOYEES and DEPARTMENTS tables is an equijoin—that is, values in the DEPARTMENT_ID column on both tables must be equal. Frequently, this type of join involves primary and foreign key complements. Note: Equijoins are also called simple joins or inner joins. Instructor Note Explain the use of a decision matrix for simplifying writing joins. For example, if you want to display the name and department number of all the employees who are in the same department as Goyal, you can start by making the following decision tree: Columns to Display Originating Table Condition last_name employees last_name='Goyal' department_name departments employees.department_id = departments.department_id Now the SQL statement can be easily formulated by looking at the decision matrix. The first column gives the column list in the SELECT statement, the second column gives the tables for the FROM clause, and the third column gives the condition for the WHERE clause.