SQL - Query Block, Sub Query

Data System Architecture

About

A query can contain one or several subquery. A subquery is also known as query block.

Example

SELECT e.ename, e.sal      
  FROM (SELECT *
          FROM emp e
         WHERE e.sal > 300
           AND e.deptno IN (SELECT d.deptno
                              FROM dept d
                             WHERE d.dname IN ('SALES', 'ACCOUNTING'))) e

This query contain 3 query block :

  • last
SELECT d.deptno
          FROM dept d
         WHERE d.dname IN ('SALES', 'ACCOUNTING')
  • second :
SELECT *
          FROM emp e
         WHERE e.sal > 300
           AND e.deptno IN ('last query block')
  • main query block
SELECT e.ename, e.sal      
  FROM ('second query block')





Discover More
Obiee Ceim
OBIEE - Logical Sql

The logical SQL is the SQL that understand BI Server. It's a full Ansi 92 SQL (including subqueries and derived tables), plus special functions (SQL extensions) like AGO, TODATE, EVALUATE, and others....
Obiee Query Log
OBIEE - Physical SQL

The physical SQL is the SQL that send the BI Server to the data sources in order to retrieve data. This SQL is most of the time generated by the query compiler during the query processing of the logical...
Owb Run Time View Erd
OWB - Public Views (metadata)

The Warehouse Builder provides a set of pre-built views for both the design and runtime environments. These views are called the Warehouse Builder Public...
Card Puncher Data Processing
Oracle Database - How to (enable|disable) parallel query and get (degree of parallelism|DOP) ?

How to enable a parallel execution: for a for a operation Small tables/indexes (up to thousands of records; up to 10s of data blocks) should never be enabled for parallel execution. Operations...
Query Optimizer Process
SQL Engine - The Query Transformer

The query transformer is a component of the query optimizer and take as input a parsed query, which is represented by a set of query blocks. The query blocks are nested or interrelated to each other....



Share this page:
Follow us:
Task Runner