Triggers

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Databases / SQL DifficultyHard SQL
Update customer credit score on address update: - Given a table of customer data with name, address, credit score, and date of last address update columns, - write a trigger that will automatically update the customer's credit score whenever their address is updated. - Output will be the customer table with updated credit scores.
About this solution: The trigger above will update the credit score of the customer whenever their address is updated. This is a good solution that solves the problem. The trigger is optimal because it will only update the credit score of the customer whose address was updated.
Jan 27
Databases / SQL DifficultyHard SQL
Write a trigger that will update the total salary for each department when an employee's salary is updated.
About this solution: The trigger above is a good solution that solves the problem. It is efficient because it only updates the department table when the employee table is updated.
Nov 26
Databases / SQL DifficultyHard SQL
This technical problem describes how to write a SQL trigger that will automatically update the "last_updated" column whenever a change is made to any of the other columns in a table. The example input table contains employee data, and the example output shows how the "last_updated" column would be updated after a change is made to one of the other columns.
About this solution: The candidate's solution is correct and demonstrates a good understanding of how to write a SQL trigger.
Nov 21
Databases / SQL DifficultyMedium SQL
Write a trigger that updates a customer's balance field in a customer table whenever a new purchase is made, using data from a purchase table.
About this solution: The trigger will automatically update the customer's balance field whenever a new purchase is made, which is the desired outcome. The approach is sound and the trigger is executed only when needed, so this is a good solution.
Nov 14
Databases / SQL DifficultyMedium SQL
This technical problem involves designing a trigger that will log the time, date, and user who performed an insert, update, or delete on a table.
About this solution: The trigger is optimal because it is a single statement that will be executed after an insert, update, or delete.
Nov 14
Databases / SQL DifficultyMedium SQL
This technical problem describes how to create a trigger that will prevent a user from inserting a row into a table if the user's id is not in the table.
About this solution: The candidate's solution is complete and solves the problem. The approach is generally sound.
Nov 13
Databases / SQL DifficultyMedium SQL
A trigger is needed that will update the "last_updated" column in a table every time a row is inserted or updated.
About this solution: The candidate's solution is complete and solves the problem. The approach is optimal because it only updates the last_updated column for the row that was inserted or updated.
Nov 04