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 1hpE0k-0004tI-QO for pgsql-sql@arkaria.postgresql.org; Sun, 21 Jul 2019 15:44:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpE0j-0003qi-3T for pgsql-sql@arkaria.postgresql.org; Sun, 21 Jul 2019 15:44:29 +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 1hpE0i-0003ld-PI for pgsql-sql@lists.postgresql.org; Sun, 21 Jul 2019 15:44:28 +0000 Received: from sonic310-14.consmr.mail.bf2.yahoo.com ([74.6.135.124]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpE0g-0004d2-L7 for pgsql-sql@lists.postgresql.org; Sun, 21 Jul 2019 15:44:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1563723864; bh=TGpdtYkJ42iP69dSnJtJn8BORHWodiWHe7wPBt4IYWg=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=KYek/9QIN9xyTyYX9oeSu4AdP5tt+/m27U2ZxULs0Ujgnx7eo6dxkZ4MrHj8xcYYOogjZK//xUrg5caaMmnWdCe7b55T2reH1UJC46PDQwy+VV1w3FiJ4owyQjOioQWBqrnTtz5aMWXtBTOhcVv0xSYyc5DA7ZkAJEn5D5wOjwJdb1O8YVGLGvqyRX71A6rX4sMuySC440UMJSXTANQ6Pu9pDKEtaC4T5Y0UgPmurXzGfu1ZLUQuAUrrwHBeB/32TG39UaMzk76IYR0vbCBbDOMq0i769a9LP0zuB1U25ICxbc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lAMLUwsY6KdULAkNzZ1Bemo_ 7RzKtYYnjcEpBjGCbfNJEMfjwnLHtyr91earGQSiAZV1cwVO41eCQweVCnrB2OLvCEFy.tk3gQqJ BJTtjuJnDERSbDCdE62TU7WTEHWHoUKj9EJArTuLzVWQMniZIh1HIy0lFyvm9jOsFY.jryFP2Ul5 2.T4Hf08yIpKEnXteauSrLmeKnUNArD8X_gpN0M2oiQHPqgp4HKsGh7JY2OxbEDcOnGrDd68dlFf AXrIwYl76DuHk Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Sun, 21 Jul 2019 15:44:24 +0000 Date: Sun, 21 Jul 2019 15:44:19 +0000 (UTC) From: Karen Goh To: pgsql-sql@lists.postgresql.org Cc: ronljohnsonjr@gmail.com Message-ID: <399235007.2656927.1563723859746@mail.yahoo.com> In-Reply-To: <931856e7-528d-35e5-3b9d-2e972a7df3a6@gmail.com> 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> <931856e7-528d-35e5-3b9d-2e972a7df3a6@gmail.com> Subject: Fw: 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_2656926_437019819.1563723859745" Content-Length: 5764 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2656926_437019819.1563723859745 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hope that this is the right place to ask about this regarding how Ron suggested to do a Select something when it is not inside a table at all. He said this is something basic. So hope someone could clarify. Thanks ----- Forwarded Message ----- From: Ron Cc: "pgsql-admin@lists.postgresql.org" Sent: Sunday, July 21, 2019, 11:37:34 PM GMT+8Subject: Re: How do I alter an existing column and add a foreign key which is a Primary key to a table? On 7/21/19 10:23 AM, Karen Goh wrote: > > On Sunday, July 21, 2019, 11:13:58 PM GMT+8, Ron > wrote: > > > On 7/21/19 10:10 AM, Karen Goh wrote: [snip] > > > > 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? > I did not do what you think I did. > Perhaps my reasoning is wrong and I really want to have your expert view. It might sound harsh, but is not meant to be: this list is for administering PostgreSQL, not teaching basic SQL. -- Angular momentum makes the world go 'round. ------=_Part_2656926_437019819.1563723859745 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hope that this is the right place to ask about this re= garding how Ron suggested to do a Select something when it is not inside a = table at all. He said this is something basic. So hope someone could clar= ify.

Thanks
=
----- Forwarded Message -----
From:<= /b> Ron <ronljohnsonjr@gmail.com>
Cc: "pgsql-admin@l= ists.postgresql.org" <pgsql-admin@lists.postgresql.org>
= Sent: Sunday, July 21, 2019, 11:37:34 PM GMT+8
Subject: Re: How do I alter an existing column and add a foreign key which is a Pr= imary key to a table?

On 7/21/19 10:23 AM, Karen Goh 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:
[snip]
> >
> > Here is a compressed format :<= br clear=3D"none">> >
> > 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 COL= UMN tutor_id ADD GENERATED BY DEFAULT
> > AS IDENTI= TY (
> > SEQUENCE NAME public.tutor_strtutorid_seq<= br clear=3D"none">> > START WITH 1
> > INCREM= ENT BY 1
> > NO MINVALUE
> >= ; NO MAXVALUE
> > CACHE 1
> &g= t; );
> >
> > tutor_subject=
> > ----------------
> > t= utor_id
> > subject_Names
>>
> select s_tutor.zipcode
> from s_tutor, tutor_subject
> where s_t= utor.tutor_id =3D tutor_subject.tutor_id
> and tutor_s= ubject.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?
= >

I did not do what you think I did= .

> Perhaps my reasoning is wrong a= nd I really want to have your expert view.

It might sound harsh, but is not meant to be: this list is for adminis= tering
PostgreSQL, not teaching basic SQL.


-- <= br clear=3D"none">Angular momentum makes the world go 'round.


------=_Part_2656926_437019819.1563723859745--