Triggers
Top 50 Triggers Interview Questions and Answers 2024
61 questions found
Updated 14 Dec 2024
Q1. What is the trigger point?
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.
Q2. Why we use stored procedures, trigger ?
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
Q3. What is triggers in salesforce
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
Q4. What is Diff Between constarints and triggers?
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
Q5. What is procedures and triggers?
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.
Q6. what is triiger in mysql ?
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;
Q7. What is trigger, Cursor?
Trigger is a database object that executes automatically in response to certain events. Cursor is a database object used to manipulate data.
Triggers are used to maintain data integrity and consistency.
Triggers can be used to audit changes made to the database.
Cursors are used to iterate through a set of rows returned by a query.
Cursors can be used to update or delete rows in a table.
Triggers and cursors are commonly used in database programming.
Q8. What is rdbms, trigger
RDBMS stands for Relational Database Management System. A trigger is a special type of stored procedure that is automatically executed when certain events occur in a database.
RDBMS is a type of database management system that stores data in a structured format using tables with rows and columns.
Triggers are used to enforce business rules, perform data validation, and maintain data integrity in a database.
Examples of trigger events include INSERT, UPDATE, and DELETE operations...read more
Triggers Jobs
Q9. what mean by function and triggers
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
Q10. What is difference between scheduled trigger and tumbling window trigger
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
Q11. Do you know trigger and indexes
Yes, I know triggers and indexes.
Triggers are database objects that are automatically executed in response to certain events, such as insert, update, or delete operations.
Indexes are database objects that improve the performance of queries by allowing them to quickly locate the data they need.
Triggers can be used to enforce business rules, audit changes to data, or replicate data to other tables or databases.
Indexes can be created on one or more columns of a table, and can be...read more
Q12. what is triggers and async operation ?
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
Q13. What are triggers , where can they be used ? What is a mutating trigger problem , how can it be solved?
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
Q14. What is TAC and explain triggers in TAC??
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
Q15. What are Trigger context Variables
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.
Q16. Oracle Forms Sequence of Triggers
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.
Q17. What is trigger What is apex
A trigger is a piece of code that executes before or after a record is inserted, updated, or deleted in Salesforce.
Triggers are used to automate processes and enforce business logic.
Triggers can be written in Apex and are associated with a specific object.
Triggers can be used to update related records, send emails, or perform other actions.
Triggers can be created using the Salesforce user interface or the Salesforce Developer Console.
Q18. Disadvantages of triggers
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
Q19. triggers in WPF?
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.
Q20. Types of Trigger in Oracle forms? how to sequence of Trigger fire in oracle Forms.
Types of Trigger in Oracle forms and their sequence of firing.
Types of triggers include Key Triggers, Mouse Triggers, and Timer Triggers.
Key Triggers fire when a key is pressed or released.
Mouse Triggers fire when the mouse is clicked or moved.
Timer Triggers fire at a specified interval.
The sequence of trigger firing is Pre-Form, Pre-Block, Pre-Record, Post-Record, Post-Block, and Post-Form.
Q21. different triggers in SLA other than Incident
Triggers in SLA other than Incident
Change Requests
Problem Tickets
Service Requests
Major Incidents
Q22. Code on basic trigger
A basic trigger code is used to automatically perform an action when a certain event occurs in a database.
Triggers are written in SQL and can be used to enforce business rules, perform data validation, or maintain data integrity.
Example: CREATE TRIGGER trigger_name BEFORE INSERT ON table_name FOR EACH ROW BEGIN ... END;
Q23. Types of trigger in Oracle plsql
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
Q24. What are SQL Triggers and its syntax?
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
Q25. What are triggers?What are stored procedures?
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
Q26. What's the role of triggers in Salesforce?
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
Q27. Difference between constraints and Declare trigger
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
Q28. What is triggers and procedures?
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
Q29. Triggers in mysql?
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
Q30. Can trigger be used with select statement?
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
Q31. What are Triggers? Is trigger a stored procedure?
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
Q32. What are the types of trigger in Salesforce
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
Q33. The difference between a trigger and a constraint
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
Q34. How would you insert contacts to newly created contacts using trigger
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
Q35. What are triggers and stored procedures?
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
Q36. What is trigger and why it used
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.
Q37. Which is better trigger or stored procedure?
It depends on the specific use case and requirements.
Stored procedures are precompiled and can be executed independently.
Triggers are automatically executed when a specific event occurs.
Stored procedures are suitable for complex business logic and data manipulation.
Triggers are useful for enforcing data integrity and maintaining consistency.
Both triggers and stored procedures have their own advantages and should be used based on the specific requirements.
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 moreCreate 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
Q39. Difference between trigger and stored procedure
Triggers are automatically executed in response to certain events, while stored procedures are pre-written code that can be executed on demand.
Triggers are associated with a specific table and are executed when a certain event occurs, such as an insert or update.
Stored procedures are pre-written code that can be executed on demand, often used for complex database operations.
Triggers can be used to enforce business rules or maintain data integrity, while stored procedures can ...read more
Q40. Write a trigger to update field on child record from parent record.
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
Q41. Write a trigger on Account. if one or more contact is associated with Account then show error if user tries to delete the account
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
Q42. what is the Trigger in SQL
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
Q43. How many triggers can we create on a table
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
Q44. What is the trigger function in SQL?
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();
Q45. what is a trigger in SQL and how is it used?
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.
Q46. Write trigger code for given scenario
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
Q47. Write a trigger to update record in child abject as well as parent object
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
Q48. Write a trigger to create a contact whenever a account is created
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
Q49. Can we use commit in Triggers
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.
Q50. Write a trigger to update StageName on Opportunity whenever the Account Active field is set to Yes
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
Q51. Write trigger on parent child scenario
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
Q52. Write a trigger to find the duplicate value based on phone no and email
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
Q53. write trigger to count the number of contacts any account contains.
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
Q54. What's are triggers in SQL server
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
Q55. Before vs After Triggers
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.
Q56. Triggers in sql server
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
Q57. Trigger for roll up summmary
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
Q58. sql triggers in db
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
Q59. Different trigger pattern
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.
Q60. Trigger to count no of opportunitylineitems and display in Accout custom field
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
Q61. Trigger in sql server
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
Top Interview Questions for Related Skills
Interview Questions of Triggers Related Designations
Interview experiences of popular companies
Reviews
Interviews
Salaries
Users/Month