<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kirinyet Brian</title>
    <description>The latest articles on DEV Community by Kirinyet Brian (@kirinyetbrian).</description>
    <link>https://dev.to/kirinyetbrian</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F360317%2F0e1c6ef3-f0cc-4d5a-bc2f-7f28cb869453.png</url>
      <title>DEV Community: Kirinyet Brian</title>
      <link>https://dev.to/kirinyetbrian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kirinyetbrian"/>
    <language>en</language>
    <item>
      <title>mysql triggers</title>
      <dc:creator>Kirinyet Brian</dc:creator>
      <pubDate>Wed, 02 Sep 2020 10:35:56 +0000</pubDate>
      <link>https://dev.to/kirinyetbrian/mysql-triggers-35ao</link>
      <guid>https://dev.to/kirinyetbrian/mysql-triggers-35ao</guid>
      <description>&lt;p&gt;Hello. I need 2 small triggers written. Now before you tell me I could just run a join in my select query to get what I'm looking for, other limitations not in my control will not allow me to do so. So, I need to get creative...&lt;/p&gt;

&lt;p&gt;Trigger 1:&lt;br&gt;
On insert into the Contact table, I need a trigger to copy the ExternalId from the Company related to a new contact record to the CompanyExtId field on the Contact.&lt;/p&gt;

&lt;p&gt;On update of an existing record in the Contact table, I need a trigger to copy the ExternalId from the (potentially updated) Company related to the updated contact record to the CompanyExtId field on the Contact.&lt;/p&gt;

&lt;p&gt;Here is an example schema:&lt;br&gt;
create TABLE Company (Id int auto_increment, Name char(20), ExternalId char(20), PRIMARY KEY (Id));&lt;br&gt;
create TABLE Contact (Id int auto_increment, FirstName char(20), LastName char(20), CompanyExtId char(20), PRIMARY KEY (Id));&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
