Home Database Mysql Tutorial Mysql text processing function example (use of data processing function 1)

Mysql text processing function example (use of data processing function 1)

May 05, 2017 pm 05:07 PM

Text processing function

#Before we talked about the rtrim() function used to remove spaces at the end of a string, this is how to use the function to process this article.

Next we introduce another function, the upper() function:

Input:

select vend_name,upper(vend_name) as vend_name_upcase from vendors order by vend_name;
Copy after login

Output:

Mysql text processing function example (use of data processing function 1)

Analysis: As you can see, upper() converts the text to uppercase, so in this example each vendor is listed twice, first as the value stored in the vendors table, and secondly as vend_name_upcase converted to uppercase.

The following table lists some commonly used text processing functions:

Mysql text processing function example (use of data processing function 1)

Mysql text processing function example (use of data processing function 1)

The soundex in the table requires further explain. Soundex is an algorithm that converts any text string into an alphanumeric pattern that describes its phonetic representation. soundex takes into account similar-sounding characters and syllables, allowing strings to be compared phonetically rather than letter-wise. Although soundex is not a SQL concept, MySQL provides support for soundex.

The following is an example of using the soundex() function. There is a customer Coyote Inc. in the customers table, whose contact name is Y.Lee. But what if this is a typo and the contact name should actually be Y.Lie? Obviously, searching by the correct contact name will not return data, as shown below:

Input:

select cust_name,cust_contact from customers where cust_contact = 'Y.Lie';
Copy after login

Output:

Mysql text processing function example (use of data processing function 1)

Now Try searching using the soundex() function, it matches all contact names that sound similar to Y.Lie:

Input:

select cust_name,cust_contact from customers where soundex(cust_contact) =soundex('Y.Lie');
Copy after login

Output:

Mysql text processing function example (use of data processing function 1)

Analysis: In this example, the where clause uses the soundex() function to convert the cust_contact column value and search string into their soundex values. Because Y.Lee and Y.Lie sound similar, their soundex values ​​match, so the where clause correctly filters out the required data.

【Related recommendations】

  1. MySQL online free video tutorial

  2. HanShunping2016The latest MySQL basic video tutorial

  3. Examples of date and time processing functions and numerical processing functions (Usage of data processing functions 2)

The above is the detailed content of Mysql text processing function example (use of data processing function 1). For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Python for NLP: How to process text in PDF files using PDFMiner library? Python for NLP: How to process text in PDF files using PDFMiner library? Sep 27, 2023 pm 02:34 PM

PythonforNLP: How to process text in PDF files using PDFMiner library? Introduction: PDF (Portable Document Format) is a format used to store documents, usually used for sharing and distributing electronic documents. In the field of natural language processing (NLP), we often need to extract text from PDF files for text analysis and processing. Python provides many libraries for processing PDF files, among which PDFMiner is a powerful

Text processing library in PHP8.0: Phonetic Text processing library in PHP8.0: Phonetic May 14, 2023 am 08:10 AM

With the release of PHP8.0, many people are paying attention to its new features. One of its high-profile features is its text processing library, Phonetic. This library provides some useful methods such as phonetic symbol conversion, pinyin conversion, and approximate string matching. In this article, we will delve into the functionality and usage of this library. What is Phonetic? Phonetic is a library for processing text. It provides several methods to make text processing more convenient and accurate. This library integrates three main functions: audio

It's 2024, but you are still using Sed commands in Linux? It's 2024, but you are still using Sed commands in Linux? Feb 19, 2024 pm 01:10 PM

Overview In Linux systems, text processing is a critical part of daily tasks. Whether you're editing configuration files, analyzing log files, or processing data, text processing tools are crucial. Although the sed command is widely used in Linux, its syntax is complex and difficult to learn. The sd command is a simple and intuitive text replacement tool designed to provide an easier-to-use alternative to sed. This article will introduce the concept, function and usage of sd command in detail. The sd command is a command line tool for text processing. It provides a friendly user interface and rich functions, allowing users to easily perform text operations, such as replacing, deleting, inserting lines, etc. Its design goal is to simplify the text processing process and make it more intuitive and understandable. Through the sd command, users can

PHP development technology: Explore how PHP handles text punctuation replacement operations PHP development technology: Explore how PHP handles text punctuation replacement operations Mar 27, 2024 pm 01:33 PM

PHP development technology: Explore how PHP handles text punctuation replacement operations. As a scripting language widely used in web development, PHP provides a wealth of string processing functions to help developers handle various text operations. In actual development, we often encounter situations where we need to deal with punctuation marks in text, such as deleting, replacing or escaping. This article will focus on how PHP handles punctuation replacement operations in text and provide specific code examples. 1. The role and problems of punctuation marks Punctuation marks play a role in dividing the text.

Develop and implement high-performance text processing applications using Go language Develop and implement high-performance text processing applications using Go language Nov 20, 2023 pm 01:38 PM

Use Go language to develop high-performance text processing applications. With the development of the times, the era of big data has arrived. In this era, huge amounts of data need to be processed and analyzed. A large part of the data is text data, such as web page content, log records, social media data, etc. Therefore, developing a high-performance text processing application is of great significance to many fields, such as search engines, data mining, natural language processing, etc. When developing high-performance text processing applications, language choice is crucial. Go language is a language developed by Go

How to do text processing and text mining in PHP? How to do text processing and text mining in PHP? May 21, 2023 am 11:21 AM

With the rapid growth of the Internet and the amount of data, text processing and text mining have become necessary skills in the computer field. PHP, as a general-purpose scripting language, is often used to develop web applications. Whether it is used for data mining or text processing in daily development, PHP is a very useful tool. In this article, we will introduce some basic concepts and techniques for text processing and text mining in PHP, and provide some practical code examples to help readers deepen their understanding of PHP text processing and text mining. character

PHP Tips: Use PHP programming to realize the replacement function of text punctuation marks PHP Tips: Use PHP programming to realize the replacement function of text punctuation marks Mar 28, 2024 pm 12:57 PM

When processing text, you often encounter situations where you need to replace punctuation marks. With the help of PHP programming, we can easily implement this function. The following will introduce how to use PHP to write code to replace punctuation marks in text. First, we need to clarify the list of punctuation marks that need to be replaced, such as replacing periods with commas, question marks with exclamation points, etc. Next, we can write a simple PHP function to implement these replacement functions. Here is a sample code:

Understand the new features of PHP8: How to use the new string operators and codes to process text? Understand the new features of PHP8: How to use the new string operators and codes to process text? Sep 11, 2023 pm 12:06 PM

Understand the new features of PHP8: How to use the new string operators and codes to process text? PHP8 is the latest version of the PHP programming language, released in 2020. It introduces many new features and improvements, one of which is new features regarding string manipulation and text processing. In this article, we will focus on these new features in PHP8 and learn how to utilize them to process text. 1. New string operators PHP8 introduces some new string operators to make processing strings easier and more convenient. one of the new

See all articles