I use pgadmin4 and cannot figure out how to make a foreign key. The point is, I have two tables and I need to organize a 1: n relationship between them. Those. The projects table needs to add an attribute that refers to the user table. Tried to do this using the Query Tool, with the string "user_id integer REFERENCES user," does not allow to create the projects table.
CREATE TABLE public.projects ( id integer NOT NULL, name_project character varying(80), attribute character varying(80), value character varying(80), user_id integer REFERENCES user, PRIMARY KEY (id) ) WITH ( OIDS = FALSE ); ALTER TABLE public.projects OWNER to magic;