Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Introduction to String Functions | String Functions
Functions in SQL

bookIntroduction to String Functions

When working with text data in SQL, string functions are essential tools that let you transform, analyze, and extract information from character fields. These functions help you clean up messy data, standardize text formats, and create new values based on existing information. Whether you need to change the case of names, count the number of characters in an email address, or build custom strings for reports, string functions make these tasks simple and efficient.

1234567
-- Transform and analyze customer names using string functions SELECT name, UPPER(name) AS name_uppercase, LOWER(name) AS name_lowercase, LENGTH(name) AS name_length FROM customers;
copy

You can combine multiple string functions in a single query to perform advanced text processing. For instance, you might want to convert a name to lowercase and then count its characters, or standardize email addresses by joining different pieces of data together. By nesting and chaining functions, you gain powerful ways to reshape and analyze your text data directly within SQL.

12345
-- Create custom email usernames by combining and extracting strings SELECT name, CONCAT(LOWER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, POSITION(' ' IN name) + 1, 5))) AS custom_username FROM customers;
copy

1. Which function changes all characters in a string to uppercase?

2. Which SQL function extracts a substring from a given string?

3. Fill in the blanks to select the length of each customer's name after converting it to lowercase.

question mark

Which function changes all characters in a string to uppercase?

Select the correct answer

question mark

Which SQL function extracts a substring from a given string?

Select the correct answer

question-icon

Fill in the blanks to select the length of each customer's name after converting it to lowercase.

((name)) AS lowercase_name_length
| name | lowercase_name_length |
|------------------|----------------------|
| Alice Johnson | 13 |
| Rajesh Kumar | 12 |
| Maria Garcia | 12 |
| Chen Wei | 8 |
| Fatima Al-Farsi | 15 |
| John Smith | 10 |
| Sofia Rossi | 11 |
| Lucas Müller | 13 |
| Emily Brown | 11 |
| Takashi Sato | 13 |

Click or drag`n`drop items and fill in the blanks

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 1

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

bookIntroduction to String Functions

Glissez pour afficher le menu

When working with text data in SQL, string functions are essential tools that let you transform, analyze, and extract information from character fields. These functions help you clean up messy data, standardize text formats, and create new values based on existing information. Whether you need to change the case of names, count the number of characters in an email address, or build custom strings for reports, string functions make these tasks simple and efficient.

1234567
-- Transform and analyze customer names using string functions SELECT name, UPPER(name) AS name_uppercase, LOWER(name) AS name_lowercase, LENGTH(name) AS name_length FROM customers;
copy

You can combine multiple string functions in a single query to perform advanced text processing. For instance, you might want to convert a name to lowercase and then count its characters, or standardize email addresses by joining different pieces of data together. By nesting and chaining functions, you gain powerful ways to reshape and analyze your text data directly within SQL.

12345
-- Create custom email usernames by combining and extracting strings SELECT name, CONCAT(LOWER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, POSITION(' ' IN name) + 1, 5))) AS custom_username FROM customers;
copy

1. Which function changes all characters in a string to uppercase?

2. Which SQL function extracts a substring from a given string?

3. Fill in the blanks to select the length of each customer's name after converting it to lowercase.

question mark

Which function changes all characters in a string to uppercase?

Select the correct answer

question mark

Which SQL function extracts a substring from a given string?

Select the correct answer

question-icon

Fill in the blanks to select the length of each customer's name after converting it to lowercase.

((name)) AS lowercase_name_length
| name | lowercase_name_length |
|------------------|----------------------|
| Alice Johnson | 13 |
| Rajesh Kumar | 12 |
| Maria Garcia | 12 |
| Chen Wei | 8 |
| Fatima Al-Farsi | 15 |
| John Smith | 10 |
| Sofia Rossi | 11 |
| Lucas Müller | 13 |
| Emily Brown | 11 |
| Takashi Sato | 13 |

Click or drag`n`drop items and fill in the blanks

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 1
some-alt