Skip to content

Instantly share code, notes, and snippets.

@JerryNixon

JerryNixon/graph.ipynb

Last active Jun 15, 2021
Embed
What would you like to do?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JerryNixon

This comment has been minimized.

Copy link
Owner Author

@JerryNixon JerryNixon commented Jun 4, 2021

For a given customer's purchase history what products do you recommend?

SELECT 
	  customer.Name AS CUSTOMER
	, demo.Name AS DEMOGRAPHIC
	, product.Name AS BECAUSE_OF_PURCHASE
	, recommendation.Name AS WE_RECOMMEND_PRODUCT
FROM Customer AS customer
	, is_in
	, Demographic AS demo
	, purchased
	, Product AS product
	, recommends
	, Product AS recommendation
WHERE MATCH(demo<-(is_in)-customer-(purchased)->product-(recommends)->recommendation)
AND recommends.DemographicId = demo.Id
AND customer.Id in (13)
ORDER BY 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment