Page 187 - DCAP606_BUSINESS_INTELLIGENCE
P. 187
Business Intelligence
Notes
Example: The following is an example of a batch statement:
SELECT TOP <number> <select list>
FROM [<mining model name>]
PREDICTION JOIN
OPENQUERY([<datasource>],’<SELECT statement>’)
AS [<input alias>]
ON <on clause, mapping,>
WHERE <where clause, boolean expression,>
ORDER BY <expression>
Let us see which line of code is useful for what purpose. Here, the first two lines of the code
define the columns from mining model that the query returns, as well as the name of the mining
model that is used to generate the prediction in the saw as singleton query return.
Notes The TOP <number> statement specifies that the query will only return the number
or the results specified by <number>.
The next lines of the code define the source data that the predictions are based on:
OPENQUERY([<datasource>],’<SELECT statement>’)
AS [<input alias>]
The next line defines the mapping between the source columns in the mining model and the
columns in the source data:
ON <column mappings>
The WHERE clause filters the results returned by the prediction query:
WHERE <where clause, boolean expression,>
The last (and optional) line of the code specifies the column that the results will be ordered by:
ORDER BY <expression> [DESC|ASC]
Use ORDER BY in combination with the TOP <number> statement, to filter the results that are
returned.
Example: In this prediction you will return the top ten car buyers, ordered by the
probability of the prediction being correct. You can use [DESC|ASC] to control the order in
which the results are displayed.
Self Assessment
Fill in the blanks:
1. The aim of a usual data mining task is to use the mining model to make ....................... .
2. When you create a prediction, you normally supply some piece of new information and
ask the model to develop a prediction based on the ....................... .
3. Both ....................... and ....................... prediction queries use the PREDICTION JOIN syntax
to define the new data.
4. In addition to predicting a value, you can customize a prediction query to return various
types of information that are related to the ....................... .
182 LOVELY PROFESSIONAL UNIVERSITY