Ak Ash Ak Ash - 6 months ago 53
SQL Question

How to get formatted sql querry result

Consider this a table

Code Name City Salary
1 Mark LA 12000
2 Selena NY 6000
3 Justin USA 50000
4 John CN 3000

now I want result like this

John lives in `CN` and his salary is 3000.
Justin lives in `USA` and his salary is 50000.

how can I do so in oracle?
if there is different method then explain them also .


To concatenate values in SQL you use ||. Character values are supplied using single quotes: '.

Putting that together you need to use:

select name ||' lives in "'||city||'" and his/her salary is '||salary
from the_table;