Re: How do I alter an existing column and add a foreign key whichis a Primary key to a table? - Mailing list pgsql-admin

From Karen Goh
Subject Re: How do I alter an existing column and add a foreign key whichis a Primary key to a table?
Date
Msg-id 927283546.2681887.1563722628862@mail.yahoo.com
Whole thread Raw
In response to Re: How do I alter an existing column and add a foreign key which isa Primary key to a table?  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: How do I alter an existing column and add a foreign key which isa Primary key to a table?
Re: How do I alter an existing column and add a foreign key which isa Primary key to a table?
List pgsql-admin





On Sunday, July 21, 2019, 11:13:58 PM GMT+8, Ron <ronljohnsonjr@gmail.com> wrote:


On 7/21/19 10:10 AM, Karen Goh wrote:

>
> On Sunday, July 21, 2019, 11:06:16 PM GMT+8, David G. Johnston
> <david.g.johnston@gmail.com> wrote:
>
>
> On Sunday, July 21, 2019, Karen Goh <karenworld@yahoo.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


select s_tutor.zipcode
from s_tutor, tutor_subject
where s_tutor.tutor_id = tutor_subject.tutor_id
and tutor_subject.subject_names ='Angela Merkel'

Hi Ron,

Could you explain why you select s_tutor.zipcode from tutor_subject since there is no zipcode inside tutor_subject?

Perhaps my reasoning is wrong and I really want to have your expert view.


--
Angular momentum makes the world go 'round.



pgsql-admin by date:

Previous
From: Ron
Date:
Subject: Re: How do I alter an existing column and add a foreign key which isa Primary key to a table?
Next
From: Ron
Date:
Subject: Re: How do I alter an existing column and add a foreign key which isa Primary key to a table?