-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.sql
56 lines (39 loc) · 1020 Bytes
/
product.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
48
49
50
51
52
53
54
55
CREATE TABLE product(
'product name' varchar(10),
'unit price' float(6)
);
INSERT INTO product(washing machine, 38000);
INSERT INTO product(fride, 29000);
INSERT INTO product(AC, 36000);
INSERT INTO product(grinder, 5000);
INSERT INTO product(stove, 7000);
INSERT INTO product(microwave, 21000);
SELECT
'product name',
'unit price',
'unit price' * 1.1 AS 'new price',
FROM product;
SELECT *
FROM product
WHERE 'unit price' IN (2900,5000,7000);
SELECT *
FROM product
WHERE 'unit price' NOT IN (2900,5000,7000);
SELECT *
FROM product
WHERE 'unit price' BETWEEN 10000 AND 20000;
SELECT *
FROM product
WHERE 'product name' LIKE 'w%' --names startig with w
SELECT *
FROM product
WHERE 'product name' LIKE '%a%' --any number of characters before and after a
SELECT *
FROM product
WHERE 'product name' LIKE '%c' --names ending with c
SELECT *
FROM product
WHERE 'product name' LIKE '-c' --c occuring after 1 character
SELECT *
FROM product
LIMIT 3 --return the first three customers