Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

MySQL Append Data

'CONCAT()' function is used to append data to the column value. In this example, we are concatenating the value 'sandeep' and the "studentid" column for each row of the "mca" table.

Ads

MySQL Append Data

     

This example illustrates how to append data with a column value.

'CONCAT()' function is used to append data to the column value. In this example, we are concatenating  the value 'sandeep' and the "studentid" column for each row of the "mca" table.

Table

+-----------+-----------+----------+----------------------------------+
| studentid | sectionid | courseid | time                             |
+-----------+-----------+----------+----------------------------------+
| 3         | 3         | 3        | Mon 14:30-16:00                  |
| 2         | 2         | 5        | Mon 11:30-12:00, Thu 09:00-11:00 |
| 1         | 1         | 6        | Mon 09:30-11:00                  |
+-----------+-----------+----------+----------------------------------+

Table: "mca"

Query to concatenate value "sandeep" to the column values:

Query

select studentid, CONCAT(studentid, 'sandeep') FROM mca;

Output

+-----------+------------------------------+
| studentid | CONCAT(studentid, 'sandeep') |
+-----------+------------------------------+
| 3         | 3sandeep                     |
| 2         | 2sandeep                     |
| 1         | 1sandeep                     |
+-----------+------------------------------+

You can see above, every value of "studentid" column is appended by "sandeep".

Advertisements

Ads
Share on Google+Share on Google+

MySQL Append Data

Posted on: October 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: MySQL Append Data  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
hanan
March 6, 2012
database connectivity

i want have database connection with GUI application in netbeans.i need your help.

Ads

 

Ads