The Data Mining SQL language functions use Oracle Data Mining to score data. The functions can apply a mining model schema object to the data, or they can dynamically mine the data by executing an analytic clause. SQL functions are available for all the data mining algorithms that support the scoring operation. Table 2-5 lists the Data Mining SQL functions.
Table 2-5 Data Mining SQL Functions
Example 2-7 shows a query that returns the results of the CLUSTER_ID
function. The query applies the model em_sh_clus_sample
, which finds groups of customers that share certain characteristics. The query returns the identifiers of the clusters and the number of customers in each cluster.
Example 2-7 CLUSTER_ID Function
-- -List the clusters into which the customers in this -- -data set have been grouped. -- SELECT CLUSTER_ID(em_sh_clus_sample USING *) AS clus, COUNT(*) AS cnt FROM mining_data_apply_v GROUP BY CLUSTER_ID(em_sh_clus_sample USING *) ORDER BY cnt DESC; SQL> -- List the clusters into which the customers in this SQL> -- data set have been grouped. SQL> -- SQL> SELECT CLUSTER_ID(em_sh_clus_sample USING *) AS clus, COUNT(*) AS cnt 2 FROM mining_data_apply_v 3 GROUP BY CLUSTER_ID(em_sh_clus_sample USING *) 4 ORDER BY cnt DESC; CLUS CNT ---------- ---------- 9 311 3 294 7 215 12 201 17 123 16 114 14 86 19 64 15 56 18 36
See Also:
Oracle Database SQL Language Reference for details about the Data Mining SQL functions