Introduction
String manipulation helps us change and work with text data easily. It is common because many databases store names, addresses, and messages as text.
String manipulation helps us change and work with text data easily. It is common because many databases store names, addresses, and messages as text.
SELECT function_name(column_name) FROM table_name;
function_name with the string function you want, like UPPER, LOWER, SUBSTRING, or CONCAT.SELECT to change or get parts of text.SELECT UPPER(name) FROM users;
SELECT SUBSTRING(address, 1, 5) FROM customers;
SELECT CONCAT(first_name, ' ', last_name) FROM employees;
This creates a table with names, then selects the names in uppercase and the first 5 letters of each name.
CREATE TABLE people (id INT, full_name VARCHAR(50)); INSERT INTO people VALUES (1, 'Alice Johnson'), (2, 'Bob Smith'); SELECT UPPER(full_name) AS upper_name, SUBSTRING(full_name, 1, 5) AS short_name FROM people;
String functions can be combined to do more complex tasks.
Be careful with string length and indexes to avoid errors.
String manipulation is used to handle and change text data in databases.
It helps clean, extract, combine, and format text easily.
Common functions include UPPER, LOWER, SUBSTRING, and CONCAT.
SELECT CONCAT('Data', 'Base') AS result;SELECT SUBSTRING('Hello World', 7, 5 FROM dual);email. Which query correctly extracts the domain part after '@'?Pass the test and this pattern moves unknown