select firstname, lastname, city, state
from person left join Address
on person.PersonId = Address.PersonId
;
SELECT
a.Name AS 'Employee'
FROM
Employee AS a,
Employee AS b
WHERE
a.ManagerId = b.Id
AND a.Salary > b.Salary
;
select Email from
(
select Email, count(Email) as num
from Person
group by Email
) as statistic
where num > 1;
select customers.name as 'Customers'
from customers
where customers.id not in
(
select customerid from orders
)
;
delete p1 from person p1, person p2
where p1.email = p2.email and p1.id > p2.id
select
weather.id as 'id'
from weather join weather w on DATEDIFF(weather.recordDate, w.recordDate) = 1
and weather.Temperature > w.Temperature
;
网友评论