Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the methods of string interception implemented by MySQL

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly talks about "what are the methods of string interception in MySQL", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the methods of string interception in MySQL?"

Preface

It is common to deal with a database during back-end development, and sometimes there are two ways to deal with as long as part of a piece of data in the database:

(1) read it out and then deal with it accordingly

(2) use the function that comes with MySQL to process when reading.

Next, we will summarize the column in the second way.

(1) create a user table as follows:

(2) left (col_name, length) function: intercepted from left to right. Col_name is the column name (required), length is the length truncated from left to right (must be a positive integer, if negative, nothing is returned, the subscript starts at 1, not 0)

A:length: integer

B:length: negative number

(3) right (col_name, length) function: intercepted from right to left. Col_name is the column name (required), length is the length truncated from right to left (must be a positive integer, if negative, nothing is returned, starting with 1, not 0)

A:length: integer

B:length: negative number

(4) substring (col_name, start, length) function: col_name column name (required), start from which (integer must be selected from 1), length truncated length (optional, positive integer)

A:start: positive integer, length is not selected, count from left to right, and the third character is truncated to the right until the end.

B:start: negative integer, length is not selected, count from right to left, and the third character is truncated to the right until the end.

C:start: positive integer, length: positive integer; count from left to right, and the third character begins to truncate 5 characters to the right.

D:start: negative integer, length: positive integer; count from right to left, and the third character begins to truncate 3 characters to the right.

E: when intercepting from star, the number of characters immediately following it

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report