Locking Syntax : Lock « Transaction « SQL / MySQL






Locking Syntax

      

To reserve tables for exclusive use, execute the command LOCK TABLE[S]:

LOCK TABLE table1 locktype, table2 locktype ...


READ:                      All MySQL users are allowed to read the table, 
                           but no one may make any changes(including the user who executed the LOCK command). 
                           A READ LOCK is granted only when the table is not blocked by any WRITE LOCKs.
              
READ LOCAL                 Like READ, but INSERT commands are allowed if they don't alter any existing data records.

WRITE                      The current user is permitted to read and change the table. 
                           All other users are completely blocked.
             
LOW PRIORITY WRITE         During the waiting time, other users receive as the need arises a new READ LOCK. 
                           However, this can increase the waiting time until the granting of a WRITE LOCK.

   
    
    
    
    
    
  








Related examples in the same category

1.Get lock
2.Is lock free
3.Is used lock
4.Release lock