次の方法で共有


チュートリアル: データ ウェアハウスにテーブルを作成する

適用対象: Microsoft Fabric の SQL 分析エンドポイントおよびウェアハウス

チュートリアルの前の部分で作成したデータ ウェアハウスにテーブルを作成する方法について説明します。

テーブルの作成

  1. ナビゲーション メニューで [ワークスペース] を選択します。

  2. チュートリアル: Microsoft Fabric データ ワークスペースを作成する」で作成したワークスペース (Data Warehouse Tutorial など) を選択します。

  3. ウェアハウスの種類を指定して、項目一覧から WideWorldImporters を選択します。

    Screenshot of the warehouse option that appears in the item list.

  4. リボンから、[新規 SQL クエリ] を選択します。

    Screenshot of the New SQL query option where it appears on the ribbon.

  5. クエリ エディターで、次のコードを貼り付けます。

    /*
    1. Drop the dimension_city table if it already exists.
    2. Create the dimension_city table.
    3. Drop the fact_sale table if it already exists.
    4. Create the fact_sale table.
    */
    
    --dimension_city
    DROP TABLE IF EXISTS [dbo].[dimension_city];
    CREATE TABLE [dbo].[dimension_city]
        (
            [CityKey] [int] NULL,
            [WWICityID] [int] NULL,
            [City] [varchar](8000) NULL,
            [StateProvince] [varchar](8000) NULL,
            [Country] [varchar](8000) NULL,
            [Continent] [varchar](8000) NULL,
            [SalesTerritory] [varchar](8000) NULL,
            [Region] [varchar](8000) NULL,
            [Subregion] [varchar](8000) NULL,
            [Location] [varchar](8000) NULL,
            [LatestRecordedPopulation] [bigint] NULL,
            [ValidFrom] [datetime2](6) NULL,
            [ValidTo] [datetime2](6) NULL,
            [LineageKey] [int] NULL
        );
    
    --fact_sale
    
    DROP TABLE IF EXISTS [dbo].[fact_sale];
    
    CREATE TABLE [dbo].[fact_sale]
    
        (
            [SaleKey] [bigint] NULL,
            [CityKey] [int] NULL,
            [CustomerKey] [int] NULL,
            [BillToCustomerKey] [int] NULL,
            [StockItemKey] [int] NULL,
            [InvoiceDateKey] [datetime2](6) NULL,
            [DeliveryDateKey] [datetime2](6) NULL,
            [SalespersonKey] [int] NULL,
            [WWIInvoiceID] [int] NULL,
            [Description] [varchar](8000) NULL,
            [Package] [varchar](8000) NULL,
            [Quantity] [int] NULL,
            [UnitPrice] [decimal](18, 2) NULL,
            [TaxRate] [decimal](18, 3) NULL,
            [TotalExcludingTax] [decimal](29, 2) NULL,
            [TaxAmount] [decimal](38, 6) NULL,
            [Profit] [decimal](18, 2) NULL,
            [TotalIncludingTax] [decimal](38, 6) NULL,
            [TotalDryItems] [int] NULL,
            [TotalChillerItems] [int] NULL,
            [LineageKey] [int] NULL,
            [Month] [int] NULL,
            [Year] [int] NULL,
            [Quarter] [int] NULL
        );
    
  6. [実行] を選択して、クエリを実行します。

    Screenshot of the top corner of the query editor screen, showing where to select Run.

  7. 後で参照するためにこのクエリを保存するには、[クエリ] タブを右クリックし、[名前の変更] を選択します。

    Screenshot of the top corner of the query editor screen, showing where to right-click to select the Rename option.

  8. Create Tables」と入力して、クエリの名前を変更します。

  9. キーボードの Enter キーを押すか、タブの外側の任意の場所を選択して変更を保存します。

  10. リボンの [更新] ボタンを選択して、テーブルが正常に作成されたことを確認します。

    Screenshot of the ribbon on the Home screen, showing where to select the refresh option.

  11. オブジェクト エクスプローラーで、新しく作成されたテーブルの作成クエリ、fact_sale テーブル、dimension_city テーブルが表示されることを確認します。

    Screenshot of the Explorer pane, showing where to find your tables and newly created query.

次のステップ