Answer the question
In order to leave comments, you need to log in
How to check the consistency of tables using a stored procedure?
Good day :)
There is some database in which there are two tables: employee and department . The employee table stores information about the employee, which is logical, and in the department table, in addition to a bunch of fields, there is a field that indicates the number of employees in a department. The task is to write a trigger that makes a change in the "Number of employees" field after adding a new employee to the "Employees" table .
In short, then: added an employee, use a trigger to increase the number of employees in another table by 1 .
And there was such a nuance if the tables were initially inconsistent (in the table "Employees" there are 20 people from department X, and in the table "Department" in the field the number of employees in total, for example, 6 ), then how, using a stored procedure, to coordinate the tables? Otherwise, triggers have no meaning, your Cap.
Thank you for your attention :)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question