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

The method of intercepting the first few bits of a string by sql

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to intercept the first few bits of a string in sql. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

In sql, you can use the SUBSTRING function to intercept a string with the syntax format "SUBSTRING (string, 1, truncated length)". The SUBSTRING function is used to grab a string, binary string, text, image, column, or part of an expression that contains a column.

The operating environment of this tutorial: windows7 system, mysql8.0 version, Dell G3 computer.

SUBSTRING (expression, start, length)

Parameters.

Expression

A string, binary string, text, image, column, or expression that contains a column. Do not use expressions that contain aggregate functions.

Start

An integer or an expression that can be implicitly converted to int that specifies the starting position of the substring, with the index starting at 1.

Length

An integer or an expression that can be implicitly converted to int that specifies the length of the substring. After testing, it is found that it can only be a non-negative number.

Return value

1. If expression is a supported binary data type, binary data is returned, which we will not discuss for the time being.

two。 Returns character data if expression is a supported character data type.

(1) if the rope bow of start starts at 1, the string is intercepted from the first character of the expression, from 2 to the second character of the expression, and so on.

For example:

SELECT SUBSTRING ('Chengdu financing Department', 1Jing 2) / / result: this is the end of this article about "the method of sql intercepting the first few strings in Chengdu". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Database

Wechat

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

12
Report