-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleft-join-query.sql
More file actions
46 lines (38 loc) · 950 Bytes
/
left-join-query.sql
File metadata and controls
46 lines (38 loc) · 950 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
34
35
36
37
38
39
40
41
42
43
44
45
46
use classicmodels;
select customers.customerNumber,
customerName,
orderNumber,
status
from customers
left join orders on
orders.customerNumber = customers.customerNumber;
select customers.customerNumber,
customerName,
orderNumber,
status
from customers
left join orders using(customerNumber);
select
c.customerNumber,
c.customerName,
o.orderNumber,
o.status
from customers c
left join orders o on o.customerNumber = c.customerNumber
where orderNumber is null;
select
lastName,
firstName,
customerName,
checkNumber,
amount
from employees
left join customers on employeeNumber = salesRepEmployeeNumber
left join payments on payments.customerNumber = customers.customerNumber
order by customerName,checkNumber;
select o.orderNumber,
customerNumber,
productCode
from orders o
left join orderDetails using (orderNumber)
where orderNumber = 10123;