Mode:
Duration:
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
CREATE TABLE suppliers (
supplier_id SERIAL PRIMARY KEY,
supplier_name VARCHAR(100)
);
CREATE TABLE inventory (
item_id SERIAL PRIMARY KEY,
item_name VARCHAR(100),
stock_quantity INTEGER,
reorder_level INTEGER,
supplier_id INTEGER REFERENCES suppliers(supplier_id)
);
INSERT INTO suppliers (supplier_name) VALUES
('Tech Supply Co'),
('Global Parts Ltd');
INSERT INTO inventory (
item_name,
stock_quantity,
reorder_level,
supplier_id
) VALUES
('SSD Drive', 50, 20, 1),
('RAM Module', 15, 25, 1),
('Power Supply', 10, 15, 2);
SELECT
item_name,
stock_quantity,
reorder_level,
CASE
WHEN stock_quantity < reorder_level THEN 'REORDER'
ELSE 'OK'
END AS inventory_status
FROM inventory;
SELECT
s.supplier_name,
COUNT(i.item_id) AS supplied_items
FROM suppliers s
JOIN inventory i
ON s.supplier_id = i.supplier_id
GROUP BY s.supplier_name;
CREATE INDEX idx_inventory_stock
ON inventory(stock_quantity);
SELECT *
FROM inventory
ORDER BY stock_quantity ASC;Coding works best on desktop or with an external keyboard.
~`
!1
@2
#3
$4
%5
^6
&7
*8
(9
)0
_-
+=
⌫
Tab
Q
W
E
R
T
Y
U
I
O
P
{[
}]
|\
Caps
A
S
D
F
G
H
J
K
L
:;
"'
↵
⇧
Z
X
C
V
B
N
M
<,
>.
?/
⇧
Ctrl
⊞
Alt
␣
Alt
⊞
Ctx
Ctrl
👈Middle
CL Pinky
L Ring
L Middle
L Index
Thumb
R Index
R Middle
R Ring
R Pinky