リンクを新しいタブで開く
  1. SQL Server Management Studio (SSMS) allows you to run T-SQL queries for retrieving, inserting, updating, and deleting data. Below are practical examples using the AdventureWorks sample database.

    Basic SELECT Queries Retrieve all columns:

    USE AdventureWorks2022;
    SELECT *
    FROM Production.Product
    ORDER BY Name ASC;
    コピーしました。

    Retrieve specific columns with alias:

    SELECT Name, ProductNumber, ListPrice AS Price
    FROM Production.Product
    WHERE ProductLine = 'R' AND DaysToManufacture < 4
    ORDER BY Name ASC;
    コピーしました。

    Aggregations and GROUP BY Summarize sales per order:

    SELECT SalesOrderID, SUM(LineTotal) AS SubTotal
    FROM Sales.SalesOrderDetail
    GROUP BY SalesOrderID
    ORDER BY SalesOrderID;
    コピーしました。

    Filter groups with HAVING:

    SELECT ProductID, AVG(OrderQty) AS AvgQty
    FROM Sales.SalesOrderDetail
    GROUP BY ProductID
    HAVING AVG(OrderQty) > 5;
    コピーしました。

    JOIN Examples Inner join to combine employee and person data:

    SELECT E.NationalIDNumber, E.JobTitle, P.FirstName, P.LastName
    FROM HumanResources.Employee AS E
    INNER JOIN Person.Person AS P
    ON E.BusinessEntityID = P.BusinessEntityID;
    コピーしました。
  1. SELECT の例 (Transact-SQL) - SQL Server | Microsoft Learn

    この記事のコード サンプルでは、 AdventureWorks2025 または AdventureWorksDW2025 サンプル データベースを使用します。 このサンプル データベースは、 Microsoft SQL Server サンプルとコ …

  2. SQL Query Examples - SQL Server Tips

    • The select statement is the most basic and simple SQL to query data. Here is the basic syntax: The following example will query the information from the Person.Person table from the Adventurework2019 database. The following SQL will query all the columns from the table, by using * instead of specifying column names. You could also use the following...
    mssqltips.com でさらに表示
    • 公開日: 2022年2月23日
    • 【SQL Server】業務の中でよく使用するクエリ集 #初心者 - Qiita

      2022年11月22日 · 私が業務の中で SSMS (SQL Server Management Studio)上でDBの操作をしており、 そこでよく使うクエリをまとめました。 参考になれば。 バックアップを取る際 SELECT * INTO ( …

    • 15 SQL Server Practice Exercises with Solutions

      2024年5月28日 · Explore 15 SQL Server exercises for beginners, each with a solution and explanation to boost your T-SQL querying skills

    • SQL Server Tutorial

      2024年9月30日 · The SQL Server Tutorial website offers practical tutorials with many hands-on examples to help you learn SQL Server quickly and effectively.

    • SQL文でよく見かけるクエリの自分用メモ【随時更新】 - Qiita

      2025年3月29日 · ビューは、複雑なクエリ結果を仮想的なテーブルとして定義する機能です。 ビューは実際には物理的なデータを保持せず、基になるテーブルへの参照として機能します。

    • SQL Server Examples

      This article provides a collection of SQL Server examples that cover a variety of tasks, from basic data retrieval to complex data manipulation. The examples are written in T-SQL, the standard language for …

    • SELECT Examples (Transact-SQL) - SQL Server | Microsoft ...

      2026年2月2日 · This article provides examples of using the SELECT statement. The code samples in this article use the AdventureWorks2025 or AdventureWorksDW2025 sample database, which you …

    • T-SQL Examples - Quackit Tutorials

      Transact-SQL (T-SQL) is Microsoft's extension to SQL. Here are examples of some of the more common T-SQL statements. Selects all data from the Artists table. This is the most basic example of a SELECT …

    • SQL Server SELECT Examples

      2021年4月12日 · All queries in this SQL tutorial are written on the Adventure Works sample database. You can install it on your machine so you can execute the …

    • 他の人も質問しています
      Loading
      Unable to load answer
    • 他の人は以下も検索しています

      Microsoft SQL Server Query Examples に関連する検索

    このサイトを利用すると、分析、カスタマイズされたコンテンツ、広告に Cookie を使用することに同意したことになります。サード パーティの Cookie に関する詳細情報|Microsoft のプライバシー ポリシー