|
1 | 1 | --- |
2 | | -title: Create the Iris dataset in SQL Server | Microsoft Docs |
| 2 | +title: Iris demo data set for SQL Server | Microsoft Docs |
3 | 3 | Description: Create a database containing the Iris dataset and a table for storing models. This dataset is used in exercises showing how to wrap Python code in a SQL Server stored procedure. |
4 | 4 | ms.prod: sql |
5 | 5 | ms.technology: machine-learning |
6 | 6 |
|
7 | | -ms.date: 10/15/2018 |
| 7 | +ms.date: 10/19/2018 |
8 | 8 | ms.topic: tutorial |
9 | 9 | author: HeidiSteen |
10 | 10 | ms.author: heidist |
11 | 11 | manager: cgronlun |
12 | 12 | --- |
13 | | -# Create the Iris dataset in SQL Server |
| 13 | +# Iris demo data for SQL Server |
14 | 14 | [!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)] |
15 | 15 |
|
16 | | -In this exercise, prepare a SQL Server database containing tables for both [Iris](https://en.wikipedia.org/wiki/Iris_flower_data_set) data and model storage. You'll need these objects for the [next exercise](train-score-using-python-in-tsql.md) where you learn how to embed Python code in a stored procedure and write the results to a SQL Server table. |
| 16 | +In this exercise, prepare a SQL Server database containing tables for the [Iris flower data set](https://en.wikipedia.org/wiki/Iris_flower_data_set) and model storage. Iris data is included in both the R and Python distributions installed by SQL Server. It's used in machine learning tutorials for SQL Server. |
17 | 17 |
|
18 | 18 | To complete this exercise, you should have [SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017) or another tool that can run T-SQL queries. |
19 | 19 |
|
| 20 | +Tutorials and quickstarts using this data set include the following: |
| 21 | + |
| 22 | ++ [Use a Python model in SQL Server for training and scoring](train-score-using-python-in-tsql.md) |
| 23 | + |
20 | 24 | ## Prepare the database and tables |
21 | 25 |
|
22 | 26 | 1. Start SQL Server Management Studio, and open a new **Query** window. |
23 | 27 |
|
24 | 28 | 2. Create a new database for this project, and change the context of your **Query** window to use the new database. |
25 | 29 |
|
26 | 30 | ```sql |
27 | | - CREATE DATABASE sqlpy |
| 31 | + CREATE DATABASE irissql |
28 | 32 | GO |
29 | | - USE sqlpy |
| 33 | + USE irissql |
30 | 34 | GO |
31 | 35 | ``` |
32 | 36 |
|
33 | 37 | > [!TIP] |
34 | | - > If you're new to SQL Server, or are working on a server you own, a common mistake is to log in and start working without noticing that you are in the **master** database. To be sure that you are using the correct database, always specify the context using the `USE <database name>` statement (for example, `use sqlpy`). |
| 38 | + > If you're new to SQL Server, or are working on a server you own, a common mistake is to log in and start working without noticing that you are in the **master** database. To be sure that you are using the correct database, always specify the context using the `USE <database name>` statement (for example, `use irissql`). |
35 | 39 |
|
36 | 40 | 3. Add some empty tables: one to store the data, and one to store the models you train. Later, you will use the models table to store serialized models generated in Python script. |
37 | 41 |
|
@@ -68,13 +72,13 @@ To complete this exercise, you should have [SQL Server Management Studio](https: |
68 | 72 |
|
69 | 73 | ## Populate the table |
70 | 74 |
|
71 | | -To move the training data from Python into a SQL Server table is a multistep process: |
| 75 | +You can obtain built-in Iris data from either R or Python. This step uses Python to load the data into a data frame, and then insert it into a table in the database. Moving training data from an external session into a SQL Server table is a multistep process: |
72 | 76 |
|
73 | | -+ You design a stored procedure that gets the data you want. |
74 | | -+ You execute the stored procedure to actually get the data. |
75 | | -+ You use an INSERT statement to specify where the retrieved data should be saved. |
| 77 | ++ Design a stored procedure that gets the data you want. |
| 78 | ++ Execute the stored procedure to actually get the data. |
| 79 | ++ Construct an INSERT statement to specify where the retrieved data should be saved. |
76 | 80 |
|
77 | | -1. Create the following stored procedure that includes Python code. |
| 81 | +1. Create the following stored procedure that includes Python code to load the data. |
78 | 82 |
|
79 | 83 | ```sql |
80 | 84 | CREATE PROCEDURE get_iris_dataset |
@@ -109,15 +113,22 @@ To move the training data from Python into a SQL Server table is a multistep pro |
109 | 113 | > [!TIP] |
110 | 114 | > To modify the stored procedure later, you don't need to drop and recreate it. Use the [ALTER PROCEDURE](https://docs.microsoft.com/sql/t-sql/statements/alter-procedure-transact-sql) statement. |
111 | 115 |
|
112 | | -3. To verify that the data was loaded correctly, you can run some simple queries: |
| 116 | + |
| 117 | +## Query data for verification |
| 118 | + |
| 119 | +As a validation step, run a query to confirm the data was uploaded. |
| 120 | + |
| 121 | +1. In Object Explorer, under Databases, right-click the **irissql** database, and start a new query. |
| 122 | + |
| 123 | +2. Run some simple queries: |
113 | 124 |
|
114 | 125 | ```sql |
115 | 126 | SELECT TOP(10) * FROM iris_data; |
116 | 127 | SELECT COUNT(*) FROM iris_data; |
117 | 128 | ``` |
118 | 129 |
|
119 | | -In the next lesson, you will create a machine learning model and save it to a table, and then use the model to generate predicted outcomes. |
| 130 | +## Next steps |
120 | 131 |
|
121 | | -## Next lesson |
| 132 | +In the following lesson, you will create a machine learning model and save it to a table, and then use the model to generate predicted outcomes. |
122 | 133 |
|
123 | | -[Train a Python model and generate scores in SQL Server](../tutorials/train-score-using-python-in-tsql.md) |
| 134 | ++ [Use a Python model in SQL Server for training and scoring](train-score-using-python-in-tsql.md) |
0 commit comments