This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT company.company_code,company.founder, | |
count(distinct Lead_manager.lead_manager_code), | |
count(distinct Senior_manager.senior_manager_code), | |
count(distinct Manager.manager_code),count(distinct Employee.employee_code) | |
from company | |
INNER JOIN Lead_Manager | |
on company.company_code = Lead_Manager.company_code | |
INNER JOIN Senior_Manager | |
on company.company_code = Senior_Manager.company_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select case | |
when p is null then concat(n, ' Root') | |
when n in (select distinct p from bst) then concat(n, ' Inner') | |
else concat(n, ' Leaf') | |
end | |
from bst | |
order by n asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select concat(name,"(",left(OCCUPATION,1),")") | |
from OCCUPATIONS | |
order by name asc; | |
select concat("There are a total of"," ",count(OCCUPATION)," ",LOWER(OCCUPATION),"s",".") | |
from OCCUPATIONS | |
group by OCCUPATION | |
order by count(OCCUPATION),OCCUPATION; |