How do you get the first and last name from the ID?

So I am making a system for my work and I am struggling on figuring out how to take the Employee_ID and get the First and Last name of the employee and then take the first and last name and combine it to be just the full name.

I have already figured out how to convert first and last name to full name using

Create proc FullName
select concat(concat(fname, ' '),lname) FullName
from Employees

>Solution :

This is an SQL-related question but since you are using concat, you can also select the field distinctly as shown above.

Whereas, adding the where clause limits your result to only the specified ID.

The question in the query is where your ID goes depending on which method you are using and the target DBMS

Create proc FullName @employeeId int
select concat(concat(fname, ' '),lname) FullName, fname, lname
from Employees WHERE Employee_Id = @employeeId


Leave a Reply