Questions tagged [sql-graph]

SQL Graph is a subset capability of every edition of SQL Server (SQL Express, Professional, Enterprise, Azure) since SQL Server version 2017. It enables Nodes and Edges inside SQL Server that support graph-specific queries that leverage Graph Theory to navigate through data as nouns and verbs.

SQL Server offers graph database capabilities to model many-to-many relationships. The graph relationships are integrated into Transact-SQL and receive the benefits of using SQL Server as the foundational database management system.

What is a graph database?

A graph database is a collection of nodes (or vertices) and edges (or relationships). A node represents an entity (for example, a person or an organization) and an edge represents a relationship between the two nodes that it connects (for example, likes or friends). Both nodes and edges may have properties associated with them. Here are some features that make a graph database unique:

  • Edges or relationships are first class entities in a Graph Database and can have attributes or properties associated with them.
  • A single edge can flexibly connect multiple nodes in a Graph Database.
  • You can express pattern matching and multi-hop navigation queries easily.
  • You can express transitive closure and polymorphic queries easily.

When to use a graph database

A relational database can achieve anything a graph database can. However, a graph database makes it easier to express certain kinds of queries. Also, with specific optimizations, certain queries may perform better. Your decision to choose either a relational or graph database is based on following factors:

  • Your application has hierarchical data. The HierarchyID datatype can be used to implement hierarchies, but it has some limitations. For example, it does not allow you to store multiple parents for a node.
  • Your application has complex many-to-many relationships; as application evolves, new relationships are added.
  • You need to analyze interconnected data and relationships.
42 questions
1
vote
1 answer

Combine MATCH clause and INNER JOIN in SQL Server graph database with mixed model

I have a some node and edge tables in SQL Server with a one to many relationship to a standard table which store users. Each edge and node table have this 1N relationship. I would like to know how can I perform a query with match clause and a left…
user1069516
  • 443
  • 1
  • 7
  • 19
1
vote
0 answers

Copy Sql Server Graph database with data

I am having a simple SQL Graph Database. Database: CREATE TABLE Person ( ID INTEGER PRIMARY KEY, name VARCHAR(100) ) AS NODE; CREATE TABLE City ( ID INTEGER PRIMARY KEY, name VARCHAR(100) ) AS NODE; CREATE TABLE Travels AS EDGE; INSERT…
1
vote
1 answer

How can I use 'Generate Scripts' in SQL Server 2017 with Graph Database Objects?

I'm attempting to use the Generate Scripts feature of SQL Server Management Studio in order to script the schema and data of a database which has Node and Edge tables included. When I select Schema and Data for Types of data to script in the…
codekaizen
  • 26,990
  • 7
  • 84
  • 140
1
vote
0 answers

How to make LINQPad work with SQL Server's graph?

Graph Table in SQL Server automatically added an internal graph_ID_ column for user. When querying the table in LINQPad, got this error. Here is the SQL being generated in LINQPad. Looks like LINQ_TO_SQL detected this column, and treated this…
Rm558
  • 4,621
  • 3
  • 38
  • 43
1
vote
1 answer

Does SqlBulkCopy support Graphtables in MsSql 2017?

I am trying out the new graphdatabase support that was added to Microsoft SQL Server 2017 I wanted to use SqlBulkCopy to insert a couple thousand nodes into a node table. However I always the error: Column…
1
vote
1 answer

Partitioned Graph table - Partition Switch failed

I am trying and partitioning to an existing SQL Server Graph table (node). The table is very large and is taking long time for deletes etc, so hoping to use partitioning to improve the performance. However, when I add partition and try to SWITCH the…
1
vote
1 answer

How to select from SQL Server Graph Table When Where Clause Not Match

I'm using Graph Table in SQL Server . This is my table: --Node Table CREATE TABLE [dbo].[Users] ( [ID] [int] NOT NULL Primary key, [FName] [nvarchar](100) NULL, [LName] [nvarchar](100) NULL )AS NODE --Edge Table CREATE TABLE…
1
vote
0 answers

Error in Creating a Node Table in Sql-server 2017

I have just installed Sql Server 2017 and it's Management studio for practicing Graph database but I have problem creating a Node table. I get an error while creating a Node table and I can not see anything related to the graphs : CREATE TABLE…
PTTT
  • 251
  • 1
  • 10
1
vote
1 answer

Create a graph table in SQL Server 2016

I am trying to create a simple node table, using: CREATE TABLE Person (ID INTEGER PRIMARY KEY, name VARCHAR(100)) AS NODE But whatever I try I get an error: Incorrect syntax near the keyword 'as'. as if it doesn't understand the 'As Node'…
Lexius
  • 75
  • 7
1
vote
3 answers

Use views and table valued functions as node or edge tables in match clauses

I like to use Table Valued functions in MATCH clauses in the same way as is possible with Node tables. Is there a way to achieve this? The need for table valued functions There can be various use cases for using table valued functions or views as…
1
vote
1 answer

Export CSV data from SQL Server for import into Neo4j Graph Database

I need to bulk import some highly connected data from SQL Server into Neo4j for analysis. There are 2 links in the Neo4j developer guide which discusss this: Guide: Import CSV Guide: Importing data and ETL My first attempt to import data from a…
Adam
  • 1,932
  • 2
  • 32
  • 57
0
votes
1 answer

Twitter like Model using SQL Server/Azure or Graph DB

Is it possible to design a twitter like DB using SQL server? a DB that will ensure high scalability and fast queries. I am building a .NET platform that requires a similar model like twitter (User, Follower, Tweet) and looking into what will fit…
0
votes
1 answer

How to Find Duplicates Over Multiple Columns Using SQL Server

Is it possible to find duplicates in a SQL table across multiple columns in a way that only requires a match by one of the columns? For example, lets say I have a table with the following Schema: ID, C1, C2 My goal is to return a new table with a…
0
votes
1 answer

Referential integrity between a graph node and a table in SQL Server

I have a table called Customer with primary key CustomerId. I have a graph node called CustomerNode. The CustomerNode has CustomerId as one of the columns. I want to establish a referential integrity between these two tables so an accidental…
wonderful world
  • 10,969
  • 20
  • 97
  • 194
0
votes
1 answer

Represent an XML Schema and its Data in a SQL Server Graph Schema

I have a problem where I need to represent an XML Schema and its data inside of a SQL Server Database. I need to be able to access the data in a way that will allow me to create either an XML or JSON file. I have looked at couple of solutions to…
Cragly
  • 3,554
  • 9
  • 45
  • 59