I am using an SQL Database, which is a DBMS. Its the Lyric Database. (I'll be happy to clarify if my description is insufficient).
My salespeople table (with the salesids) is as follows:
SalesPeople:
SalesID | FirstName | LastName
------- | --------- | --------
| |
and my Studios table is as follows:
Studios:
StudioID | Name | City | Contact | SalesID
-------- | ---- | ---- | ------- | -------
| | | |
I have started the Query in the following way:
select st.salesid, coalesce(sp.salesid, 'Does Not Work')
--Does This Match Harry Lee?
from studios st
inner join salespeople sp on sp.salesid = st.salesid;
and as well:
select st.*
from studios st
inner join salespeople sp
on sp.salesid = st.salesid
where st.contact = "Harry Lee";
But I am unsure as to relabel the column. I know to relable the column (as I sort of hint in the query above with the coalesce function).
However, how to I include that in the prior query whilst still adhering to the specifics of question? And again, I'll be happy to clarify the question if my description is insufficient.