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
Develop a database broker framework to implement a persistence mechanism for the domain objects involved in the use case dealt with in Question 2.  a. Specify the attribute type

he SQL query that will return the order number, quantity ordered, price each and total cost of an order (quantity * price each) from the order details table. Label the calculated c

We face problem of stock Opening balance and closing balance in Minus

Improved performance: As the data is located near the site of its demand, and given the inherent parallelism because of multiple copies, speed of database access may be good for di

need requirement analysis for database management of stock market

i am required to come up with entities relationships, optionality and cardinality from a scenario. there is a night club and bookings for a musician band

Compare three clustering algorithms in Weka. For this comparison, you will need to use at least two different datasets. Run the algorithms on the datasets, and use the visual

i want to database for online assignment submission system

Discuss the term- Design Optimization  We have seen various ways of representing the objects.The fundamental design model uses analysis model as the framework for implementati

.#question. Discuss the problem which may arise during concurrency control and recovery in distributed database which are not encountered in controlized database environment.