|
5 | 5 | --- |
6 | 6 |
|
7 | 7 | # Lab Environment Setup |
| 8 | + |
| 9 | +You can complete the Transact-SQL exercises in a sample database in Microsoft Fabric. Use the instructions in this page to prepare a suitable Fabric Database environment. |
| 10 | + |
| 11 | +> **Note**: You need access to [Microsoft Fabric](https://learn.microsoft.com/fabric/get-started/fabric-trial) with sufficient permissions to create a Fabric Database to complete this exercise. |
| 12 | +
|
| 13 | +## Create a workspace |
| 14 | + |
| 15 | +Before working with data in Fabric, create a workspace. |
| 16 | + |
| 17 | +1. Open the [Microsoft Fabric home page](https://app.fabric.microsoft.com/home?experience=fabric) at `https://app.fabric.microsoft.com/home?experience=fabric`, signing in with your credentials if prompted. |
| 18 | +1. Create a new **Workspace** with a name of your choice, selecting a licensing mode in the **Advanced** section that includes Fabric capacity (*Trial*, *Premium*, or *Fabric*). |
| 19 | +1. When your new workspace opens, it should be empty. |
| 20 | + |
| 21 | +## Provision Fabric Database |
| 22 | + |
| 23 | +Now, you need to provision an instance of Fabric Database with a sample database that you can query. |
| 24 | + |
| 25 | +1. In your new empty workspace, create a new **SQL Database** item named `Adventureworks`. |
| 26 | +1. When the new **Adventureworks** database has been created, select the **Sample data** option to import the sample database schema and data. |
| 27 | + |
| 28 | + Wait for the sample data to be imported. This may take a few minutes. |
| 29 | + |
| 30 | +1. After the data has been imported, refresh the **Adventureworks** database node in the **Explorer** pane and then expand it to see the tables under the **SalesLT** schema. |
| 31 | + |
| 32 | +> **Note**: If you're familiar with the standard **AdventureWorks** sample database for Microsoft SQL Server, you may notice that we are using a simplified, lightweight (*LT*) version with fewer tables. |
| 33 | +
|
| 34 | +## Open the query editor |
| 35 | + |
| 36 | +The query editor is a browser-based interface that you can use to run Transact-SQL statements in your database. |
| 37 | + |
| 38 | +1. In your **Adventureworks** Fabric database, create a new query. |
| 39 | +1. In the **SQL query 1** pane, enter the following Transact-SQL code: |
| 40 | + |
| 41 | + ```sql |
| 42 | + SELECT * FROM SalesLT.Product; |
| 43 | + ``` |
| 44 | + |
| 45 | +1. Use the **▷ Run** button to run the query, and and after a few seconds, review the results, which includes all columns for all products. |
| 46 | +1. Close the Query editor page. |
| 47 | + |
| 48 | +Now that you've created the database and learned how to use the query editor to run Transact-SQL code, you can return to the query editor in your Fabric workspace at any time to complete the lab exercises. |
| 49 | +
|
| 50 | +> **Tip**: When you've finished with the database, delete the workspace you created to avoid unnecessary charges. |
0 commit comments