The UNPIVOT operation retrieves data from columns and transposes the data into rows.
Execution Plan image:
The UPDATE statement modifies existing data within a database table. It has the following basic form:
Specifies the table, partition, view, subquery, or table collection that is to have its rows updated into which rows are inserted.
Consists of either a single column name or a list of columns enclosed in parentheses. Using a column list is convenient when setting multiple columns to the values returned by a subquery. As illustrated in the following:
UPDATE employees c
Is a standard WHERE clause. It can include subqueries.
A correlated update includes a sub-query that contains references to columns in the table being updated. The query is evaluated for each row that is eligible for update. The correlated update is very similar to the correlated sub-query described earlier. The following statement executes a correlated update: the sub-query within the SELECT statement is executed once for each row in CUSTOMERS which satisfies the WHERE clause:
UPDATE customers c
IN (SELECT surname,firstname,date_of_birth
Execution Plan image:
VIEW resolves any query nested deeper than the VIEW operation into a temporary area. The use of VIEW may be caused by correlated queries or by the inability of Oracle to pull a view’s query into the rest of a larger query, forcing it to resolve the view separately.
The example is in two parts: a view is created and then queried. The plan that follows applies only to the query of the view, not to the view creation itself.
create view COMPANY_COUNT as
select Zip, COUNT(*) Company_Count
group by Zip;
select Zip, Company_Count
where Company_Count BETWEEN 10 and 20;
SORT GROUP BY
TABLE ACCESS FULL COMPANY
Because there is a set operation (SORT GROUP BY) within the view syntax, the optimizer must resolve the view before executing the conditions specified in the query. All the rows are fetched from COMPANY table using a full table scan, then they are sorted and counted by Zip during the SORT GROUP BY operation. The WHERE clause condition in the query is applied during the FILTER operation on the result of the view.
The VIEW PUSHED PREDICATE operation pushes predicates into a temporary table used for storing query results.