Nested queries, Database Management System

Nested Queries

Let us see some more complex queries in this section.

Sub-queries:

Some of the basic concerns of sub-queries are:

  • A sub-query is a SELECT statement that is fixed in a clause of another SELECT statement. They are often referred to as a SUB SELECT or NESTED SELECT or INNER SELECT.
  • The sub-query (inner query) implements first before the main query. The product of the sub-query is used by the outer query (main query).
  • Sub-query can be placed in HAVING or WHERE or FROM clauses.
  • Format of using sub-queries:

                 SELECT

                 FROM

                 WHERE expr OPERATOR

                                                          (SELECT FROM

WHERE);

                Operator has a comparison operator (one or multiple row operators)

Single row operator:   >, =, >=, <, <=, <>

                         Multiple row operators: IN, ALL, ANY,

  • Order by clause can't be used in sub-query, if specified it must be the end clause in the main select statement.
  • Parts of sub-queries:

         ‰  Single row sub-query: It gives only single row from the inner select statement.

        ‰   Multiple row sub-queries: It gives more than single row from the inner select statement

        ‰  Multiple column sub-queries: It gives more than single column from the inner select statement.

Single row operators are used with one row sub queries and multiple row operators are used with numerous row sub queries.

  • The Inner and Outer queries can get data from different tables.
  • Group Functions are used in sub queries.
Posted Date: 3/11/2013 3:36:58 AM | Location : United States







Related Discussions:- Nested queries, Assignment Help, Ask Question on Nested queries, Get Answer, Expert's Help, Nested queries Discussions

Write discussion on Nested queries
Your posts are moderated
Related Questions
Define shadow paging. An alternative to log-based crash recovery method is shadow paging. This technique requires fewer disk accesses than do the log-based methods.

What are referential integrity constraints? A value that appears in single relation for a given set of attributes also appears for a particular set of attributes in another rel

What does Aggregation mean?

lock and types of lock

What is the meaning of Recovery? In deferred update methods, if a transaction fails before arriving its commit point, it will not have altered the database in any way, so UNDO

Define Database layer? The database layer defines the data formats used in the database.

List out various user authorization to modify the database schema. a)  Index authorization b)  Resource authorization c)  Alteration authorization d)  Drop authorizat

Explain the term High level DML? High level DML A high-level or non-procedural DML permit the user to specify what data is needed without specifying how it is to be acquired.

Define the terms i) Key attribute ii) Value set Key attribute: An entity type usually has an attribute whose values are exact from each individual entity in the collection. Su

sir, could anybody help me in getting complete information about the mentioned topic