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 1hpEjd-0006mn-EG for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 16:30:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpEjc-0003BV-7k for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 16:30:52 +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 1hpEjb-0003BO-Uh for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 16:30:51 +0000 Received: from sonic303-2.consmr.mail.bf2.yahoo.com ([74.6.131.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpEjZ-00053K-7a for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 16:30:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1563726646; bh=behTYxxdRzeYScFRvxEGkQZ2Je6Js+h+J33ETgipY+E=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=XV9UJajTGpziMquLRiTiJ76ihLKVf3dJ3qgzjFNb2ar2LkFUURQx9KV3z32mqjg5451wCX8rGqfUCyuK9vo/nvvMv6YdJSLyyR0h+KA/ZV92G3gw75QVZBuSFZG8wNN8UCwATKE2aWR08dxOAeGg9D87g5ZJfD2C2XTwajRY3fxB6JSHFGMYj5XgvsokGY2PPmNAtG8sJQFVhtQ6kgtrIjpmNfissYPkc6ilY0RFmI+VCvr+lG4dLA7I9V6FmHiNAAm27PStxqFVucgbIrZzOo0n4F8EftBfIiYuD39ilu5J0Ww1q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4dg7YP55IlzhQdEoGRqOa8r VVTWU6zS7cpWTuIjzOcMK7f4d5Tu9SUlGsGX17DVAXkISGCHnvzWRb7UycIgQ9AqVqUWD9LIANDF mpvqBxmCbbZdTDh_zaVEQSvBeXxykieVzpRNOCX4c_9AJ2DeDlQdqESuvTjy78mJ62crnNxselK2 FJli77f7ppe9ghJPSSUhOwHnkcj483gO4nLe.Tlq4jNyLQvU2DfXl3voksUC8dp5IdgTL4AZdFqO gGXrLE.xxuNMEcHh955jo5rjiP59ffWCa97_L_eY- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Sun, 21 Jul 2019 16:30:46 +0000 Date: Sun, 21 Jul 2019 16:30:42 +0000 (UTC) From: Karen Goh To: Avin Kavish Cc: Ron , Message-ID: <1465046932.2664428.1563726642792@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_2664427_1671436358.1563726642791" X-Mailer: WebService/1.1.13991 YahooMailIosMobile Yahoo%20Mail/45955 CFNetwork/978.0.7 Darwin/18.6.0 Content-Length: 8702 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2664427_1671436358.1563726642791 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. N I need to return tutor_id so it is terribly wrong !!! So, in addition to = value not being supplied.=C2=A0 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) 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_2664427_1671436358.1563726642791 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.

N I need to return tutor_id so it is terribly w= rong !!! So, in addition to value not being supplied. 

Perhaps you should try www.stack= overflow.com for SQL guidance. They might be able to explain in detail = what you are doing (wrong). 
Make sure to provide a complete example showing all t= he involved relations and references and any queries your wrote. This is re= ally
important or they downvote/close questions. (your original e= mail is not sufficient detail)

Rega= rds,
Avin

On Sun, Jul 2= 1, 2019 at 8:54 PM Karen Goh <karenworld@yahoo.com> wrote:
=




On Sunday, July 21, 2019, 11:13:58 PM GMT+8, R= on <ronljoh= nsonjr@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<= /a>> 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=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 (
> SEQUENC= E 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_sub= ject
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 = there is no zipcode inside tutor_subject?

Perhaps my reasoning is wrong and I really want to have your expert vie= w.


--
Angular momentum makes the world go 'round.



=
------=_Part_2664427_1671436358.1563726642791--