-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab3.sql
47 lines (39 loc) · 1.05 KB
/
Lab3.sql
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
47
-- 1. Lists orno and dollars of all orders.
SELECT ordno, dollars
FROM orders;
-- 2. Lists name and city of agents named 'Smith'.
SELECT name, city
FROM agents
WHERE name='Smith';
-- 3. Lists pid, name, and priceUSD of products with quantity greater than 208,000.
SELECT pid, name, priceUSD
FROM products
WHERE quantity>208000;
-- 4. Lists names and cities of customers in Dallas.
SELECT name, city
FROM customers
WHERE city='Dallas';
-- 5. Lists names of agents in New York and NOT in Tokyo.
SELECT name
FROM agents
WHERE city='New York'
AND city!='Tokyo';
-- 6. Lists all data for products not in Dallas or Duluth that costs $1 or more.
SELECT * FROM products
WHERE priceUSD>=1
AND city!= 'Dallas'
AND city!='Duluth';
-- 7. Lists all data for orders in January or March.
SELECT *
FROM orders
WHERE mon='jan'
OR mon='mar';
-- 8. Lists all data for orders in February that are less than $500.
SELECT *
FROM orders
WHERE mon='feb'
AND dollars<500;
-- 9. Lists all orders from the customer whose cid is C005.
SELECT *
FROM orders
WHERE cid='c005';