agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Karen Goh <karenworld@yahoo.com>
To: pgsql-sql@lists.postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Fw: How do I alter an existing column and add a foreign key which is a Primary key to a table?
Date: Sun, 21 Jul 2019 15:44:19 +0000 (UTC)
Message-ID: <399235007.2656927.1563723859746@mail.yahoo.com> (raw)
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>
<CAKFQuwYwO4EdGQ_H6avBUQaeUTOyoLFw17OicCXsFzVVri4aUw@mail.gmail.com>
<905425626.2686338.1563721213121@mail.yahoo.com>
<CAKFQuwahWO9HrmcNjkfkaj0cAbFJB6mTVEOUGQZiy9EojTJQOw@mail.gmail.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>
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 <ronljohnsonjr@gmail.com>Cc: "pgsql-admin@lists.postgresql.org" <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 <ronljohnsonjr@gmail.com>
> 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.
view thread (26+ messages) latest in thread
Message-ID: <399235007.2656927.1563723859746@mail.yahoo.com>
Permalink: ../399235007.2656927.1563723859746@mail.yahoo.com/
Also on: postgresql.org/message-id/399235007.2656927.1563723859746@mail.yahoo.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: karenworld@yahoo.com, pgsql-sql@lists.postgresql.org, ronljohnsonjr@gmail.com
Subject: Re: Fw: How do I alter an existing column and add a foreign key which is a Primary key to a table?
In-Reply-To: <399235007.2656927.1563723859746@mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox