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
I want a script that will run, and update my virtual machine's LAN settings (proxy server and port), and also re-configure the Firefox User Agent. I want a script that will run,

what is the importance of back up files

What is an object design? Object design is a very interactive method, which decides the relationship among objects, classifies operations on classes, determines overall system

Boyce-Code Normal Form (BCNF) A relationship is said to be in BCNF if it is already in 3NF and the left hand side of each dependency is a candidate key. A relation who is in 3N

Guidelines for creation of table: Table name should begin with an alphabet. In table name, single quotes and blank spaces are not allowed. Reserve words of that DBM

What three major types of actions includes databases? Briefly discuss these The three major types of actions including databases are: (i) Defining: It includes specifyin

In problems 1 - 4, you are given the columns of a table, and a set of functional dependencies.  Determine the normal form of this table.  Remember that the normal form is the HIGHE

Consider the following database containing five transactions. Let min_sup = 60%. Mine all frequent itemsets using Apriori and FP-growth algorithm. Compare the efficiency of the t

Explain Thomas' Write rule.  Show how it is different from timestamp ordering protol Ans: In timestamp-based concurrency control the thomas Write rule is a rule. Given a Timest

what is query processing ,query optimization and performance turring?