General Note: Here we have pulled in the data from a sample database. You can download it from the following link and use it for practicing Click Here For Sample Database
In this tutorial, you will learn. how to use the concat(||) operator in SQLite.
Concat(||) operator is used to concat two or more columns. So the result will be displayed as one column
Select mobile_name||brand_name as ”Brand Details” from mobile_sales_details
Brand Details
------------------------------
Moto X (16 GB) (Black)Motorola
Moto G (Black with 16 GB)Moto
Moto E (Black)Motorola
Asus Zenfone 4 A400CG (Black w
Asus Zenfone 5 A501CG (Black w
Asus Zenfone 5 A501CG (Black
Asus Zenfone 6 A600CG / A601CG
Alcatel Onetouch Idol X+ (Whit
Samsung Galaxy S Duos 2 S7582
Samsung Galaxy Star Pro S7262
Samsung Galaxy S Duos 2 S7582
Samsung Galaxy Core I8262 (Chi
Samsung Galaxy Grand 2 (Black)
Samsung Galaxy Trend S7392 (Mi
Samsung Galaxy Grand Neo GT-I9
Samsung I8552 - Galaxy Grand Q
Samsung Galaxy S4 Mini I9192 (
Samsung GT 1200 R/I/MSamsung
Samsung Guru 1200 (Black)Samsu
If you want to add your own text with the column just use the single quote(‘ ’) with concat operator.
Select mobile_name||’ is a product from ’||brand_name as ”Brand Details” from mobile_sales_details
Brand Details
--------------------------------------------------
Moto X (16 GB) (Black) is a product from Motorola
Moto G (Black with 16 GB) is a product from Moto
Moto E (Black) is a product from Motorola
Asus Zenfone 4 A400CG (Black with 8 GB) is a produ
Asus Zenfone 5 A501CG (Black with 8 GB) is a produ
Asus Zenfone 5 A501CG (Black with 16 GB) is a pro
Asus Zenfone 6 A600CG / A601CG (Black with 16 GB)
Alcatel Onetouch Idol X+ (White with 16 GB) is a
Samsung Galaxy S Duos 2 S7582 (Pure White) is a pr
Samsung Galaxy Star Pro S7262 (White) is a product
Samsung Galaxy S Duos 2 S7582 (Black) is a product
Samsung Galaxy Core I8262 (Chic White) is a produc
Samsung Galaxy Grand 2 (Black) is a product from
Samsung Galaxy Trend S7392 (Midnight Black) is a p
Samsung Galaxy Grand Neo GT-I9060 (White) is a pro
Samsung I8552 - Galaxy Grand Quattro is a product
Samsung Galaxy S4 Mini I9192 (White Frost) is a pr
Samsung GT 1200 R/I/M is a product from Samsung