sql - actual working of primary, foreign key and unique constraint , order/steps of their working -


How do primary keys, foreign keys and unique barriers work? What do i mean

As such, when a child has an FK in the table, and a record is inserted, which is not present in the original table, this record is first put into the child Table & amp; If the record exists in the guardian table or not, and if he is not getting it, then it removes the record from the rollback and the hair table, is it the order of doing this work?

Or, first SQL gets the record (which is made by FK) with the included query, & amp; Parents match the table records, and do not get matching records when they are included, while inserts itself and does not include the row in the hair table?

Similarly, for the primary key, if the duplicate record is inserted into a table, then it is inserted for the first time or it is matched to the existing record before entering, and If that is a duplicate, then the query has expired.

Speaking logically, with an entire result of an update, INSERT or DELETE statement Should be checked together. The barriers are evaluated, as if all the rows had already been amended and if any obstruction is violated then amendment is not allowed.

Comments