I've very new to SQL Developer and I have some practice business problems to help build my knowledge..
What im trying to do is I have a table called 'VMStaff' with columns of Name, Department, Favourite Colour, Gender, Job Role and Manger name.. Within this table, some of the managers have entries under 'Manager Name' and 'Name'
What I want from my output is Name of a colleague and their managers favourite colour.. I've tried doing this via self joins but must be missing something - Is anyone able to help or shed light on this?
I have tried twice to make this work, see below -
NUMBER1 -
SELECT vmstaff1.name, vmstaff2."FAVOURITE COLOUR"
from vmstaff name, vmstaff "Favourite Colour"
Left JOIN vmstaff1 vmstaff2
on vmstaff1."Manager Name" = Vmstaff2.Name
NUMBER 2 -
Select VM1.Name, VM2."Favourite Colour"
From vmstaff.Name as VM1
Inner Join vmstaff."Favourite Colour" as VM2
on VM1."Manager Name" = VM2."Favourite Colour"
I im lacking understanding of how to join the table and how to use the alias. In attempt NUMBER1 I get the error message Invalid SQL Statement and in attempt number 2 I get the error message SQL Command not properly ended