Home  >  Article  >  Database  >  What is the usage of mysql substr

What is the usage of mysql substr

藏色散人
藏色散人Original
2020-11-04 14:01:0710959browse

The mysql substr function is used to intercept part of a column field in the database. The commonly used syntax is "SBUSTR(str,pos);", which means starting from pos and intercepting to the end.

What is the usage of mysql substr

Recommended: "mysql video tutorial"

The SUBSTR function is used to intercept a part of a certain column field in the database .

The function names in each database are different

   MySQL: SUBSTR( ), SUBSTRING( ) 
    Oracle: SUBSTR( ) 
    SQL Server: SUBSTRING( ) ;123

The commonly used method is:

SBUSTR(str,pos); intercept from the starting position of pos to the end.

Another commonly used one is:

SUBSTR(str,pos,len); intercept len ​​characters starting from pos (blanks are also counted as characters).

Note:

The substr() function in mysql and hibernate's substr() parameters are the same, but their meanings are different.

Start in mysql starts from 1, while start in hibernate starts from 0.

The above is the detailed content of What is the usage of mysql substr. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn