Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 635165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:22:29+00:00 2026-05-13T20:22:29+00:00

I didn’t write any trigger for my works. Now i want to know how

  • 0

I didn’t write any trigger for my works. Now i want to know how to write trigger and where do I write it. Is it possible to write trigger as SQL query in phpmyadmin.

Please help me to write a simple trigger…

I tried like below

Create Trigger sales_bi_trg
BEFORE INSERT ON sales
FOR EACH ROW
BEGIN
DECLARE num_row INTEGER ;
DECLARE tot_rows INTEGER ;
SELECT COUNT(*)
INTO tot_rows
FROM sales
WHERE employee_id = NEW.employee_id ;
   IF num_row > 0 THEN
       UPDATE perfomance 
    SET total_sales = NEW.sale_amt + total_sales,
    ave_sale = total_sales/(tot_rows + 1)
    WHERE employee_id = NEW.employee_id ;
   ELSE
   INSERT INTO perfomance
(employee_id, name, total_sales,ave_sale)
VALUES (NEW.employee_id, NEW.name, NEW.sale_amt, NEW.sale_amt) ;
   END IF ;

Thanks in advance
Nisanth

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:22:29+00:00Added an answer on May 13, 2026 at 8:22 pm

    In phpMyAdmin you can create the trigger in the SQL window.

    You may have to set the delimieter to something like “$$” instead of the default “;”. You can change this easily from the bottom of the SQL window.

    Delimiter in phpMyAdmin http://img52.imageshack.us/img52/9144/phpmyadmin.jpg

    In addition, make sure you close your trigger block with the END command, which is missing from your example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I didn't manage to find any functionalities for minimizing/maximizing programatically. I want to minimize
I didn't find anywhere whether is possible to query from Db4o all objects implementing
didn't found any help with the search... I'm going to do something like loading
I didn't know how to ask professional so if topic is wrong, please correct
I didn't write this CSS and I don't know what to do with this
Didn't find any from their website. I mostly just trying to see which one
i didn't really know how to title this question, but here's a thing that
I didn't find it on their doc http://www.sqlite.org/lang_corefunc.html So just want to get confirm
I didn't get any overlay change when my teammates make changes or add a
I didn't want to ask this as an 'answer' to A Question Someone Beat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.