What is trigger in SQL?

Asked by Last Modified  

2 Answers

Follow 2
Answer

Please enter your answer

All Subjects & C.Sci Tutor

A trigger is a special SQL procedure that runs automatically in response to events like INSERT, UPDATE, or DELETE on a table.
Comments

Data Analyst with 10 years of experience in Fintech, Product ,and IT Services

A trigger in SQL is a set of SQL statements that automatically execute or "fire" when a specific event occurs in a database table, such as INSERT, UPDATE, or DELETE. Triggers are often used to enforce business rules, validate data, or keep logs of changes. Key points about triggers: Event-driven:...
read more
A trigger in SQL is a set of SQL statements that automatically execute or "fire" when a specific event occurs in a database table, such as INSERT, UPDATE, or DELETE. Triggers are often used to enforce business rules, validate data, or keep logs of changes. Key points about triggers: Event-driven: Triggers execute automatically when a specified event occurs. Types: BEFORE Trigger: Runs before the operation (INSERT, UPDATE, DELETE). AFTER Trigger: Runs after the operation. Usage: Can be used for auditing, enforcing constraints, and more. Example: To create a trigger that logs changes made to a table: CREATE TRIGGER LogChanges ON Employees AFTER UPDATE AS BEGIN INSERT INTO EmployeeAudit (EmployeeID, OldSalary, NewSalary, ChangeDate) SELECT EmployeeID, deleted.Salary, inserted.Salary, GETDATE() FROM inserted INNER JOIN deleted ON inserted.EmployeeID = deleted.EmployeeID; END; This trigger logs salary changes into the EmployeeAudit table after an update on the Employees table. Here is my number Call 073-1485-0321. read less
Comments

Related Questions

My name is Rajesh , working as a Recruiter from past 6 years and thought to change my career into software (development / admin/ testing ) am seeking for some suggestion which technology I need to learn ? Any job after training ? Or where I can get job within 3 months after finishing my training programme- your advices are highly appreciated
Mr rajesh if you want to enter in to software Choose SAP BW AND SAP HANA because BW and HANA rules the all other erp tools next 50 years.it provides rubust reporting tools for quicker decesion of business It very easy to learn
Rajesh
1 0
6

How to learn math online?

Via skype you can teach everything online
Robin
I can't speak English in frond of the people. Any suggestions to overcome this?
If you want to improve your English, you need to be confident in your abilities. Some of the tips... - Read Texts Out Loud:If you are nervous about speaking in front of others, start reading aloud by...
Vincent

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Handbook of websites for Website Developers/Designers (software professionals)
Know the trending languages(past & present) and their comparision with other languages: @ https://www.tiobe.com/tiobe-index/ Found an interesting website? identify the technologies used to build...

"Employee Performance Rating Using SQL CASE Statement – Real-Time Use Case"
Topic: SQL CASE Statement for Conditional Categorization This lesson shows how to use the CASE statement in SQL to classify employees based on their performance score. Use Case: In performance appraisal...

"Top 5 Highest Paid Employees – SQL Query with Real-Time Insight"
Topic: SQL ORDER BY & LIMIT for Business Insights This lesson demonstrates how to extract the top 5 highest-paid employees using simple SQL techniques. Use Case: In many HR analytics reports,...

Master SQL for Data Analytics in 2025!
Master SQL for Data Analytics in 2025! Join my Complete MySQL Training Program – theory + real-time project + interview prep. Includes Self-Learning Kit + Live Sessions + Certification Support ...

More Opportunities in IT industry
Learn any DBA and good package. Bcoz many openings in IT on DBA side.
K

K C Reddy

1 0
0

Recommended Articles

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Looking for MySQL Training?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you