Nested Loop Join and Subqueries

These two are different concepts, do not confuse them.
Nested Loop Join is the physical connection method of the tables in the From clause, and the logical connection method refers to Inner join, left/right outer join, full join

and delete from stu a
    where The subqueries in rowid not in (select max(rowid)
                          from stu b
                         where a.name = b.name
                           and a.stno < b.stno);
are different, this is the "correlated subquery" type in the subquery , correlated subquery: Some fields in the main query are used in the subquery, and the subquery is executed once every row of the main query is scanned. Although Nested Loop Join has two layers of loops, it is not the same concept.

SQL Basics --> Subqueries
http://blog.csdn.net/leshami/article/details/5592002
Key Points
1. Subqueries Subqueries
    are queries located inside SELECT, UPDATE, or DELETE statements
  
2. Subqueries A
    single-row subquery
        returns zero or one row A
    multi-row subquery
        returns one or more rows
    and a multi-column subquery
        Returns a multi-column
    correlated subquery         that
        references one or more columns in the outer SQL statement. Some fields in the main query are used in the subquery. The subquery is executed once for each row of the main query.     Nested subqueries         are located in other subqueries. Query 3. Subquery syntax*/     SELECT select_list     FROM table     WHERE expr operator        (SELECT select_list         FROM table);         /*     Subquery (inner query) is executed once before executing the main query,     and then the main query (outer query) will use the subquery's Results 4. Rules     for subqueries Enclose the subquery in     parentheses and place the subquery on the right side of the comparison condition.     Only when performing a sort Top-N analysis, the subquery needs to use the ORDER BY clause     single row operator for a single row Subqueries, multiline operators are used for multiline subqueries Subqueries http://www.cnblogs.com/liunanjava/p/4227510.html Key points























A subquery refers to a writing form in which several small queries with different functions are nested in a complete query statement to complete a complex query together, in order to make the concept of subquery clearer for readers. Subqueries

return results There are four types of data that can be returned by subqueries: single row and single column: returns the content of a specific column, which can be understood as a single value data; single row and multiple columns: returns the content of multiple columns in a row of data ; Multi-line and single-column: Returns the content of the same column in the multi-line record, which is equivalent to giving an operation range; Multi-line and multi-column: The result returned by the query is a temporary table; Use subqueries in The clause deals with single-row and single-column subqueries, multi-row and single-column subqueries, and single-row and multiple-column subqueries.









Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326301322&siteId=291194637