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

Enterprise applications integration, The figure below depicts the conceptu...

The figure below depicts the conceptual diagram of a banking system. (a) Describe one example relevant to the system in figure, for each of the 4 types of enterprise appl

ER diagram, Explain the conventions (relationships) for displaying an ER sc...

Explain the conventions (relationships) for displaying an ER schema as an ER diagram.

Explain the aggregation implies concurrency, Explain the Aggregation implie...

Explain the Aggregation implies concurrency Concurrency actually is: This in objects can be identified by the way they change state. Present objects can change state independen

What is trigger, What is trigger Triggers are statements that are imple...

What is trigger Triggers are statements that are implemented automatically by the system as the side effect of a change to the database.

Determine the types of methods for retrieving rows in python, Describe the ...

Describe the two types of methods for retrieving rows in Python? Fetchone()- Returns the next row as a sequence Fetch all()- Returns the entire result set like a strin

Data redundancy, Data Redundancy -A lot of information is being repeated in...

Data Redundancy -A lot of information is being repeated in the relation. For instance, the information that MCS-014 is named SSAD is repetitive, address of Rahul is "D- 27, Main ro

Accessing information permissions users, Accessing information about permis...

Accessing information about permissions to all users- Object level permissions: With the use of data dictionary you can see the permissions to user. Let us get the table name fro

Explain what is rdbms, Explain what is RDBMS ? RDBMS - RDBMS is a datab...

Explain what is RDBMS ? RDBMS - RDBMS is a database management system (DBMS) which stores data within the form of relations. Relational databases are powerful since they need f

Fragmentation, Differentiate between horizontal & mixed horizontal fragment...

Differentiate between horizontal & mixed horizontal fragmentation?

How does oracle act as odbc and give example for front end, How does Oracle...

How does Oracle act as ODBC and give examples of front end uses with ODBC? ODBC achieve portability at the level of the executable by introducing an extra level of indirection.

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