
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Add a character in the end to column values with MySQL SELECT?
For this, you need to perform concatenation using CONCAT().
Let us first create a table −
mysql> create table DemoTable766 (Name varchar(100)); Query OK, 0 rows affected (0.65 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable766 values('John'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable766 values('Sam'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable766 values('Carol'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable766 values('David'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable766 values('Bob'); Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable766;
This will produce the following output -
+-------+ | Name | +-------+ | John | | Sam | | Carol | | David | | Bob | +-------+ 5 rows in set (0.00 sec)
Following is the query to add a character in the end to column values −
mysql> select concat(Name,' S') from DemoTable766;
This will produce the following output -
+-------------------+ | concat(Name,' S') | +-------------------+ | John S | | Sam S | | Carol S | | David S | | Bob S | +-------------------+ 5 rows in set (0.00 sec)
- Related Articles
- MySQL query to select column values ending with certain character/number?
- Sort character values from a column mixed with character and numbers in MySQL?
- Set the NULL values to 0 and display the entire column in a new column with MySQL SELECT
- Select minimum row value from a column with corresponding duplicate column values in MySQL
- MySQL randomly select 2 values from column values?
- How to retrieve the documents whose values end with a particular character in MongoDB?
- How to select the sum of the column values with higher value in reach row with MySQL?
- MySQL query to get the character length for all the values in a column?
- Add a temporary column in MySQL where the values depend on another column?
- Add a percentage (%) sign at the end to each value while using MySQL SELECT statement
- Select a specific value between two column values in MySQL?
- Add records from corresponding duplicate values in another column with MySQL
- Select distinct values from three columns and display in a single column with MySQL
- How to add a column using MySQL SELECT in an already created table?
- MySQL query to select the nth highest value in a column by skipping values

Advertisements