0% found this document useful (0 votes)
23 views

Create Database TOKO

The document creates two tables, Barang and Bahann, to store product and ingredient data respectively for a store called TOKO_SWALAYAN_JOGJA. It inserts initial data into both tables, then performs various operations like adding, updating, and deleting columns and rows.

Uploaded by

Maya Audina
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Create Database TOKO

The document creates two tables, Barang and Bahann, to store product and ingredient data respectively for a store called TOKO_SWALAYAN_JOGJA. It inserts initial data into both tables, then performs various operations like adding, updating, and deleting columns and rows.

Uploaded by

Maya Audina
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Create​ ​database​ TOKO_SWALAYAN_JOGJA

Use​ TOKO_SWALAYAN_JOGJA
Go

create​ ​table​ Barang​(


Kode_Barang char​(​7​)​ ​primary​ ​key​ ​not​ ​null,
Nama_Barang varchar ​(​25​),
Harga numeric​,
Expired date
)
Insert​ ​into​ Barang ​values ​(​'M900'​,​'Oreo'​,​'8000'​,​'02-01-2020'​)
Insert​ ​into​ Barang ​values ​(​'M901'​,​'Lays'​,​'9000'​,​'02-03-2020'​)
Insert​ ​into​ Barang ​values ​(​'M902'​,​'Taro'​,​'5000'​,​'02-05-2020'​)
Insert​ ​into​ Barang ​values ​(​'M903'​,​'Malkist'​,​'6000'​,​'03-15-2020'​)
Insert​ ​into​ Barang ​values ​(​'M904'​,​'Piatos'​,​'6500'​,​'03-20-2020'​)

select​*​from​ Barang

create​ ​table​ Bahann​(


Kode_Barang char ​(​7​)​ ​primary​ ​key​ ​not​ ​null,
Nama_Bahan varchar ​(​25​),
Merek_Bahan varchar ​(​20​),
Harga numeric​,
Expired date
)
Insert​ ​into​ Bahann ​values​(​'BP400'​,​'Gula'​,​'Gulaku'​,​'12000'​,​'04-05-2020'​)
Insert​ ​into​ Bahann ​values​(​'BP401'​,​'Tepung'​,​'Segitiga Biru'​,​'25000'​,​'04-07-2020'​)
Insert​ ​into​ Bahann ​values​(​'BP402'​,​'Terasi'​,​'ABC'​,​'5000'​,​'04-09-2020'​)
Insert​ ​into​ Bahann ​values​(​'BP403'​,​'Bumbu Kaldu'​,​'Masako'​,​'6000'​,​'05-12-2020'​)
Insert​ ​into​ Bahann ​values​(​'BP404'​,​'Mie Telur'​,​'Burung Dara'​,​'7000'​,​'04-15-2020'​)

select​*​from​ Barang
select​*​from​ Bahann

Alter​ ​Table​ Barang ​Add​ Merek_Barang ​varchar ​(​25​)


Update​ Barang ​Set​ Merek_Barang ​=​ ​'Roma'​ ​Where​ Kode_Barang ​=​ ​'M903'

select​*​from​ Bahann ​Where​ Kode_Barang ​=​ ​'BP402'

Delete​ ​from​ Bahann ​Where​ Kode_Barang ​=​ ​'BP400'


Alter​ ​table​ Bahann D​ rop​ ​Column​ Harga

Alter​ ​table​ Bahann ​Add​ Jenis_Bahan ​varchar ​(​25​)


Update​ Bahann ​Set​ Jenis_Bahan ​=​ ​'Tapioka'​ ​Where​ Kode_Barang ​=​ '
​ BP401'

​ rom​ Barang ​Where​ Kode_Barang ​=​ '


Delete​ f ​ M902'
Delete​ f​ rom​ Bahann W
​ here​ Kode_Barang =
​ ​ '​ BP403'

Alter​ ​table​ Barang ​Drop​ ​Column​ Expired

You might also like