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

Explain algorithm of er to relational mapping, Explain algorithm of ER To R...

Explain algorithm of ER To Relational Mapping ? ER-to-Relational Mapping Algorithm: 1) Step 1: Mapping of regular entity types: For each strong entity type E, form a relatio

What are the ways in which signal can be generated, What are the ways in wh...

What are the ways in which signal can be generated A signal might be generated in many ways such as a Signal is result of particular physical condition. Whenever a process writ

What is explicit update, What is Explicit update In explicit update,...

What is Explicit update In explicit update, each derived attribute is defined with respect to one, or more fundamental base object(s). The object designer determines that de

Describe integrity and security, Describe integrity and security? a)   ...

Describe integrity and security? a)      Domain constraint b)      Referential integrity A value that appears in one relation for a given set of attributes also appear fo

The third normal form (3nf), The Third Normal Form (3NF) Even though, t...

The Third Normal Form (3NF) Even though, transforming a relation that is not in 2NF into a number of relations that are in 2NF take out many of the anomalies, it does not neces

Related fields in a database are grouped in which form, Related fields in a...

Related fields in a database are grouped in which form? Related data fields in a database are grouped to form a data record. (A record is a collection of related fields)

Database for online assignment system, i want to database for online assign...

i want to database for online assignment submission system

Advanced database systems, Consider an information system designed for an o...

Consider an information system designed for an online company which provides IT products and services These include desktops, laptops, networking products, IT books, parts, and

What are the uses of functional dependencies, What are the uses of function...

What are the uses of functional dependencies? To test relations to see whether they are legal under a given set of functional dependencies. To state constraints on the set

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