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

Write query to select student from math department, Consider the table stud...

Consider the table student and list names of students in the departments other than maths and computer. SELECT std_name FRM student WHERE dept_name NOT IN (‘Maths','Computer);

What are the factors into account when choosing a raid level, What are the ...

What are the factors to be taken into account when choosing a RAID level? A) Monetary cost of extra disk storage requirements. B) Performance requirements in terms of number

Develop a simple database of student records, In this programming assignmen...

In this programming assignment, you will develop a simple database of student records. Here are the requirements: 1) A student record contains a name and a number. We assume tha

Define 2nf normal form, 2NF Normal Form : A relation schema process R i...

2NF Normal Form : A relation schema process R is in 2NF if it is in 1NF and each non-prime attribute A in R is fully functionally related on primary key. Second normal form (2N

What are the comparison operator in sql, What are the comparison operator i...

What are the comparison operator in SQL?  Comparison operator in SQL are =, LIKE and BETWEEN

Database application development, The database application project (DAP) fo...

The database application project (DAP) for this assignment consists of the creation of a fully functional Microsoft Access database application for a real client. I recommend you s

Define the two phase locking protocol, Define the Two Phase Locking Protoco...

Define the Two Phase Locking Protocol This is a protocol that is used to make sure serializability of transactions. This protocol needs that every transaction issue lock and u

desirable properties of decomposition, Desirable Properties Of Decompositi...

Desirable Properties Of Decomposition Decomposition is a process of dividing a relation into its projections that will not be disjoint. Please remind the Relational projection

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