pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael J Davis <michael.j.davis@tvguide.com>
To: 'Adam H. Pendleton' <apendleton@vgsinc.com>
To: pgsql-sql@hub.org
Subject: RE: [SQL] Trigger question
Date: Mon, 10 May 1999 13:41:41 -0500
Message-ID: <93C04F1F5173D211A27900105AA8FCFC1454CC@lambic.prevuenet.com> (raw)

I would not store the last name in the employee_payroll table.  I the
primary should be something like an employee_id.  This would eliminate the
need to update the employee_payroll table every time an employee name
changes.

> -----Original Message-----
> From:	Adam H. Pendleton [SMTP:apendleton@vgsinc.com]
> Sent:	Monday, May 10, 1999 11:38 AM
> To:	pgsql-sql@hub.org
> Subject:	[SQL] Trigger question
> 
> I have a dilema, and I'm not sure what the best way to go about solving it
> is.  I have a table called employee_master, and a table called
> employee_payroll.  The primary key for both tables is the employee name.
> It
> would be easy for me to set up a trigger that checked the master table
> when
> inserting into the payroll table to make sure the employee exists. My
> problem is this:  The employee names are stored Last, First in both
> tables.
> The data file I am parsing to insert into the payroll table contains just
> the last name.  Now I can make a trigger that uses a 'like' and checks the
> employees division as well to ensure that they are in the employee_master,
> but how do I update with just the last name?  I don't want to insert, I
> need
> to be able to update the data in the row.
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Si hoc legere scis nimium eruditionis habes.
> 
> 



view thread (14+ messages)  latest in thread

Message-ID: <93C04F1F5173D211A27900105AA8FCFC1454CC@lambic.prevuenet.com>
Permalink:  ../93C04F1F5173D211A27900105AA8FCFC1454CC@lambic.prevuenet.com/
Also on:    postgresql.org/message-id/93C04F1F5173D211A27900105AA8FCFC1454CC@lambic.prevuenet.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: michael.j.davis@tvguide.com, apendleton@vgsinc.com, pgsql-sql@hub.org
  Subject: RE: [SQL] Trigger question
  In-Reply-To: <93C04F1F5173D211A27900105AA8FCFC1454CC@lambic.prevuenet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox