-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL_QUERY_2.sql
More file actions
33 lines (27 loc) · 821 Bytes
/
Copy pathSQL_QUERY_2.sql
File metadata and controls
33 lines (27 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
select * from sales;
select * from people;
select s.SaleDate, s.Amount, p.salesperson, s.SPID, p.SPID
from sales s
join People p on p.SPID = s.SPID;
select s.SaleDate, s.Amount, pr.Product
from sales s
left join products pr on pr.PID = s.PID;
select s.SaleDate, s.Amount, pr.Product, p.Team
from sales s
join People p on p.SPID = s.SPID
left join products pr on pr.PID = s.PID
where p.Team = '';
select s.SaleDate, s.Amount, pr.Product, p.Team
from sales s
join People p on p.SPID = s.SPID
left join products pr on pr.PID = s.PID
where s.Amount<500
and p.Team= 'Yummies';
select s.SaleDate, s.Amount, pr.Product, p.Team
from sales s
join People p on p.SPID = s.SPID
left join products pr on pr.PID = s.PID
join Geo g on g.GeoID = s.GeoID
where p.team = ''
and g.Geo in ('India','New Zeland')
order by SaleDate