About 32,700,000 results
Open links in new tab
  1. How to write subqueries in SQL - SQL Shack

    Aug 3, 2021 · In this section, we will illustrate how to write a subquery in SQL within the FROM clause. Instead of using a table or view name in the FROM clause, we can use a SQL subquery as a data source, noting that assigning an alias is required.

  2. SQL | Subquery - GeeksforGeeks

    Apr 14, 2025 · What is SQL Subquery? In SQL, a subquery can be defined as a query embedded within another query. It is often used in the WHERE, HAVING, or FROM clauses of a statement. Subqueries are commonly used with SELECT, UPDATE, INSERT, and DELETE statements to achieve complex filtering and data manipulation. They are an essential tool when we need to ...

  3. SQL Subquery - SQL Tutorial

    A subquery is an SQL query nested inside another query. The query that contains a subquery is known as an outer query. To write a subquery, you need to have a deep understanding of the SELECT statement: select_list. FROM . table1. INNER JOIN table2 ON join_condition. WHERE . filter_condition; Code language: SQL (Structured Query Language) (sql)

  4. SQL Subqueries - w3resource

    Feb 13, 2025 · What is subquery in SQL? A subquery is a SQL query nested inside a larger query. A subquery can be located in: - A SELECT clause - A FROM clause - A WHERE clause - A HAVING clause; The subquery can be nested inside a SELECT, INSERT, UPDATE, or DELETE statement or inside another subquery.

  5. 5 SQL Subquery Examples - LearnSQL.com

    Nov 18, 2021 · Here are 5 SQL subquery examples demonstrating how to use scalar, multirow, and correlated subqueries in the WHERE, FROM, JOIN, and SELECT clauses.

  6. SQL Server SUBQUERY with Examples - SQL Server Tutorial

    The objective of this SQL Server tutorial is to teach you how to use a SUBQUERY in a SQL statement to expand the scope of operation of the statement and to narrow its focus with respect to the output and get more specific output.

  7. How to Use the SQL Subquery: A Detailed Guide | Codecademy

    Mar 25, 2025 · In this query: The subquery is executed first. It searches the departments table and returns the department_id of the ‘Sales’ department.; Next, the outer query is executed. It retrieves the department_id returned by the subquery and returns all employees whose department_id matches with the retrieved one.; This is how queries, including subqueries, are executed in SQL.

  8. SQL Server Subquery - GeeksforGeeks

    Dec 28, 2023 · In SQL Server, Subqueries are a powerful feature used to perform complex queries and combine data from multiple tables or multiple data sets. Subqueries can be used in different business cases and in different scenarios to …

  9. SQL Subquery (With Examples) - Programiz

    In SQL, a SELECT statement may contain another SQL statement, known as a subquery or nested query. FROM Customers. WHERE age= ( -- subquery SELECT MAX(age) FROM CUSTOMERS. Here, the query is divided into two parts: SELECT column FROM table . Here, FROM Customers. WHERE age = ( SELECT MIN(age) FROM Customers.

  10. How to Use a Subquery in a SELECT Statement - GeeksforGeeks

    Jan 2, 2025 · In this article, We will learn about Subquery in a SELECT statement by understanding various examples and output in detail. A subquery (also known as a nested query or inner query) is a query placed inside another query. The subquery returns a result that is used by the outer query.

  11. Some results have been removed
Refresh