-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6. update data.sql
57 lines (45 loc) · 1.11 KB
/
6. update data.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
56
57
-- Menambah kolom kategori
alter table products
add column category enum ('Makanan','Minuman','Lain-lain')
after name;
select * from products;
-- Mengubah satu kolom
update products
set category = 'Makanan'
where id='P0005';
update products
set category = 'Makanan',
description = 'Mie Ayam Original + Ceker'
where id='P0003';
update products
set price = 20000
where id='P0005';
update products
set price = price - 5000
where id='P0005';
insert into products(id,name,price,quantity)
values ('P0009','Mie Ayam Sayur',15000,100);
update products
set category = 'Makanan',
description = 'Mie Ayam + Sayur'
where id='P0009';
update products
set id = 'P0006',
description = 'Mie Ayam + Sayur'
where id='P0009';
update products
set name = 'Mie Sayur',
description = 'Mie Ayam + Sayur'
where id = 'P0006';
update products
set id = 'P0016'
where id='P0006';
update products
set name = 'Mie Ayam Sayur'
where id='P0016';
update products
set category='Makanan'
where id='P0004';
-- Menghapus Data
delete from products
where id='P0009';