- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Concatenate string with numbers in MySQL?
To concatenate string with numbers, use the CONCAT() method. Let us first create a table −
mysql> create table DemoTable682( Name varchar(100), Age int ); Query OK, 0 rows affected (0.49 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable682 values('John',23); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable682 values('Chris',21); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable682 values('David',25); Query OK, 1 row affected (0.17 sec) Display all records from the table using select statement:
Display all records from the table using select statement -
mysql> select *from DemoTable682;
This will produce the following output −
+-------+------+ | Name | Age | +-------+------+ | John | 23 | | Chris | 21 | | David | 25 | +-------+------+ 3 rows in set (0.00 sec)
Following is the query to implement concat() method to concatenate records −
mysql> select concat(Name,Age) from DemoTable682;
This will produce the following output −
+------------------+ | concat(Name,Age) | +------------------+ | John23 | | Chris21 | | David25 | +------------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to concatenate a string with numbers in Python?
- MySQL order by string with numbers?
- Can MySQL concatenate strings with ||?
- Sort in a string mixed with numbers in MySQL?
- Order VARCHAR records with string and numbers in MySQL
- Concatenate a string in an already created field values set with MySQL TEXT data type
- Concatenate two tables in MySQL with a condition?
- How to sum a comma separated string (string with numbers) in MySQL?
- MySQL query to remove numbers after hyphen in a VARCHAR string with numbers
- How to concatenate MySQL distinct query results into a string?
- How to concatenate string vectors separated with hyphen in R?
- Concatenate some of the column values in a single line with MySQL and prefix a particular string “MR.” to every string
- How to select rows with condition via concatenate in MySQL?
- Concatenate two columns in MySQL?
- How to set a string with hyphen and numbers in MySQL varchar?

Advertisements