w3resource

Oracle: Concatenate first name, last name and job id from employees table in the following format

Oracle Operator: Exercise-13 with Solution

Write a query to concatenate first name, last name and job id from employees table in the following format.

Sample Format :
Douglas Grant is a SH_CLERK
Jennifer Whalen is a AD_ASST
Michael Hartstein is a MK_MAN
Pat Fay is a MK_REP
Susan Mavris is a HR_REP
Hermann Baer is a PR_REP
Shelley Higgins is a AC_MGR
William Gietz is a AC_ACCOUNT

Sample table : employees


Sample Solution :-

Oracle Code :

SELECT CONCAT (CONCAT (CONCAT(CONCAT(first_name,' '),last_name), ' is a '),job_id) 
FROM employees 
WHERE salary > 2000;

Output:


CONCAT(CONCAT(CONCAT(CONCAT(FIRST_NAME,''),LAST_NAME),'ISA'),J
--------------------------------------------------------------
Steven King is a AD_PRES
Neena Kochhar is a AD_VP
Lex De Haan is a AD_VP
Alexander Hunold is a IT_PROG
Bruce Ernst is a IT_PROG
David Austin is a IT_PROG
Valli Pataballa is a IT_PROG
Diana Lorentz is a IT_PROG
Nancy Greenberg is a FI_MGR
Daniel Faviet is a FI_ACCOUNT
John Chen is a FI_ACCOUNT

........

107 rows selected.

Pictorial Presentation:

Pictorial: concatenate first name, last name and job id from employees table  in the spacific format

Improve this sample solution and post your code through Disqus.

Previous: Write query to list the name (first and last name), hire date of all the employees who joined on 1-JUL-2006, 24-MAR-2007, 04-JAN-2008 in ascending order of seniority.
Next: Write a query to list the employees who are joined in the year between '01-Jan-2004' and '31-Dec-2008'.

What is the difficulty level of this exercise?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/oracle-exercises/operator/oracle-operator-exercise-13.php