SQL 2023 ist da. Der Standard kostet natürlich Geld. Hier gibt es eine Übersicht über die neuen Features. Interessant sind “Property Graph Queries”.
Beispiel aus dem verlinkten Post:
CREATE TABLE person (...);
CREATE TABLE company (...);
CREATE TABLE ownerof (...);
CREATE TABLE transaction (...);
CREATE TABLE account (...);
CREATE PROPERTY GRAPH financial_transactions
VERTEX TABLES (person, company, account)
EDGE TABLES (ownerof, transaction);
SELECT owner_name,
SUM(amount) AS total_transacted
FROM financial_transactions GRAPH_TABLE (
MATCH (p:person WHERE p.name = 'Alice')
-[:ownerof]-> (:account)
-[t:transaction]- (:account)
<-[:ownerof]- (owner:person|company)
COLUMNS (owner.name AS owner_name, t.amount AS amount)
) AS ft
GROUP BY owner_name;