Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?

From: Karen Goh <karenworld(at)yahoo(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org, Ron <ronljohnsonjr(at)gmail(dot)com>
Subject: Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?
Date: 2019-07-21 15:10:31
Message-ID: 2030754658.2646264.1563721831668@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

On Sunday, July 21, 2019, 11:06:16 PM GMT+8, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

On Sunday, July 21, 2019, Karen Goh <karenworld(at)yahoo(dot)com> wrote:

Is there a way for me to generate an entity table diagram vis pgAdmin4 or PSQL ?

Just write the 5 or so tables out in a somewhat compressed format. Psql doesn’t and I don’t know about pgadmin

Here is a compressed format :

s_tutor
--------
zipcode(text)
tutor_id (I just checked this is becomes a 'serial id ?' based on the generated sql

ALTER TABLE public.s_tutor ALTER COLUMN tutor_id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.tutor_strtutorid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);

tutor_subject
----------------
tutor_id
subject_Names

David J.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2019-07-21 15:13:37 Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?
Previous Message David G. Johnston 2019-07-21 15:06:06 Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?

Browse pgsql-sql by date

  From Date Subject
Next Message Ron 2019-07-21 15:13:37 Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?
Previous Message David G. Johnston 2019-07-21 15:06:06 Re: How do I alter an existing column and add a foreign key which is a Primary key to a table?