In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Overview of handler statement
Handler is similar to the select statement, but unlike the latter, it can only query records once at a time. Handler has some special features that are suitable for specific scenarios. This article introduces some knowledge about handler statements for later use.
Contact information
Official account of Wechat
(the official account of Wechat shares regularly every day. Welcome to follow.)
Training courseware
(the fee of 20 yuan has been shared to Baidu Cloud disk for students to get)
Catalogue
Official manual of handler sentences
Handler statement syntax
Example of handler statement
The handler statement applies to the scenario
Considerations for handler statement
Official manual of handler sentences 13 SQL Statement Syntax13.2 Data Manipulation Statements13.2.4 HANDLER Syntaxhandler sentence syntax
HANDLER tbl_name OPEN [[AS] alias] HANDLER tbl_name READ index_name {= | = |
< | >} (value1,value2,...) [WHERE where_condition] [LIMIT...] HANDLER tbl_name READ index_name {FIRST | NEXT | PREV | LAST} [WHERE where_condition] [LIMIT...] HANDLER tbl_name READ {FIRST | NEXT} [WHERE where_condition] [LIMIT...] HANDLER tbl_name CLOSEhandler statement example
Specify an alias for handle to use multiple handle
HANDLER tbl_name OPEN [[AS] alias] mysql > handler t_table_lock open p1ten query OK, 0 rows affected (0.00 sec)
Open and close tables
HANDLER tbl_name OPEN [[AS] alias] HANDLER tbl_name CLOSEmysql > handler t_table_lock open;Query OK, 0 rows affected (0.00 sec) mysql > show open tables from zxydb like'Tablelocked' +-+ | Database | Table | In_use | Name_locked | +-+ | zxydb | t_table _ lock | 1 | 0 | +-+ 1 row in set (0.00 sec) mysql > handler t_table_lock close Query OK, 0 rows affected (0.00 sec) # # mysql > show open tables from zxydb like'Tablelocked' +-+ | Database | Table | In_use | Name_locked | +-+ | zxydb | t_table _ lock | 0 | 0 | +-+ 1 row in set (0.00 sec)
Read the record of the table
HANDLER tbl_name READ {FIRST | NEXT} [WHERE where_condition] [LIMIT.] # # get the first record of the table mysql > handler t_table_lock read first;+-+-+ | a | b | +-+-+ | 1 | 1 | +-+ 1 row in set (0.00 sec) # # get the next record of the table mysql > handler t_table_lock read next Empty set (0.00 sec)
Gets the table record of the specified index value
HANDLER tbl_name READ index_name {= | = |
< | >} (value1,value2,...) [WHERE where_condition] [LIMIT...] mysql > handler t_table_lock read idx_a= (1); +-+-+ | a | b | +-+-+ | 1 | 1 | +-+-+ 1 row in set (0.00 sec) # # mysql > handler t_table_lock read idx_a= (2); Empty set (0.00 sec)
Gets the first, next, previous, and last table records of the specified index
HANDLER tbl_name READ index_name {FIRST | NEXT | PREV | LAST} [WHERE where_condition] [LIMIT...] # # mysql > handler t_table_lock read idx_a first;+-+-+ | a | b | +-+-+ | 1 | 1 | +-+-+ 1 row in set (0.00 sec) # # mysql > handler t_table_lock read idx_a next Empty set (0.00 sec) # # mysql > handler t_table_lock read idx_a last;+-+-+ | a | b | +-+-+ | 1 | 1 | +-+-+ 1 row in set (0.00 sec) # # mysql > handler t_table_lock read idx_a prev;Empty set (0.00 sec) handler statement applicable scenario
Considerations for handler statement
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.