About 898,000 results
Open links in new tab
  1. 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.

  2. SQL Subquery – How to Sub Query in SELECT Statement

    Oct 4, 2022 · This article showed you what you need to know about SQL subqueries and how to use them with the SELECT statement. However, subqueries are not limited to the SELECT statement only. You can use subqueries in all the CRUD operations of SQL – INSERT, SELECT, UPDATE, and DELETE.

  3. SQL Subquery - SQL Tutorial

    Based on the shape of the data each clause accepts, you can embed the appropriate subquery: The subquery in the SELECT clause can return a single value. The subquery in the FROM or INNER JOIN clauses can return a result set. The subquery in the WHERE clause can return a single value. We’ll use the employees table from the HR sample database:

  4. Subqueries (SQL Server) - SQL Server | Microsoft Learn

    Nov 22, 2024 · A subquery is a query that is nested inside a SELECT, INSERT, UPDATE, or DELETE statement, or inside another subquery. The code samples in this article use the AdventureWorks2022 or AdventureWorksDW2022 sample database, which you can download from the Microsoft SQL Server Samples and Community Projects home page.

  5. How to Use SELECT with Multiple Subqueries to Same Table in SQL

    Oct 12, 2024 · In this tutorial, we’ll explore using subqueries in SELECT, WHERE, and FROM clauses and show how to handle them when they become repetitive (and redundant). All our examples are based on our University database schema.

  6. 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 ...

  7. SQL Subqueries - w3resource

    Feb 13, 2025 · The SQL subquery is a SELECT query that is embedded in the main SELECT statement. The subquery can be nested inside a SELECT, INSERT, UPDATE, or DELETE statement or inside another subquery.

  8. How to Reference a Subquery in the Select Clause of a SQL statement

    If you want to reference the columns in the sub queries in expressions in both the select clause and in where clause, you need to put the subqueries in the From clause, with aliases... or as joined tables, with the conditions in an On clause: Just put the subquery in a join in the From clause instead. L.ORIGINALBALANCE, L.BALANCE, .

  9. 5 SQL Subquery Examples - LearnSQL.com

    Nov 18, 2021 · In this article, I provide five subquery examples demonstrating how to use scalar, multirow, and correlated subqueries in the WHERE, FROM/JOIN, and SELECT clauses. A subquery, or nested query, is a query placed within another SQL query.

  10. The Ultimate Guide To SQL Server Subquery - SQL Server Tutorial

    Summary: in this tutorial, you will learn about the SQL Server subquery and how to use the subquery for querying data. A subquery is a query nested inside another statement such as SELECT, INSERT, UPDATE, or DELETE. Let’s see the following example. Consider the orders and customers tables from the sample database.

  11. Some results have been removed
Refresh