-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLesson11.sql
More file actions
24 lines (18 loc) · 744 Bytes
/
Copy pathLesson11.sql
File metadata and controls
24 lines (18 loc) · 744 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
### OR
/*
1. Find list of orders ids where either gloss_qty or poster_qty is greater
than 4000. Only include the id field in the resulting table.
2. Write a query that returns a list of orders where the standard_qty is
zero and either the gloss_qty or poster_qty is over 1000.
3. Find all the company names that start with a 'C' or 'W', and the primary
contact contains 'ana' or 'Ana', but it doesn't contain 'eana'.
*/
SELECT id
FROM orders
WHERE gloss_qty > 4000 OR poster_qty > 4000;
SELECT *
FROM orders
WHERE standard_qty = 0 AND (gloss_qty > 1000 OR poster_qty > 1000);
SELECT name
FROM accounts
WHERE (name LIKE 'C%' OR name LIKE 'W%') AND ((primary_poc LIKE '%ana%' OR primary_poc LIKE '%Ana%') AND primary_poc NOT LIKE '%eana');