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
Illustration of implementation of inheritance Let us take the illustration of implementation of inheritance. Suppose that we are about to implement the Stack class and by now w

Increases efficiency : Data is stored close to most often used site, therefore retrieval would be faster. Also, data that is not required by local applications is not stored, there

A customer places orders for parts and belongs to a particular industry group. An individual order is taken by a particular sales representative on a specific date and the sales re

For every n-ary relationship type R where n>2, we make a new table S to represent R. We contain as foreign key attributes in s the primary keys of the relations that show the parti

Timestamp Ordering Protocol A timestamp is a tag that can be attached to any transaction or any data item, which indicates a specific time on which the transaction or data item


anyone have a textbook solutions case fair, 8 edition of vol 1 ?, please give me

What is normalization? It is a method of analysing the given relation schemas based on their Functional Dependencies (FDs) and primary key to attain the properties (1).Minim

The definition of the classes and operation can often be adjusted to increase the amount of inheritance". Justify the above statement.   Adjustment of Inheritance The def

#ques Define a job scheduling strategy that will meet business requirement of reporting availability by 6am CST for the following cubes? Show the job scheduling dependencies in a p