select a.Name as 'Employee'
from Employee a inner join Employee b
on a.ManagerId = b.Id
where a.Salary > b.Salary
select email from Person
group by Email having count(Email) >1
select Name as 'Customers'
from Customers where
id not in (select CustomerId from Orders )
select d.name as 'Department' , e.name as 'Employee',e.salary as 'Salary'
from Employee e
inner join Department d on e.departmentId = d.id
where (e.departmentId ,e.salary) in
(select departmentId,max(salary) from Employee
group by departmentId)
select d.name as 'Department',e.name as 'Employee',e.salary as 'Salary'
from Employee e inner join Department d
on e.Departmentid = d.id
where 3 > (
select count(distinct e2.salary) from Employee e2
where e2.salary > e.salary and e.Departmentid = e2.Departmentid
)
网友评论