SQL Nested Queries






A SQL nested query is a SELECT query that is nested inside a SELECT, UPDATE, INSERT, or DELETE SQL query. Here is a simple example of SQL nested query:

SELECT Model FROM Product
WHERE ManufacturerID IN (SELECT ManufacturerID FROM Manufacturer
WHERE Manufacturer = 'Dell')

The nested query above will select all models from the Product table manufactured by Dell:

Model
Inspiron B120
Inspiron B130
Inspiron E1705

You can have more than one level of nesting in one single query.


SQL Tutorial

SQL Tutorial
SQL Introduction
RDBMS and Tables
SQL SELECT
SQL WHERE
SQL INSERT
SQL DISTINCT
SQL UPDATE
SQL DELETE
SQL ORDER BY
SQL Aggregate Functions
SQL GROUP BY
SQL HAVING
Relations, Keys, and Normalization
SQL JOIN
SQL UNION
SQL Nested Queries
CREATE DATABASE, CREATE TABLE and ALTER TABLE
SQL Views
SQL Indexes
SQL Training
SQL Hosting
SQL Replication
Contact Us
Legal
SQL Resources
Copyright © Art Branch Inc
SQL Tutorial | Bookmark | Contact | Link