A. Table-Level Locks
Table-level locking locks the entire table during a read or write operation. It is mainly used in storage engines like MyISAMand MEMORY. While simple to implement, it is less efficient in high-concurrency environments because it blocks other users from
accessing the same table simultaneously.
Syntax:
LOCK TABLES table_name READ; -- Read-only access
LOCK TABLES table_name WRITE; -- Read/write access, blocks others
UNLOCK TABLES; -- Releases all locks
Example:
LOCK TABLES employees WRITE;
UPDATE employees SET salary = salary + 500;
UNLOCK TABLES;