THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Sergio Govoni

A place where share my experience on SQL Server and related technologies

Developing product recommendations on WideWorldImporters using SQL Graph

SQL Server has always provided tools to manage hierarchies and relationships, facilitating query execution on hierarchical data, but sometimes relationships can become complex. Think about many-to-many relationships, relational databases don't have a native solution for many-to-many associations. A common approach to realize many-to-many associations is to introduce a table that holds such relationships.

SQL Server 2017, thanks to the Graph Database, can express certain kinds of queries more easily than a relational database by transforming complex relationships into graphs.

The graphs theory is not new in the computer world, the first commercial proposals are dating in the year of 2000 by Neo4J, OrientDB, Oracle Spatial, Graph, etc. Recently, thanks to some of the world's largest internet companies and to the new data processing and analysis requirements, this new class of Object-Oriented Database Management Systems (ODBMS) is receiving a strong impulse.

Today we need to navigate through segments of data quickly and describe how each piece of data is connected to each other by an interconnected logic. A Graph Database is a collection of Nodes and Edges where each node represents an entity and each edge represents a relationship between two nodes with a direction (for example from Node A to Node B).

A few days ago, Microsoft has merged the pull request I have done on the repository Microsoft/sql-server-samples on GitHub. "This repository contains code samples that demonstrate how to use Microsoft's SQL products including SQL Server, Azure SQL Database, and Azure SQL Data Warehouse. Each sample includes a README file that explains how to run and use the sample".

My sample explains what Graph Database is and which scenarios it solves easily, they are available here.

As you can see, the publishment consists of three demos. In the first one, I shown how to create graph objects such as Nodes and Edges. The second demo allows you to do a first look to the T-SQL MATCH clause used to perform some query on Nodes and Edges created in the first demo. In the last demo I shown how to build a recommendation system for sales offers that is able to determine the recommended products based on the product a customer is purchasing.

Have you heard about the Graph Database and want to know more? These examples are a good place to start!

Enjoy the SQL Graph! 

Published Friday, February 9, 2018 9:18 PM by Sergio Govoni

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(required) 
Submit

This Blog

Syndication

Privacy Statement