Đang chuẩn bị liên kết để tải về tài liệu:
Using SET Operators

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

After completing this lesson, you should be able to do the following: Describe SET operators Use a SET operator to combine multiple queries into a single query Control the order of rows returned | Using SET Operators Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe SET operators Use a SET operator to combine multiple queries into a single query Control the order of rows returned Lesson Aim In this lesson, you learn how to write queries by using SET operators. The SET Operators A B UNION/UNION ALL A B A B INTERSECT A B MINUS The SET Operators The SET operators combine the results of two or more component queries into one result. Queries containing SET operators are called compound queries. All SET operators have equal precedence. If a SQL statement contains multiple SET operators, the Oracle server evaluates them from left (top) to right (bottom) if no parentheses explicitly specify another order. You should use parentheses to specify the order of evaluation explicitly in queries that use the INTERSECT operator with other SET operators. Note: In the slide, the | Using SET Operators Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe SET operators Use a SET operator to combine multiple queries into a single query Control the order of rows returned Lesson Aim In this lesson, you learn how to write queries by using SET operators. The SET Operators A B UNION/UNION ALL A B A B INTERSECT A B MINUS The SET Operators The SET operators combine the results of two or more component queries into one result. Queries containing SET operators are called compound queries. All SET operators have equal precedence. If a SQL statement contains multiple SET operators, the Oracle server evaluates them from left (top) to right (bottom) if no parentheses explicitly specify another order. You should use parentheses to specify the order of evaluation explicitly in queries that use the INTERSECT operator with other SET operators. Note: In the slide, the light color (gray) in the diagram represents the query result. Instructor Note The INTERSECT and MINUS operators are not ANSI SQL-99 compliant. They are Oracle-specific. Tables Used in This Lesson The tables used in this lesson are: EMPLOYEES: Provides details regarding all current employees JOB_HISTORY: Records the details of the start date and end date of the former job, and the job identification number and department when an employee switches jobs Tables Used in This Lesson Two tables are used in this lesson. They are the EMPLOYEES table and the JOB_HISTORY table. The EMPLOYEES table stores the employee details. For the human resource records, this table stores a unique identification number and email address for each employee. The details of the employee’s job identification number, salary, and manager are also stored. Some of the employees earn a commission in addition to their salary; this information is tracked too. The company organizes the roles of employees into jobs. Some .