SQL Array type vs. Neo4j


(A Kan Jx) #1

I started to model my database using SQL but I had a problem. I need a field to be an Array of foreign keys but as I searched this is impossible with SQL. Is it possible to do something similar in Neo4j?

CREATE TABLE places (
id SERIAL PRIMARY KEY,
title text NOT NULL,
country integer NOT NULL REFERENCES countries(id),
state integer NOT NULL REFERENCES states(id),
city integer NOT NULL REFERENCES cities(id),
address text,
zipcode text NOT NULL,
services integer REFERENCES services(id)
);

CREATE TABLE services (
id SERIAL PRIMARY KEY,
title text NOT NULL
}


(Michael Hunger) #2

You don't have foreign keys you use relationship instead, which represent 1:1, 1:n or m:n connections.

You can also store arrays of values as properties, but that's unrelated.