Sunday, October 9, 2022

.::: Study Kasus Praktis belajar Query create & insert table IBM DB2 (Create Data Warehouse) :::.


1. create user db2 in linux

[root@teguhth-grid ~]# useradd teguh
[root@teguhth-grid ~]# passwd teguh
Changing password for user teguh.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@teguhth-grid ~]#


2. login to user db2 linux

[root@teguhth-grid ~]# su - db2inst1
Last login: Sun Oct  2 10:29:47 WIB 2022 on pts/0
[db2inst1@teguhth-grid ~]$ db2 grant connect on database to user teguh
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL1024N  A database connection does not exist.  SQLSTATE=08003
[db2inst1@teguhth-grid ~]$ 
[db2inst1@teguhth-grid ~]$ db2 connect to teguhth
[db2inst1@teguhth-grid ~]$ db2 grant connect on database to user teguh
[db2inst1@teguhth-grid ~]$ db2 grant dbadm on database to user teguh
 
2. create database

[db2inst1@teguhth-grid ~]$ db2 create database teguhth
DB20000I  The CREATE DATABASE command completed successfully.
[db2inst1@teguhth-grid ~]$

or

[db2inst1@teguhth-grid ~]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 11.5.7.0

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => create database teguh
DB20000I  The CREATE DATABASE command completed successfully.
db2 => 
db2 => create database teguhth

DB20000I  The CREATE DATABASE command completed successfully.
db2 => db2 =>

db2 => list database directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = TEGUHTH
 Database name                        = TEGUHTH
 Local database directory             = /home/db2inst1
 Database release level               = 15.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

db2 => 


3. connect user teguh to database teguhth


db2 => connect to teguhth user teguh using teguh

   Database Connection Information

 Database server        = DB2/LINUXX8664 11.5.7.0
 SQL authorization ID   = TEGUH
 Local database alias   = TEGUHTH

db2 =>

4. create table example table barang;(login using user teguh (db2)) by default schema name = teguh
sintax

create table <schema>.<table_name> .....

example

create table barang ...
or
create table teguh.barang ...
sinta


5. create table barang

db2 => create table barang(KODE_BARANG char(6) not null ,NAMA_BARANG varchar(25), SATUAN_BARANG varchar(20),STOK_BARANG decimal(4),primary key (KODE_BARANG))
DB20000I  The SQL command completed successfully.
db2 =>

db2 => describe table barang

                                Data type                     Column
Column name                     schema    Data type name      Length     Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
KODE_BARANG                     SYSIBM    CHARACTER                    6     0 No    
NAMA_BARANG                     SYSIBM    VARCHAR                     25     0 Yes   
SATUAN_BARANG                   SYSIBM    VARCHAR                     20     0 Yes   
STOK_BARANG                     SYSIBM    DECIMAL                      4     0 Yes   

  4 record(s) selected.

db2 =>

6. create table suplier
 
db2 => create table suplier(KODE_SUPLIER char(5) not null,NAMA_SUPLIER varchar(30),ALAMAT_SUPLIER varchar(30),KOTA_SUPLIER varchar(15),TELEPON_SUPLIER varchar(15),primary key(KODE_SUPLIER))
DB20000I  The SQL command completed successfully.
db2 =>

db2 => describe table suplier

                                Data type                     Column
Column name                     schema    Data type name      Length     Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
KODE_SUPLIER                    SYSIBM    CHARACTER                    5     0 No    
NAMA_SUPLIER                    SYSIBM    VARCHAR                     30     0 Yes   
ALAMAT_SUPLIER                  SYSIBM    VARCHAR                     30     0 Yes   
KOTA_SUPLIER                    SYSIBM    VARCHAR                     15     0 Yes   
TELEPON_SUPLIER                 SYSIBM    VARCHAR                     15     0 Yes   

  5 record(s) selected.

db2 =>


7. create table customer
db2 => create table customer(KODE_CUSTOMER char(6) not null ,NAMA_CUSTOMER varchar(30),ALAMAT_CUSTOMER varchar(30),KOTA_CUSTOMER varchar(15),TELEPON_CUSTOMER varchar(15),primary key(KODE_CUSTOMER))
DB20000I  The SQL command completed successfully.
db2 =>
db2 => describe table customer

                                Data type                     Column
Column name                     schema    Data type name      Length     Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
KODE_CUSTOMER                   SYSIBM    CHARACTER                    6     0 No    
NAMA_CUSTOMER                   SYSIBM    VARCHAR                     30     0 Yes   
ALAMAT_CUSTOMER                 SYSIBM    VARCHAR                     30     0 Yes   
KOTA_CUSTOMER                   SYSIBM    VARCHAR                     15     0 Yes   
TELEPON_CUSTOMER                SYSIBM    VARCHAR                     15     0 Yes   

  5 record(s) selected.

db2 =>


8. create table pasok
db2 => create table pasok(KODE_PASOK char(10) not null,KODE_BARANG char(6) not null,KODE_SUPLIER char(5) not null,TANGGAL_PASOK date,JUMLAH_PASOK decimal(4),primary key(KODE_PASOK,KODE_BARANG,KODE_SUPLIER),foreign key(KODE_BARANG)references barang(KODE_BARANG),foreign key(KODE_SUPLIER)references suplier(KODE_SUPLIER))
DB20000I  The SQL command completed successfully.
db2 =>

db2 => describe table pasok

                                Data type                     Column
Column name                     schema    Data type name      Length     Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
KODE_PASOK                      SYSIBM    CHARACTER                   10     0 No    
KODE_BARANG                     SYSIBM    CHARACTER                    6     0 No    
KODE_SUPLIER                    SYSIBM    CHARACTER                    5     0 No    
TANGGAL_PASOK                   SYSIBM    DATE                         4     0 Yes   
JUMLAH_PASOK                    SYSIBM    DECIMAL                      4     0 Yes   

  5 record(s) selected.

db2 =>


9. create table pembelian

db2 => create table pembelian(KODE_PEMBELIAN char(10) not null,KODE_BARANG char(6) not null,KODE_CUSTOMER char(6) not null,TANGGAL_PEMBELIAN date,JUMLAH_PEMBELIAN decimal(4),primary key(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER),foreign key(KODE_BARANG)references barang(KODE_BARANG),foreign key(KODE_CUSTOMER)references customer(KODE_CUSTOMER))
DB20000I  The SQL command completed successfully.
db2 =>

db2 => describe table pembelian

                                Data type                     Column
Column name                     schema    Data type name      Length     Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
KODE_PEMBELIAN                  SYSIBM    CHARACTER                   10     0 No    
KODE_BARANG                     SYSIBM    CHARACTER                    6     0 No    
KODE_CUSTOMER                   SYSIBM    CHARACTER                    6     0 No    
TANGGAL_PEMBELIAN               SYSIBM    DATE                         4     0 Yes   
JUMLAH_PEMBELIAN                SYSIBM    DECIMAL                      4     0 Yes   

  5 record(s) selected.

db2 =>

10. insert table barang & select barang
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-01','RICE COOKER','BUAH',20);
DB20000I  The SQL command completed successfully.
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-02','LEMARI ES','UNIT',8);
DB20000I  The SQL command completed successfully.
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-03','TELEVISI','UNIT',30);
DB20000I  The SQL command completed successfully.
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-04','RADIO/TAPE','BUAH',35);
DB20000I  The SQL command completed successfully.
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-05','KOMPUTER','UNIT',28);
DB20000I  The SQL command completed successfully.
db2 => insert into barang(KODE_BARANG,NAMA_BARANG,SATUAN_BARANG,STOK_BARANG) values('ELK-06','KIPAS ANGIN','BUAH',38);
DB20000I  The SQL command completed successfully.

db2 => select * from barang;

KODE_BARANG NAMA_BARANG               SATUAN_BARANG        STOK_BARANG
----------- ------------------------- -------------------- -----------
ELK-01      RICE COOKER               BUAH                         20.
ELK-02      LEMARI ES                 UNIT                          8.
ELK-03      TELEVISI                  UNIT                         30.
ELK-04      RADIO/TAPE                BUAH                         35.
ELK-05      KOMPUTER                  UNIT                         28.
ELK-06      KIPAS ANGIN               BUAH                         38.

  6 record(s) selected.

db2 =>
db2 => select * from teguh.barang;

KODE_BARANG NAMA_BARANG               SATUAN_BARANG        STOK_BARANG
----------- ------------------------- -------------------- -----------
ELK-01      RICE COOKER               BUAH                         20.
ELK-02      LEMARI ES                 UNIT                          8.
ELK-03      TELEVISI                  UNIT                         30.
ELK-04      RADIO/TAPE                BUAH                         35.
ELK-05      KOMPUTER                  UNIT                         28.
ELK-06      KIPAS ANGIN               BUAH                         38.

  6 record(s) selected.

db2 =>

 


11. insert table suplier & select suplier
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EJ-01','PT ACTRON','JL THAMRIN 12','JAKARTA','(021) 850-2301');
DB20000I  The SQL command completed successfully.
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EJ-02','PT MULYA ELEKTRONIK','JL SUDIRMAN 45','JAKARTA','(021) 855-4262');
DB20000I  The SQL command completed successfully.
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EB-01','PT ULTRASOUND','JL SUKARNO HATTA 103','BANDUNG','(021) 522-3305');
DB20000I  The SQL command completed successfully.
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EB-02','PT SUPERTRON','JL INDUSTRI 37','BANDUNG','(021) 660-4091');
DB20000I  The SQL command completed successfully.
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EB-03','PT OCHANG','JL KOSAMBI 44','BANDUNG','(022) 850-4444');    
DB20000I  The SQL command completed successfully.
db2 => insert into suplier(KODE_SUPLIER,NAMA_SUPLIER,ALAMAT_SUPLIER,KOTA_SUPLIER,TELEPON_SUPLIER) values ('EB-04','PT TUNGGAL JAYA','JL KIARA CONDONG 77','BANDUNG','(022)740-7777');    
DB20000I  The SQL command completed successfully.

db2 => select * from suplier;

KODE_SUPLIER NAMA_SUPLIER                   ALAMAT_SUPLIER                 KOTA_SUPLIER    TELEPON_SUPLIER
------------ ------------------------------ ------------------------------ --------------- ---------------
EJ-01        PT ACTRON                      JL THAMRIN 12                  JAKARTA         (021) 850-2301
EJ-02        PT MULYA ELEKTRONIK            JL SUDIRMAN 45                 JAKARTA         (021) 855-4262
EB-01        PT ULTRASOUND                  JL SUKARNO HATTA 103           BANDUNG         (021) 522-3305
EB-02        PT SUPERTRON                   JL INDUSTRI 37                 BANDUNG         (021) 660-4091
EB-03        PT OCHANG                      JL KOSAMBI 44                  BANDUNG         (022) 850-4444
EB-04        PT TUNGGAL JAYA                JL KIARA CONDONG 77            BANDUNG         (022)740-7777  

  6 record(s) selected.

db2 =>
db2 => select * from teguh.suplier;

KODE_SUPLIER NAMA_SUPLIER                   ALAMAT_SUPLIER                 KOTA_SUPLIER    TELEPON_SUPLIER
------------ ------------------------------ ------------------------------ --------------- ---------------
EJ-01        PT ACTRON                      JL THAMRIN 12                  JAKARTA         (021) 850-2301
EJ-02        PT MULYA ELEKTRONIK            JL SUDIRMAN 45                 JAKARTA         (021) 855-4262
EB-01        PT ULTRASOUND                  JL SUKARNO HATTA 103           BANDUNG         (021) 522-3305
EB-02        PT SUPERTRON                   JL INDUSTRI 37                 BANDUNG         (021) 660-4091
EB-03        PT OCHANG                      JL KOSAMBI 44                  BANDUNG         (022) 850-4444
EB-04        PT TUNGGAL JAYA                JL KIARA CONDONG 77            BANDUNG         (022)740-7777  

  6 record(s) selected.

db2 =>

 
 



12. insert table customer & select customer
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('J-0001','TOKO KARISMA','JL CIMANGGIS 34','JAKARTA','(021) 856-4209');
DB20000I  The SQL command completed successfully.
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('J-0002','TOKO AYU','JL CIMANGGIS 12','JAKARTA','(021) 856-1321');    
DB20000I  The SQL command completed successfully.
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('B-0001','TOKO WARNA','JL ABC 234','BANDUNG','(022) 432-6635');    
DB20000I  The SQL command completed successfully.
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('B-0002','TOKO SURYA','JL ABC 309','BANDUNG','(022) 432-6024');    
DB20000I  The SQL command completed successfully.
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('B-0003','TOKO MAHARANI','JL KOPO 333','BANDUNG','(022) 856-3333');    
DB20000I  The SQL command completed successfully.
db2 => insert into customer(KODE_CUSTOMER,NAMA_CUSTOMER,ALAMAT_CUSTOMER,KOTA_CUSTOMER,TELEPON_CUSTOMER) values('B-0004','TOKO MULYA','JL OTISTA 555','BANDUNG','(022) 422-5555');    
DB20000I  The SQL command completed successfully.

db2 => select * from customer;

KODE_CUSTOMER NAMA_CUSTOMER                  ALAMAT_CUSTOMER                KOTA_CUSTOMER   TELEPON_CUSTOMER
------------- ------------------------------ ------------------------------ --------------- ----------------
J-0001        TOKO KARISMA                   JL CIMANGGIS 34                JAKARTA         (021) 856-4209  
J-0002        TOKO AYU                       JL CIMANGGIS 12                JAKARTA         (021) 856-1321  
B-0001        TOKO WARNA                     JL ABC 234                     BANDUNG         (022) 432-6635  
B-0002        TOKO SURYA                     JL ABC 309                     BANDUNG         (022) 432-6024  
B-0003        TOKO MAHARANI                  JL KOPO 333                    BANDUNG         (022) 856-3333  
B-0004        TOKO MULYA                     JL OTISTA 555                  BANDUNG         (022) 422-5555  

  6 record(s) selected.

db2 =>
db2 => select * from teguh.customer;

KODE_CUSTOMER NAMA_CUSTOMER                  ALAMAT_CUSTOMER                KOTA_CUSTOMER   TELEPON_CUSTOMER
------------- ------------------------------ ------------------------------ --------------- ----------------
J-0001        TOKO KARISMA                   JL CIMANGGIS 34                JAKARTA         (021) 856-4209  
J-0002        TOKO AYU                       JL CIMANGGIS 12                JAKARTA         (021) 856-1321  
B-0001        TOKO WARNA                     JL ABC 234                     BANDUNG         (022) 432-6635  
B-0002        TOKO SURYA                     JL ABC 309                     BANDUNG         (022) 432-6024  
B-0003        TOKO MAHARANI                  JL KOPO 333                    BANDUNG         (022) 856-3333  
B-0004        TOKO MULYA                     JL OTISTA 555                  BANDUNG         (022) 422-5555  

  6 record(s) selected.

db2 =>

 
 


13. insert table barang & select pasok
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E001','ELK-01','EJ-01','2002-01-01',8);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E002','ELK-01','EJ-02','2002-01-01',5);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E003','ELK-02','EJ-01','2002-02-01',2);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E004','ELK-02','EJ-02','2002-02-02',3);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E005','ELK-02','EB-02','2002-01-01',2);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E006','ELK-03','EJ-01','2002-03-03',5);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E007','ELK-03','EJ-01','2002-03-04',2);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E008','ELK-03','EJ-01','2002-03-03',3);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E009','ELK-03','EB-01','2002-03-13',4);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E010','ELK-03','EB-01','2002-03-13',3);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E011','ELK-04','EB-01','2002-04-22',12);
DB20000I  The SQL command completed successfully.
db2 => insert into pasok(KODE_PASOK,KODE_BARANG,KODE_SUPLIER,TANGGAL_PASOK,JUMLAH_PASOK) values('PAS-E012','ELK-04','EB-02','2002-04-30',9);
DB20000I  The SQL command completed successfully.
select * from pasok;

db2 => select * from pasok;

KODE_PASOK KODE_BARANG KODE_SUPLIER TANGGAL_PASOK JUMLAH_PASOK
---------- ----------- ------------ ------------- ------------
PAS-E001   ELK-01      EJ-01        01/01/2002              8.
PAS-E002   ELK-01      EJ-02        01/01/2002              5.
PAS-E003   ELK-02      EJ-01        02/01/2002              2.
PAS-E004   ELK-02      EJ-02        02/02/2002              3.
PAS-E005   ELK-02      EB-02        01/01/2002              2.
PAS-E006   ELK-03      EJ-01        03/03/2002              5.
PAS-E007   ELK-03      EJ-01        03/04/2002              2.
PAS-E008   ELK-03      EJ-01        03/03/2002              3.
PAS-E009   ELK-03      EB-01        03/13/2002              4.
PAS-E010   ELK-03      EB-01        03/13/2002              3.
PAS-E011   ELK-04      EB-01        04/22/2002             12.
PAS-E012   ELK-04      EB-02        04/30/2002              9.

  12 record(s) selected.

db2 =>
db2 => select * from teguh.pasok;

KODE_PASOK KODE_BARANG KODE_SUPLIER TANGGAL_PASOK JUMLAH_PASOK
---------- ----------- ------------ ------------- ------------
PAS-E001   ELK-01      EJ-01        01/01/2002              8.
PAS-E002   ELK-01      EJ-02        01/01/2002              5.
PAS-E003   ELK-02      EJ-01        02/01/2002              2.
PAS-E004   ELK-02      EJ-02        02/02/2002              3.
PAS-E005   ELK-02      EB-02        01/01/2002              2.
PAS-E006   ELK-03      EJ-01        03/03/2002              5.
PAS-E007   ELK-03      EJ-01        03/04/2002              2.
PAS-E008   ELK-03      EJ-01        03/03/2002              3.
PAS-E009   ELK-03      EB-01        03/13/2002              4.
PAS-E010   ELK-03      EB-01        03/13/2002              3.
PAS-E011   ELK-04      EB-01        04/22/2002             12.
PAS-E012   ELK-04      EB-02        04/30/2002              9.

  12 record(s) selected.

db2 =>

 
 

14. insert table barang & select pembelian
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E001','ELK-01','J-0001','2002-05-20',3);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E002','ELK-01','J-0001','2002-05-21',4);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E003','ELK-01','J-0002','2002-05-20',2);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E004','ELK-01','B-0001','2002-05-20',2);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E005','ELK-01','B-0002','2002-05-22',3);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E006','ELK-02','J-0001','2002-06-24',1);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E007','ELK-02','J-0002','2002-06-24',1);    
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E008','ELK-02','B-0001','2002-06-25',2);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E009','ELK-02','B-0002','2002-06-25',2);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E010','ELK-03','J-0001','2002-06-20',5);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E011','ELK-03','J-0002','2002-07-02',4);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E012','ELK-03','B-0001','2002-07-02',6);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E013','ELK-03','J-0001','2002-07-10',5);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E014','ELK-04','J-0002','2002-07-15',12);
DB20000I  The SQL command completed successfully.
db2 => insert into pembelian(KODE_PEMBELIAN,KODE_BARANG,KODE_CUSTOMER,TANGGAL_PEMBELIAN,JUMLAH_PEMBELIAN) values('BEL-E015','ELK-04','B-0002','2002-07-17',15);
DB20000I  The SQL command completed successfully.


db2 => select * from pembelian;

KODE_PEMBELIAN KODE_BARANG KODE_CUSTOMER TANGGAL_PEMBELIAN JUMLAH_PEMBELIAN
-------------- ----------- ------------- ----------------- ----------------
BEL-E001       ELK-01      J-0001        05/20/2002                      3.
BEL-E002       ELK-01      J-0001        05/21/2002                      4.
BEL-E003       ELK-01      J-0002        05/20/2002                      2.
BEL-E004       ELK-01      B-0001        05/20/2002                      2.
BEL-E005       ELK-01      B-0002        05/22/2002                      3.
BEL-E006       ELK-02      J-0001        06/24/2002                      1.
BEL-E007       ELK-02      J-0002        06/24/2002                      1.
BEL-E008       ELK-02      B-0001        06/25/2002                      2.
BEL-E009       ELK-02      B-0002        06/25/2002                      2.
BEL-E010       ELK-03      J-0001        06/20/2002                      5.
BEL-E011       ELK-03      J-0002        07/02/2002                      4.
BEL-E012       ELK-03      B-0001        07/02/2002                      6.
BEL-E013       ELK-03      J-0001        07/10/2002                      5.
BEL-E014       ELK-04      J-0002        07/15/2002                     12.
BEL-E015       ELK-04      B-0002        07/17/2002                     15.

  15 record(s) selected.

db2 =>
db2 => select * from teguh.pembelian;

KODE_PEMBELIAN KODE_BARANG KODE_CUSTOMER TANGGAL_PEMBELIAN JUMLAH_PEMBELIAN
-------------- ----------- ------------- ----------------- ----------------
BEL-E001       ELK-01      J-0001        05/20/2002                      3.
BEL-E002       ELK-01      J-0001        05/21/2002                      4.
BEL-E003       ELK-01      J-0002        05/20/2002                      2.
BEL-E004       ELK-01      B-0001        05/20/2002                      2.
BEL-E005       ELK-01      B-0002        05/22/2002                      3.
BEL-E006       ELK-02      J-0001        06/24/2002                      1.
BEL-E007       ELK-02      J-0002        06/24/2002                      1.
BEL-E008       ELK-02      B-0001        06/25/2002                      2.
BEL-E009       ELK-02      B-0002        06/25/2002                      2.
BEL-E010       ELK-03      J-0001        06/20/2002                      5.
BEL-E011       ELK-03      J-0002        07/02/2002                      4.
BEL-E012       ELK-03      B-0001        07/02/2002                      6.
BEL-E013       ELK-03      J-0001        07/10/2002                      5.
BEL-E014       ELK-04      J-0002        07/15/2002                     12.
BEL-E015       ELK-04      B-0002        07/17/2002                     15.

  15 record(s) selected.

db2 =>

 



No comments:

Post a Comment

Popular Posts