The flip-flop has two stable states, which can represent binary numbers 0 and 1 respectively. It can maintain the stable state without external trigger; under external trigger, the two stable states can be converted to each other, and the converted stable state can be Maintained for a long time, this enables the flip-flop to memorize binary information and is often used as a binary storage unit.
The operating environment of this tutorial: Windows 7 system, SQL Server 2016 version, Dell G3 computer.
Trigger (trigger) is a method provided by SQL server to programmers and data analysts to ensure data integrity. It is a special stored procedure related to table events. Its execution is not performed by the program. The call is not started manually, but is triggered by events. For example, when a table is operated (insert, delete, update), its execution will be activated. Triggers are often used to enforce data integrity constraints and business rules.
Trigger function
1. Force the data to be verified or converted before writing to the data table.
2. When an error occurs in the trigger, the result of the change will be cancelled.
3. Some database management systems can use triggers for data definition language (DDL), called DDL triggers.
4. The changed instructions (INSTEADOF) can be replaced according to specific situations.
Trigger classification
1. ML trigger
When the data in the table in the database changes, including insert, update, delete any Operation, if we write a corresponding DML trigger to the table, the trigger will be executed automatically. The main function of DML triggers is to enforce business rules and extend SqlServer constraints, default values, etc. Because we know that constraints can only constrain data in the same table, while triggers can execute any Sql command.
2. DDL trigger
It is a new trigger in SqlServer2005. It is mainly used for auditing and standardizing the structure of tables, triggers, views and other structures in the database. operation. For example, modifying tables, modifying columns, adding new tables, adding new columns, etc. It is executed when the database structure changes. We mainly use it to record the modification process of the database and to restrict programmers from modifying the database, such as not allowing deletion of certain specified tables.
3. Login trigger
The login trigger will fire the stored procedure in response to the LOGIN event. This event is raised when a user session is established with an instance of SQL Server. The login trigger will fire after the authentication phase of the login is complete and before the user session is actually established. Therefore, all messages that come from inside triggers and would normally reach the user (such as error messages and messages from PRINT statements) are sent to the SQL Server error log. If authentication fails, the login trigger will not fire.
Trigger advantages
Triggers can achieve cascading changes through related tables in the database, however, it can be more efficient through cascading referential integrity constraints execute these changes. Triggers can enforce more complex constraints than those defined by CHECK constraints. Unlike CHECK constraints, triggers can reference columns in other tables. For example, a trigger can use a SELECT in another table to compare inserted or updated data, as well as perform other operations, such as modifying data or displaying user-defined error messages. Triggers can also evaluate the table status before and after data modification and take countermeasures based on the differences. Multiple triggers of the same type (INSERT, UPDATE, or DELETE) in a table allow multiple different countermeasures to be taken in response to the same modification statement.
Steady state of the flip-flop
(1) The flip-flop has two stable states, which can represent the binary numbers 0 and 1 respectively, and can maintain stability without external triggering state;
(2) Under external triggering, the two stable states can be converted into each other (called flipping), and the converted stable state can be maintained for a long time. This allows the flip-flop to memorize binary information and is often used as a binary storage unit.
For more programming-related knowledge, please visit:Programming Teaching! !
The above is the detailed content of A flip-flop has several steady states. For more information, please follow other related articles on the PHP Chinese website!