Performing market-basket analysis
Market-basket analysis means, in its simplest implementation, finding which products tend to get purchased together, in the same basket. The basket might be either physical, such as a basket in a retail store, or a virtual one, such as a single Web order with one or more items. In the AdventureWorksDW2017
demo database, there isa dbo.vAssocSeqLineItems
view with the web purchase transactions with the content that I am examining with the following query:
SELECT TOP 3 * FROM dbo.vAssocSeqLineItems;
The result is this:
OrderNumber LineNumber Model ----------- ---------- ------------ SO61313 1 Road-350-W SO61313 2 Cycling Cap SO61313 3 Sport-100
The OrderNumber
column defines the basket, and the Model
column identifies a single product in the basket. Note that I did not include the ORDER BY
clause in the query; therefore, you might get a different three rows than I did.
The first analysis is the counts of individual items and...