This is homework.
Here is the problem: Produce a list of employee last name, first name and department name. Use appropriate, user friendly column aliases.
This is from the tables DEMO.EMPLOYEE
and DEMO.DEPARTMENT
. The relevant column names are LAST_NAME, FIRST_NAME, DEPARTMENT_ID
(from DEMO.EMPLOYEE
) and DEPARTMENT_ID, NAME
from DEMO.DEPARTMENT
.
As you can see, I need to have the last and first name columns from DEMO.EMPLOYEE
and use the department id column to look up the department name in DEMO.DEPARTMENT
. I will use the SELECT x AS y
command to give the columns good aliases but I can't figure out how to reference the columns to each other. I tried the REPLACE
command, but I couldn't get that to work and I couldn't find anything else. Any help would be appreciated.
iamthesgt
0
Junior Poster
Recommended Answers
Jump to Post1. If you are logging in as Demo, there is no need to specify "Demo.".
If you are logging into a different schema, then keep the "Demo.".2. You can use Aliases.
From Department D, Employee E
3. Select your columns...
Select E.Last_Name …
Jump to PostThe 3rd and 4th column of your output clearly shows, this output is not of the query that you have posted here. Please recheck.
All 6 Replies
hfx642
iamthesgt
0
Junior Poster
debasisdas
580
Posting Genius
Featured Poster
iamthesgt
0
Junior Poster
hfx642
iamthesgt
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.