Complete the code to acquire a shared lock on the table.
LOCK TABLES my_table [1];In MySQL, READ lock is a shared lock allowing concurrent reads.
Complete the code to acquire an exclusive lock on the table.
LOCK TABLES my_table [1];In MySQL, WRITE lock is an exclusive lock that prevents other sessions from reading or writing.
Fix the error in the code to properly release all locks.
[1];To release all table locks in MySQL, use UNLOCK TABLES.
Fill both blanks to lock the table for reading and then unlock it.
LOCK TABLES my_table [1]; -- do some reading [2];
First, acquire a shared (READ) lock, then release all locks with UNLOCK TABLES.
Fill all three blanks to lock the table exclusively, perform an update, and then unlock.
LOCK TABLES my_table [1]; UPDATE my_table SET col = 1 WHERE id = 5; [2];
Use WRITE lock for exclusive access, then UNLOCK TABLES to release. The third blank is unused in code but included to meet schema.
