Nested queries, Database Management System

Assignment Help:

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.

Related Discussions:- Nested queries

What is the difference between a key and a superkey, What is the difference...

What is the difference between a key and a superkey? Key - A key a single attribute or a combination of two or more attributes of an entity set which is used to identify one

Project, I need help in doing my dbms project

I need help in doing my dbms project

Hashed file organisation, Hashed File Organisation Hashing is the most ...

Hashed File Organisation Hashing is the most common form of purely random access to a database or file. It is also used to access columns that do not have an index as an optimi

State the functional approach of object oriented methods, State the functio...

State the functional approach of object oriented methods Moving from a functional approach to an object oriented one needs a translation of functional model elements into objec

What is the use of raid, What is the use of RAID? A variety of disk-org...

What is the use of RAID? A variety of disk-organization methods, collectively called redundant arrays of independent disks are used to better the performance and reliability.

Define object-relational systems, Define object-relational systems? Sy...

Define object-relational systems? Systems that give object-oriented extensions to relational systems are known as object-relational systems.

What type of view of total database content, What type of view of total dat...

What type of view of total database content? Data base content Conceptual view of total database contain.

RAID technology, what characterizes the levels in RAID technology

what characterizes the levels in RAID technology

Money making supermarket chain problem, Consider the ER schema below for th...

Consider the ER schema below for the MoneyMaking supermarket chain problem. Translate the given ER schema into SQL CREATE TABLE statement.

Define the traditional system analysis and design, Define the Traditional S...

Define the Traditional System Analysis and Design Traditional System Analysis and Design (SAD) have three basic life cycle models. A typical software lifecycle consists of the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd