Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpEft-0006bX-C3 for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 16:27:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpEfr-0001tq-TM for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 16:26:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpEfr-0001m4-GI for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 16:26:59 +0000 Received: from sonic313-13.consmr.mail.bf2.yahoo.com ([74.6.133.123]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpEfk-00050v-KI for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 16:26:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1563726410; bh=1xhs3Q0waZD/5gcR5v+MN29Bu82gUUO9Zkz6dI/1eyE=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=gtArU9mRxJCiwQzcUD15bvl3iIxUhfLoBG6zHfLApaPOYHC8pdsw/EQ5BGHi053zjHcmr3EoJuNw9hGYm/YEhiawk8AY3hc5AY7ZRdbW26y6RcQV3Ub9aG1pA1aya5GiY0XUCfXPfFZLgNwZLwlQaAsU9MBjUqtFB2b6WTKkCTwXGqT9gKHJ4y0JW3zF4tVY+A3PT6h7qRdaWOVsASDsQuunzoRnEZZzootTVi+FXmFNossnkDzAvQ43SuUOHrTCdA96P7L5b3D2hibBkU+HJHOLtEysgJWxOH1EYQ9KHAV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2ofDLxTPaBPfUKtZpWArFhIb_bZLq7ybb54guRkJ 5uKFeTqqZMHEhd.5Tb2sPGjFYRRQfjqGCYMgmKZ0cbQpWGO.9n5SX1djYOQD75Ww3ljmtyplwnvE JzOmKC.aPxenfvsIcXq9m_2PWQm3q1L7pcR_nE0e6d_1_tQXugaYQRo4dEOs3eTW9DFK5cYR.kzo dvw0upxSeQxWK5pk9YuLnz2psPPxQMQSFc4zQWuhjaTjB7yqYIyujii0NtlM7nvt7BKBkxuiLw7j k4LG6v7kut6HtgFU34XDLjrssDL9QG2vCBekgkmRpRrx3y_NJvjgxXfmO3UQWgtXgOMOjs_WisRA - Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Sun, 21 Jul 2019 16:26:50 +0000 Date: Sun, 21 Jul 2019 16:26:43 +0000 (UTC) From: Karen Goh To: Avin Kavish Cc: Ron , Message-ID: <842365220.2655538.1563726403478@mail.yahoo.com> In-Reply-To: References: <820008379.2579287.1563670685484@mail.yahoo.com> <5CE41E80-274A-44DA-9553-E2DCA260F751@jakobs.com> <385857992.2643116.1563717238725@mail.yahoo.com> <923fb3b1-90e9-e0b5-bc5b-d896128c3f28@gmail.com> <1745586001.2633224.1563719075867@mail.yahoo.com> <905425626.2686338.1563721213121@mail.yahoo.com> <2030754658.2646264.1563721831668@mail.yahoo.com> <75125c45-0fed-e5f1-50f0-9646db20dde6@gmail.com> <927283546.2681887.1563722628862@mail.yahoo.com> Subject: Re: How do I alter an existing column and add a foreign key which is a Primary key to a table? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2655537_627039790.1563726403476" X-Mailer: WebService/1.1.13991 YahooMailIosMobile Yahoo%20Mail/45955 CFNetwork/978.0.7 Darwin/18.6.0 Content-Length: 9045 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2655537_627039790.1563726403476 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sent from Yahoo Mail for iPhone On Monday, July 22, 2019, 12:10 AM, Avin Kavish wrot= e: Hey Karen, That query is pretty much an inner join with a filter that selects a single= value from the matching rows.=C2=A0It's picking the tutor's zipcode from t= he tutor table where any tutor is teaching a subject called "Angela Merkel"= .=C2=A0For this to happen, it needs to join the tutor subjects with the tut= or details table using the tutor id as the common factor. Perhaps you should try www.stackoverflow.com for SQL guidance. They might b= e able to explain in detail what you are doing (wrong).=C2=A0Make sure to p= rovide a complete example showing all the involved relations and references= and any queries your wrote. This is reallyimportant or they downvote/close= questions. (your original email is not sufficient detail) This is the wrong forum so you need not reply cos Ron has mentioned already= . N also, why select zip code when it is not even supplied with a value? If this is not the mailing list then why do PostgreSQL suggest user to subs= cribe this? Regards,Avin On Sun, Jul 21, 2019 at 8:54 PM Karen Goh wrote: =20 On Sunday, July 21, 2019, 11:13:58 PM GMT+8, Ron = 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 > wrote: > > > On Sunday, July 21, 2019, Karen Goh 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=E2=80=99t and I don=E2=80=99t 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 =3D tutor_subject.tutor_id and tutor_subject.subject_names =3D'Angela Merkel' Hi Ron, Could you explain why you select s_tutor.zipcode from tutor_subject since t= here is no zipcode inside tutor_subject? Perhaps my reasoning is wrong and I really want to have your expert view.= =20 --=20 Angular momentum makes the world go 'round. =20 ------=_Part_2655537_627039790.1563726403476 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Sent fr= om Yahoo Mail for iPhone

On M= onday, July 22, 2019, 12:10 AM, Avin Kavish <avinkavish@gmail.com> wr= ote:

Hey Karen,

Th= at query is pretty much an inner join with a filter that selects a single v= alue from the matching rows. 
It's picking the tutor's zipco= de from the tutor table where any tutor is teaching a subject called "Angel= a Merkel". 
For this to happen, it needs to join the tutor s= ubjects with the tutor details table using the tutor id as the common facto= r.

Perhaps you should try www.stackoverflow.com for SQL guidance. They might be able to ex= plain in detail what you are doing (wrong). 
Make sure to pr= ovide a complete example= showing all the involved relations and references and any queries your wro= te. This is really
important or they downvote/close questions. (y= our original email is not sufficient detail)

This = is the wrong forum so you need not reply cos Ron has mentioned already.

N also, why select zip code when it is not even suppl= ied with a value?

If this is not the mailing list = then why do PostgreSQL suggest user to subscribe this?

=


Regards,
Avin

On Sun, Jul 21, 2019 at 8:54 PM = Karen Goh <karenw= orld@yahoo.com> wrote:





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 Sund= ay, July 21, 2019, Karen Goh <karenworld@yahoo.com> wrote:
>
>
> Is there a way for me to generat= e an entity table diagram vis pgAdmin4 or
> PSQL ?
>
>
> Just writ= e the 5 or so tables out in a somewhat compressed format. Psql
> doesn=E2=80=99t and I don=E2=80=99t 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 TA= BLE public.s_tutor ALTER COLUMN tutor_id ADD GENERATED BY DEFAULT
> AS IDENTITY (
> SEQUENCE NAME public.tu= tor_strtutorid_seq
> START WITH 1
&g= t; INCREMENT BY 1
> NO MINVALUE
>= NO MAXVALUE
> CACHE 1
> );
>
> tutor_subject
&g= t; ----------------
> tutor_id
> = subject_Names


selec= t s_tutor.zipcode
from s_tutor, tutor_subject
where s_tutor.tutor_id =3D tutor_subject.tutor_id
= and tutor_subject.subject_names =3D'Angela Merkel'

Hi Ron,

Could you expla= in why you select s_tutor.zipcode from tutor_subject since there is no zipc= ode inside tutor_subject?

Perhaps my r= easoning is wrong and I really want to have your expert view.


--
Angular m= omentum makes the world go 'round.


------=_Part_2655537_627039790.1563726403476--