1Z0-873 · Question #12
Which of the following (series of) statements will leave the three tables A, B and C locked for reading, writing and reading respectively once all statements have been executed?
The correct answer is C. mysql> LOCK TABLES A READ, B WRITE, C READ. If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables with a single LOCK TABLES statement. LOCK TABLES releases…
Question
Which of the following (series of) statements will leave the three tables A, B and C locked for reading, writing and reading respectively once all statements have been executed?
Options
- Amysql> LOCK TABLES A;mysql> LOCK TABLES B;mysql> LOCK TABLES C;
- Bmysql> LOCK TABLES A READ;mysql> LOCK TABLES B WRITE;mysql> LOCK TABLES C
- Cmysql> LOCK TABLES A READ, B WRITE, C READ;
- DLOCK TABLES A, B, C READ, WRITE, READ;
How the community answered
(23 responses)- A4% (1)
- B4% (1)
- C74% (17)
- D17% (4)
Explanation
If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables with a single LOCK TABLES statement. LOCK TABLES releases any locks that you already hold, so you cannot issue it multiple times to acquire multiple locks.
Topics
Community Discussion
No community discussion yet for this question.