Top 50 Triggers Interview Questions and Answers

Updated 14 Dec 2024

Q1. What is the trigger point?

Ans.

A trigger point is a sensitive area in the muscles or tissues that can cause pain or discomfort when stimulated.

  • Trigger points are often found in areas of muscle tension or overuse.

  • They can be felt as knots or tight bands in the muscle.

  • Trigger points can be caused by muscle injuries, stress, or poor posture.

  • They can refer pain to other areas of the body, known as referred pain.

  • Treatment for trigger points may include massage, stretching, or injections.

Add your answer

Q2. What is Trigger used nd where

Ans.

Triggers are used to automatically execute a set of instructions when a specific event occurs in a database.

  • Triggers are database objects that are associated with tables and are used to enforce business rules or to perform actions when data is modified.

  • They can be used to perform tasks such as auditing changes to data, enforcing referential integrity, or updating related tables.

  • Triggers can be defined to execute before or after an INSERT, UPDATE, or DELETE statement is execut...read more

Add your answer

Q3. Why we use stored procedures, trigger ?

Ans.

Stored procedures and triggers are used to improve database performance and maintain data integrity.

  • Stored procedures allow for precompiled SQL statements, reducing processing time.

  • Triggers can automatically enforce business rules and maintain data consistency.

  • Both stored procedures and triggers can improve security by limiting direct access to the database.

  • Examples of triggers include auditing changes to a table or automatically updating related data in another table.

  • Example...read more

Add your answer

Q4. What are the types of trigger in Salesforce

Ans.

Types of triggers in Salesforce include before triggers, after triggers, and future triggers.

  • Before triggers are used to update or validate record values before they are saved to the database.

  • After triggers are used to access field values that are set by the system (such as a record's ID) and to affect changes in other records.

  • Future triggers are used to perform operations asynchronously, such as sending email notifications or updating related records.

  • Examples: before insert ...read more

Add your answer
Are these interview questions helpful?

Q5. What is Diff Between constarints and triggers?

Ans.

Constraints are rules enforced on data in a table, while triggers are actions performed in response to certain events.

  • Constraints ensure data integrity and consistency, while triggers automate actions based on specific events.

  • Constraints are defined at the time of table creation, while triggers are created separately.

  • Constraints can be used to enforce rules such as unique values, primary keys, and foreign keys, while triggers can be used to perform actions such as logging cha...read more

Add your answer

Q6. What is procedures and triggers?

Ans.

Procedures and triggers are database objects used to automate tasks and enforce rules.

  • Procedures are a set of SQL statements that can be executed repeatedly.

  • Triggers are special types of procedures that are automatically executed in response to certain events.

  • Triggers can be used to enforce business rules, audit changes, or replicate data.

  • Procedures and triggers can be written in various programming languages such as SQL, PL/SQL, T-SQL, etc.

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q7. what is triiger in mysql ?

Ans.

A trigger in MySQL is a set of SQL statements that automatically execute in response to certain events.

  • Triggers can be used to enforce business rules or perform complex calculations.

  • They can be set to execute before or after an INSERT, UPDATE, or DELETE statement.

  • Triggers can also be used to audit changes to a database or replicate data to other tables.

  • Syntax: CREATE TRIGGER trigger_name trigger_time trigger_event ON table_name FOR EACH ROW trigger_body;

Add your answer

Q8. what mean by function and triggers

Ans.

Functions are blocks of code that perform a specific task, while triggers are events that automatically execute a function.

  • Functions are reusable blocks of code that can be called multiple times in a program.

  • Triggers are events that automatically execute a function, such as a button click or a database update.

  • Functions can take input parameters and return output values.

  • Triggers are often used in database systems to perform actions based on certain events, like inserting a new...read more

Add your answer

Q9. What is difference between scheduled trigger and tumbling window trigger

Ans.

Scheduled trigger is time-based while tumbling window trigger is data-based.

  • Scheduled trigger is based on a specific time or interval, such as every hour or every day.

  • Tumbling window trigger is based on the arrival of new data or a specific event.

  • Scheduled trigger is useful for regular data processing tasks, like ETL jobs.

  • Tumbling window trigger is useful for aggregating data over fixed time intervals.

  • Scheduled trigger can be set to run at a specific time, while tumbling wind...read more

Add your answer
Frequently asked in

Q10. what is triggers and async operation ?

Ans.

Triggers are actions that are automatically performed when a certain event occurs in a database. Async operations are tasks that run independently of the main program flow.

  • Triggers in databases are used to maintain data integrity and automate tasks based on specified conditions.

  • Async operations in programming allow tasks to be executed concurrently without blocking the main program flow.

  • Examples of async operations include fetching data from a server while the user continues ...read more

Add your answer

Q11. What are triggers , where can they be used ? What is a mutating trigger problem , how can it be solved?

Ans.

Triggers are database objects that execute automatically in response to certain events. Mutating trigger problem occurs when a trigger tries to read or modify a table that is already being modified by the same transaction.

  • Triggers can be used to enforce business rules, audit changes, and maintain referential integrity.

  • They can be used to automatically update a table when a related table is updated.

  • Mutating trigger problem can be solved by using compound triggers, which allow ...read more

Add your answer
Frequently asked in

Q12. What is TAC and explain triggers in TAC??

Ans.

TAC stands for Talend Administration Center. Triggers in TAC are used to schedule and automate the execution of jobs.

  • TAC is a web-based application used to manage, monitor, and administer Talend jobs and projects.

  • Triggers in TAC allow users to schedule the execution of jobs at specific times or based on certain conditions.

  • Triggers can be set to run jobs on a recurring basis, such as daily, weekly, or monthly.

  • Users can also set triggers to run jobs based on events, such as the...read more

Add your answer
Frequently asked in

Q13. What are Trigger context Variables

Ans.

Trigger context variables are predefined variables that contain information about the context in which a trigger is executed.

  • Trigger context variables are available in Apex triggers.

  • They provide information about the record being processed, the user who caused the trigger to execute, and the execution context.

  • Examples of trigger context variables include Trigger.new, Trigger.old, Trigger.isInsert, and Trigger.isUpdate.

Add your answer

Q14. Oracle Forms Sequence of Triggers

Ans.

Oracle Forms triggers are executed in a specific sequence.

  • The first trigger to fire is PRE-FORM.

  • The last trigger to fire is POST-FORM.

  • Other triggers include WHEN-NEW-FORM-INSTANCE, WHEN-NEW-BLOCK-INSTANCE, etc.

  • Triggers can be used to validate data, perform calculations, and control navigation.

Add your answer

Q15. Disadvantages of triggers

Ans.

Triggers can lead to performance issues, complexity, and potential for unintended consequences.

  • Triggers can make code harder to debug and maintain

  • They can lead to cascading effects if not carefully implemented

  • Performance can be impacted if triggers are not optimized

  • Triggers can introduce dependencies between different parts of the codebase

Add your answer

Q16. triggers in WPF?

Ans.

Triggers in WPF are used to apply changes to UI elements based on certain conditions or events.

  • Triggers can be used to change the appearance of a control based on user interaction or data changes.

  • There are different types of triggers in WPF such as EventTrigger, DataTrigger, and MultiTrigger.

  • Example: Using a DataTrigger to change the background color of a button based on a binding value.

Add your answer

Q17. different triggers in SLA other than Incident

Ans.

Triggers in SLA other than Incident

  • Change Requests

  • Problem Tickets

  • Service Requests

  • Major Incidents

Add your answer
Frequently asked in

Q18. Types of trigger in Oracle plsql

Ans.

Triggers in Oracle PL/SQL are database objects that automatically execute in response to specified events.

  • There are two types of triggers in Oracle PL/SQL: row-level triggers and statement-level triggers.

  • Row-level triggers fire once for each row affected by the triggering event, while statement-level triggers fire once for each triggering event.

  • Triggers can be defined to execute before or after the triggering event.

  • Triggers can be used to enforce business rules, perform data ...read more

Add your answer
Frequently asked in

Q19. What are SQL Triggers and its syntax?

Ans.

SQL Triggers are special stored procedures that are automatically executed in response to certain events.

  • Triggers are used to enforce business rules or to perform complex calculations.

  • Syntax: CREATE TRIGGER trigger_name {BEFORE | AFTER} {INSERT | UPDATE | DELETE} ON table_name FOR EACH ROW {trigger_body}

  • Trigger_body can contain SQL statements or calls to stored procedures/functions.

  • Triggers can be disabled or enabled using ALTER TRIGGER statement.

  • Triggers can be nested up to ...read more

Add your answer
Frequently asked in

Q20. What are different types of Trigger

Ans.

Types of triggers include DML triggers, DDL triggers, and logon triggers.

  • DML triggers are fired in response to data manipulation language (DML) events like INSERT, UPDATE, DELETE.

  • DDL triggers are fired in response to data definition language (DDL) events like CREATE, ALTER, DROP.

  • Logon triggers are fired in response to a LOGON event.

  • INSTEAD OF triggers are used to perform an action instead of the triggering action.

View 1 answer

Q21. What are Triggers? Is trigger a stored procedure?

Ans.

Triggers are database objects that are automatically executed in response to specified events.

  • Triggers are used to enforce business rules, maintain data integrity, and automate tasks.

  • They can be defined to execute before or after an INSERT, UPDATE, or DELETE operation.

  • Triggers can be written in SQL or PL/SQL, depending on the database system.

  • Unlike stored procedures, triggers are not explicitly called by users or applications.

  • Example: A trigger can be created to update a 'las...read more

Add your answer
Frequently asked in

Q22. What is triggers in salesforce

Ans.

Triggers in Salesforce are pieces of code that execute before or after specific events occur, allowing for customization and automation of business processes.

  • Triggers are used to perform actions based on specific events, such as record creation, update, or deletion.

  • They are written in Apex, Salesforce's proprietary programming language.

  • Triggers can be used to enforce business rules, validate data, or update related records.

  • They can be defined for different objects and can exe...read more

Add your answer
Frequently asked in

Q23. Difference between constraints and Declare trigger

Ans.

Constraints are used to restrict user input while Declare triggers are used to automate actions based on certain events.

  • Constraints are used to validate user input and ensure it meets certain criteria.

  • Declare triggers are used to automate actions based on certain events, such as when a new record is created or updated.

  • Constraints are defined at the property level while Declare triggers are defined at the class level.

  • Constraints can be used to enforce business rules and data i...read more

Add your answer

Q24. What is triggers and procedures?

Ans.

Triggers and procedures are database objects used to automate tasks and enforce business rules.

  • Triggers are special types of stored procedures that are automatically executed in response to certain events, such as insertions, updates, or deletions of data.

  • Procedures are a set of SQL statements that are stored in the database and can be executed repeatedly.

  • Triggers can be used to enforce business rules, such as preventing invalid data from being inserted into a table.

  • Procedure...read more

Add your answer

Q25. Triggers in mysql?

Ans.

Triggers in MySQL are database objects that are automatically executed in response to specified events.

  • Triggers are used to enforce business rules, maintain data integrity, and automate tasks.

  • They can be defined to execute before or after an INSERT, UPDATE, or DELETE operation.

  • Triggers can be written in SQL or in a programming language like PL/SQL.

  • Examples of trigger events include inserting a new record, updating a record, or deleting a record.

  • Triggers can be used to perform...read more

Add your answer
Frequently asked in

Q26. Can trigger be used with select statement?

Ans.

Yes, triggers can be used with select statements in SQL.

  • Triggers are database objects that are automatically executed in response to certain events, such as insert, update, or delete operations.

  • While triggers are commonly used with insert, update, and delete statements, they can also be used with select statements.

  • Using triggers with select statements allows you to perform additional actions or validations before or after the select operation.

  • For example, you can use a trigge...read more

Add your answer
Frequently asked in

Q27. What are triggers?What are stored procedures?

Ans.

Triggers are database objects that automatically execute in response to certain events. Stored procedures are precompiled SQL statements.

  • Triggers are used to enforce business rules or to audit changes to data.

  • Stored procedures are used to encapsulate frequently used SQL statements for reuse and to improve performance.

  • Triggers can be used to update related tables when a record is inserted, updated, or deleted.

  • Stored procedures can be used to perform complex data manipulations ...read more

Add your answer

Q28. What's the role of triggers in Salesforce?

Ans.

Triggers in Salesforce are used to perform automated actions before or after records are inserted, updated, or deleted.

  • Triggers are Apex scripts that are executed before or after specific data manipulation language (DML) events occur in Salesforce.

  • They can be used to perform tasks such as validating data, updating related records, or sending email notifications.

  • Triggers can be written for different objects in Salesforce, such as Accounts, Contacts, or Opportunities.

  • They are e...read more

Add your answer
Frequently asked in

Q29. The difference between a trigger and a constraint

Ans.

A trigger is a set of actions that are automatically performed when a specified event occurs, while a constraint is a rule that restricts the values in a database.

  • Triggers are used to perform actions such as updating other tables or logging changes when a certain event occurs, like an insert, update, or delete operation.

  • Constraints are used to enforce rules on the data in a database table, such as ensuring that a column does not contain null values or that a value is unique.

  • T...read more

Add your answer

Q30. What is trigger and why it used

Ans.

A trigger is a special type of stored procedure that automatically executes in response to certain events.

  • Triggers are used to enforce business rules or data integrity.

  • They can be used to audit changes to data.

  • Triggers can also be used to replicate data across multiple tables or databases.

  • Examples of trigger events include INSERT, UPDATE, and DELETE operations on a table.

Add your answer

Q31. What are triggers and stored procedures?

Ans.

Triggers and stored procedures are database objects used to automate tasks and enforce business rules.

  • Triggers are code that automatically executes in response to certain events, such as inserting or updating data in a table.

  • Stored procedures are pre-written code that can be called to perform a specific task, such as retrieving data or updating records.

  • Triggers and stored procedures can help ensure data integrity and consistency, as well as improve performance by reducing the...read more

Add your answer

Q32. How would you insert contacts to newly created contacts using trigger

Ans.

Use a trigger to insert contacts to newly created contacts

  • Create a trigger on the Contact object

  • Use the 'after insert' trigger event

  • Loop through the newly created contacts

  • Create a new contact for each one and set the necessary fields

  • Insert the new contacts

Add your answer
Frequently asked in

Q33. Write a trigger to create a contact whenever a account is created

Ans.

Create a trigger to automatically create a contact when an account is created

  • Use Apex trigger on Account object

  • Query the necessary information from the Account record

  • Create a new Contact record with the relevant information

  • Insert the Contact record

Add your answer
Frequently asked in

Q34. Can we use commit in Triggers

Ans.

No, COMMIT cannot be used in triggers.

  • COMMIT cannot be used in triggers as it can cause mutating table errors.

  • Triggers are automatically committed by the database after they are executed.

  • Using COMMIT in triggers can lead to data integrity issues and performance problems.

Add your answer

Q35. Write a trigger to update StageName on Opportunity whenever the Account Active field is set to Yes

Ans.

Trigger to update StageName on Opportunity when Account Active field is set to Yes

  • Create a trigger on Account object

  • Query for related Opportunities

  • Update StageName field on Opportunities where Account Active is Yes

Add your answer
Frequently asked in

Q36. Write trigger on parent child scenario

Ans.

Writing trigger on parent child scenario in Salesforce

  • Create trigger on parent object

  • Use trigger context variables to access child records

  • Perform necessary operations on child records based on parent record changes

Add your answer

Q37. write trigger to count the number of contacts any account contains.

Ans.

Write trigger to count the number of contacts any account contains.

  • Create a trigger on the Contact object

  • Query for all contacts related to the account

  • Use a count variable to keep track of the number of contacts

  • Update a custom field on the Account object with the count

Add your answer

Q38. Write a trigger on Order Products. It should display the most number of sold product type on the account. Eg: if most order products sold out of Tv, Ac and Fridge is Tv then update Tv as the most_sold_product o...

read more
Ans.

Create a trigger on Order Products to display the most sold product type on the account

  • Create a trigger on Order Products object in Salesforce

  • Use SOQL query to count the number of each product type sold

  • Update the most_sold_product field on the Account object with the highest sold product type

Add your answer
Frequently asked in

Q39. Write a trigger to find the duplicate value based on phone no and email

Ans.

Create a trigger to identify duplicate records based on phone number and email

  • Create a trigger on the object where duplicates need to be checked

  • Query for records with matching phone number and email

  • Handle the logic to flag or prevent duplicates from being created

  • Consider using a map to store unique values and compare with new records

Add your answer

Q40. Write a trigger to update field on child record from parent record.

Ans.

Use trigger to update child record field from parent record

  • Create a trigger on the parent object

  • Query for the child records related to the parent record

  • Update the field on the child records with the desired value

Add your answer
Frequently asked in

Q41. What's are triggers in SQL server

Ans.

Triggers in SQL server are special stored procedures that are automatically executed in response to certain events on a particular table or view.

  • Triggers can be used to enforce business rules, audit changes, or maintain referential integrity.

  • There are two main types of triggers in SQL server: DML triggers and DDL triggers.

  • DML triggers are fired in response to data manipulation language (DML) events like INSERT, UPDATE, and DELETE.

  • DDL triggers are fired in response to data def...read more

Add your answer

Q42. Write a trigger on Account. if one or more contact is associated with Account then show error if user tries to delete the account

Ans.

Create a trigger on Account to prevent deletion if associated with one or more contacts

  • Create an after delete trigger on Account object

  • Query for related contacts using SOQL

  • If contacts are found, add an error message to prevent deletion

Add your answer
Frequently asked in

Q43. what is the Trigger in SQL

Ans.

A trigger in SQL is a special type of stored procedure that is automatically executed when certain events occur in a database.

  • Triggers can be used to enforce business rules, perform auditing, or maintain referential integrity.

  • They can be defined to execute before or after an INSERT, UPDATE, or DELETE operation on a table.

  • Examples of triggers include automatically updating a last modified timestamp when a record is updated, or preventing deletion of a record if certain conditi...read more

Add your answer

Q44. How many triggers can we create on a table

Ans.

In SQL Server, you can create up to 32 triggers on a table.

  • SQL Server allows up to 32 triggers per table

  • Triggers can be of different types like DML triggers, DDL triggers, and logon triggers

  • Each trigger can be defined for INSERT, UPDATE, or DELETE operations

Add your answer

Q45. what is a trigger in SQL and how is it used?

Ans.

A trigger in SQL is a special type of stored procedure that is automatically executed when certain events occur in a database.

  • Triggers can be used to enforce business rules, maintain referential integrity, and automate repetitive tasks.

  • There are two main types of triggers in SQL: BEFORE triggers and AFTER triggers.

  • An example of a trigger is a BEFORE INSERT trigger that automatically sets a default value for a column if no value is provided.

Add your answer
Frequently asked in

Q46. What is the trigger function in SQL?

Ans.

A trigger function in SQL is a stored procedure that is automatically executed in response to certain events on a particular table.

  • Triggers can be set to execute before or after INSERT, UPDATE, or DELETE operations on a table.

  • They are useful for enforcing business rules, auditing changes, and maintaining data integrity.

  • Example: CREATE TRIGGER audit_trigger AFTER INSERT ON employees FOR EACH ROW EXECUTE PROCEDURE audit_function();

Add your answer

Q47. Which should prefer flow or trigger

Ans.

It depends on the specific requirements and use case.

  • Use flows for declarative automation and to automate standard processes.

  • Use triggers for more complex automation and to perform custom logic.

  • Flows are easier to build and maintain, while triggers offer more flexibility and control.

  • Consider the complexity of the automation, the need for custom logic, and the scalability of the solution.

Add your answer

Q48. Write trigger code for given scenario

Ans.

Trigger code to update a field in a table when a new record is inserted

  • Create a trigger on the table for INSERT events

  • Use the NEW keyword to access the newly inserted record

  • Update the desired field in the table using the NEW values

Add your answer

Q49. Write a trigger to update record in child abject as well as parent object

Ans.

Use a trigger to update records in both child and parent objects

  • Create a trigger on the child object that updates the related parent object

  • Use SOQL queries to retrieve and update the parent object records

  • Handle bulk updates by using trigger context variables like Trigger.new and Trigger.old

Add your answer
Frequently asked in

Q50. Before vs After Triggers

Ans.

Before triggers are executed before the record is saved to the database, while after triggers are executed after the record is saved.

  • Before triggers are used to validate or modify record values before they are saved.

  • After triggers are used to perform additional actions after the record is saved.

  • Before triggers can be used to prevent the record from being saved by throwing an exception.

  • After triggers can be used to update related records or perform asynchronous operations.

View 1 answer
Frequently asked in

Q51. Trigger for roll up summmary

Ans.

A trigger is used to perform calculations and updates on related records when a record is created, updated, or deleted.

  • Triggers are written in Apex and are used to automate processes in Salesforce.

  • They can be used to perform calculations, updates, or validations on related records.

  • For roll up summaries, triggers can be used to calculate and update summary fields on parent records based on child records.

  • Example: Trigger to calculate total amount of all related opportunities on...read more

Add your answer
Frequently asked in

Q52. Triggers in sql server

Ans.

Triggers are special stored procedures that are automatically executed in response to certain events.

  • Triggers can be used to enforce business rules or data integrity

  • They can be used to audit changes to data

  • Triggers can be defined to execute before or after an INSERT, UPDATE, or DELETE statement

  • They can be used to perform complex calculations or data transformations

Add your answer

Q53. Trigger to count no of opportunitylineitems and display in Accout custom field

Ans.

Create a trigger to count Opportunity Line Items and display in Account custom field

  • Create a trigger on OpportunityLineItem object

  • Use SOQL query to count the number of Opportunity Line Items related to the Account

  • Update the custom field on Account with the count value

Add your answer
Frequently asked in

Q54. Trigger in sql server

Ans.

A trigger in SQL Server is a special type of stored procedure that automatically executes when certain events occur in a database.

  • Triggers can be used to enforce business rules, audit changes, or replicate data.

  • There are two main types of triggers in SQL Server: DML triggers and DDL triggers.

  • DML triggers fire in response to data manipulation language (DML) events like INSERT, UPDATE, and DELETE.

  • DDL triggers fire in response to data definition language (DDL) events like CREATE...read more

Add your answer

Q55. sql triggers in db

Ans.

SQL triggers are database objects that automatically perform actions when certain events occur in a database.

  • Triggers can be used to enforce business rules, maintain referential integrity, and automate repetitive tasks.

  • Examples of trigger events include INSERT, UPDATE, and DELETE operations on specific tables.

  • Triggers can be defined to execute before or after the triggering event.

  • Common uses of triggers include auditing changes to data, enforcing data validation rules, and up...read more

Add your answer

Q56. Different trigger pattern

Ans.

Different trigger patterns are used in software development to initiate actions based on specific events.

  • Triggers can be based on time, user input, system events, etc.

  • Examples include event-driven programming, polling triggers, and scheduled triggers.

Add your answer
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.6k Interviews
3.8
 • 5.6k Interviews
3.7
 • 4.8k Interviews
3.8
 • 3k Interviews
3.8
 • 2.9k Interviews
4.1
 • 272 Interviews
View all
Triggers Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter