How to remove brackets and everything in brackets from a string in MySQL

王林
Release: 2023-06-02 21:27:32
forward
2539 people have browsed it

    Remove the brackets in the string and everything inside the brackets

    How to remove brackets and everything in brackets from a string in MySQL

    update 表 set 列名 = REPLACE(列名,SUBSTRING(列名 , LOCATE( '(',列名) , LOCATE(')',列名)) ,被替换的字符)
    Copy after login

    How to remove brackets and everything in brackets from a string in MySQL

    Function used

    • replace(column name, replaced string, replaced string): Replace part of the content in the string

    • substring(column name, starting position, ending position): intercept a part of the string

    • locate(searched string, column name): Find the position of a certain character in the string

    MySQL field and remove the brackets

    eg:

    select * from (select *,substring_index(substring_index(remarks,"[",1),']',-1) as carCard from test ) as t where carCard LIKE '%C999%'
    Copy after login

    The above is the detailed content of How to remove brackets and everything in brackets from a string in MySQL. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:yisu.com
    Statement of this Website
    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
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!