{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# sql06(N) - 6 Subqueries Objectives After completing this...

This preview shows pages 1–7. Sign up to view the full content.

6 6 Subqueries

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6-2 Objectives After completing this lesson, you should After completing this lesson, you should be able to do the following: be able to do the following: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries Write single-row and multiple-row subqueries
6-3 Using a Subquery to Solve a Problem Who has a salary greater than Jones’s?” Who has a salary greater than Jones’s?” “Which employees have a salary greater than Jones’s salary?” Main Query ? ? “What is Jones’s salary?” ? ? Subquery

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6-4 Subqueries The subquery (inner query) executes once before the main query. The result of the subquery is used by the main query (outer query). SELECT select_list FROM table WHERE expr operator (SELECT select_list FROM table );
6-5 2975 SQL> SELECT ename 2 FROM emp 3 WHERE sal > 4 (SELECT sal 5 FROM emp 6 WHERE empno=7566); Using a Subquery ENAME ---------- KING FORD SCOTT

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6-6 Guidelines for Using Subqueries Enclose subqueries in parentheses. Place subqueries on the right side of the comparison operator.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 19

sql06(N) - 6 Subqueries Objectives After completing this...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online