Concatenating String Values: Joining Strings : String Append « String « SQL / MySQL

SQL / MySQL
1. Backup Load
2. Command MySQL
3. Cursor
4. Data Type
5. Database
6. Date Time
7. Flow Control
8. Function
9. Insert Delete Update
10. Join
11. Key
12. Math
13. Procedure Function
14. Select Clause
15. String
16. Table Index
17. Transaction
18. Trigger
19. User Permission
20. View
21. Where Clause
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
SQL / MySQL » String » String Append 
Concatenating String Values: Joining Strings

/*
mysql> SELECT ClassID, CONCAT(Time, ', Room ', RoomID) AS ClassDetails
    -> FROM Class;
+---------+------------------------------------------+
| ClassID | ClassDetails                             |
+---------+------------------------------------------+
|       1 | Mon 09:30-11:00, Room 6                  |
|       2 | Mon 11:30-12:00, Thu 09:00-11:00, Room 5 |
|       3 | Mon 14:30-16:00, Room 3                  |
+---------+------------------------------------------+
3 rows in set (0.00 sec)


*/       
/* Prepare the data */  
Drop TABLE Class;

CREATE TABLE Class (
   CourseID    INT NOT NULL,
   RoomID      INT NOT NULL,
   ClassID     INT NOT NULL PRIMARY KEY,
   Time        VARCHAR(50)

)TYPE = InnoDB;

/* Insert data for testing */
INSERT INTO Class (ClassID,CourseID,RoomID,TimeVALUES (1,1,6,'Mo09:30-11:00');
INSERT INTO Class (ClassID,CourseID,RoomID,TimeVALUES (2,2,5,'Mo11:30-12:00, Thu 09:00-11:00');
INSERT INTO Class (ClassID,CourseID,RoomID,TimeVALUES (3,3,3,'Mo14:30-16:00');

/* Real command */
  
SELECT ClassID, CONCAT(Time, ', Room ', RoomIDAS ClassDetails
FROM Class;

           
       
Related examples in the same category
1. Simplest concatenate string: space
2. Concatenate string with NULL value
3. Simplest concatenate string 2
4. Append string in select clause
5. String function: concat
w___w__w__.___j__a_v__a2___s_.___c__o__m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.