title: Trigger selection from same table
body: <p>I would like to ask a question about triggers. Let's say that I have a table T and I need a trigger before update. However, I have a problem. I need to check a condition using the other rows of T from the trigger. My question is: Which RDBMS's support this? Where can I write triggers which perform selection(s) on the same table where the trigger fires. For instance:</p>
  
  <pre><code>CREATE TRIGGER updtrigger BEFORE UPDATE ON Employee
      -&gt; FOR EACH ROW
      -&gt; BEGIN
      -&gt; IF NEW.Salary&lt;=500 THEN
      -&gt; SET NEW.Salary=10000;
      -&gt; ELSEIF NEW.Salary&gt;500 and NEW.Salary &lt; 600 THEN
      -&gt; SET NEW.Salary=15000;
      -&gt; ELSEIF NEW.Salary &gt; (select MAX(Salary) from Employee)
      -&gt; Set NEW.Salary = 601;
      -&gt; END IF;
      -&gt; END
      -&gt; //
  </code></pre>
  
  <p>Thank you,</p>
  
  <p>Best regards,</p>
  
  <p>Lajos Arpad.</p>