Thursday, October 14, 2010

Power of Dreams and Prayers of a Child

When I was primary school, I still remember when I used to cry when invited to go by my family. You know why ????? The reason only one, the motorcycle my father often broke down the middle of the journey. In fact, refreshing trip on Sunday the streets are often exhausted at having to wait for the father who was repairing his motorcycle.

When I am sad, my father and my mother always advised me gently. That we must be patient and grateful for the gift of God. In the end I was definitely told to pray earnestly that the father was given a fine house, fine motor, and a car like one friend's father that I knew.
I also still remember when I was very pleased to be invited primary schools to visit the homes of friends my rich dad. At that time I often imagine that the father who has a house like my friends dad's rich. Even the shadows, taste, and beauty that I felt could last for several days:)

I also still remember when my father and mother used to tell if they can not possibly have a big house and a car like their friends rich. The reason my parents is because they are just civil servants with a salary a little. Even our house when it was still a contract.

But I do not care, I kept imagining how happy if my father had a big house and car. Every time I pray, I always ask the Lord if I want my father could have his own house and car. I always pray that I am not always sad because a motorbike father who was always broken.

Did you know? In 3 years of what I hayalkan and pray come true! My dad can finally have a big house, new motor, and a car. EXACTLY LIKE THAT IMAGINE ME AND ASK THE LORD FOR MY 3 YEAR START CLASS 2 SD.

I think if all of that just happened to me . My story also happened to my friend. Despite his father's income only slightly, her father can send their children to nursery school favorite with a very expensive cost. All that can happen because the child had always imagined that he would later school at that place.
the boy did not care even if both parents said not afford to pay the registration fee. to realize what he wants, the child allowance in order to save the school in place of his dreams. Every morning she always asks invited even if only to see the school which will become his school.

Did you know? Eventually the child can attend school in that place even though it is logically impossible parents can afford the registration fee. It turns out the boy's prayer answered by God. GOD realize the dream of the child and give sufficient fortune to his parents for his son's dream come true.
A child's dream is the dream that is still pure and innocent. These dreams are often granted by the Lord. It is based on my experience and the experiences of some friends.

Before bed, imagine how nice it had a good life. Finally, do not forget to ask God. Instill confidence in you, that only God is capable mengabulkansemua our dreams.
Once again, the dream child is prayer. Prayer young children will easily be granted because the innocence of his soul. that was my experience I can tell all my friends.

kunjungi yang lainnya

Tuesday, September 28, 2010

TUTORIAL DATA MANIPULATION LANGUAGE ( DML )


 
Perintah SQL

1.     INSERT

INSERT kita gunakan untuk memasukkan data pada tabel.

Misalkan kita akan menginput data pada tabel Customer. Kita dapat melakukan penginputan dengan cara sebagai berikut :

Struktur umum penulisan perintah untuk menambah data adalah sebagai berikut :

1.     INSERT INTO nama_tabel ( kolom_data ) VALUES ( isi_data );

Kalau kita menggunakan cara yang ini, kita dapat menginputkan isi tabel tanpa harus sesuai dengan struktur tabel tersebut.

Contoh :

INSERT INTO Customer (KdCustomer,NmCustomer,Kota) VALUES ('Jakarta',’C-003’,’PT.Maju Terus’);

2.     insert into nama_tabel values (‘KdCustomer’,’NmCustomer’,’Kota’);

Kalau kita menggunakan cara ini, berarti kita harus menginputkan isi tabel sesuai dengan struktur tabel.

Contoh :

insert into customer values('C-003','PT.Maju Terus','Jakarta');

insert into customer  values('C-065','Toko Delapan','Bandung');

insert into customer  values('C-034','CV.Komala','Bandung');

insert into customer  values('C-109','PT.Samudra','Garut'); 

2. UPDATE
Begitu juga dengan UPDATE kita gunakan untuk mengubah data – data yang sudah ada pada tabel.
Perintah Update ini akan mengubah isi kolom data yang jika tidak diisikan kondisi where data maka akan mengubah seluruh kolo yang ada diseluruh baris. Oleh sebab itu kita harus selalu memperhatikan kondisi data yang akan dilakukan perubahan.
Misalnya akan dilakukan perubahan nama customer pada nama customer=CV.Komala menjadi Komala Sari. Maka kondisi yang harus dibuat adalah KdCustomer sebagai key pada tabel tersebut, where KdCustomer=’C-034’.  
Struktur umum penulisan perintah untuk merubah data adalah sebagai berikut :
1.     UPDATE nama_table SET nama_kolom = nilai_baru_kolom WHERE kondisi;

Perintah SQLnya untuk merubah data adalah :
Contoh : UPDATE Customer SET NmCustomer=’Komala Sari’ WHERE KdCustomer=’C-034’;

2.     UPDATE nama_table SET nama_kolom1 = nilai_baru_kolom1, nama_kolom2 = nilai_baru_kolom2 WHERE kondisi;

Contoh : UPDATE Customer SET NmCustomer=’Toko Seratus’, Kota=’Medan’ where KdCustomer=’C-065’;
 
3.     DELETE
Perintah DELETE dapat kita gunakan apabila kita akan menghapus satu baris data atau lebih tergantung pada kondisi where yang diberikan. Sebaiknya setiap melakukan proses penghapusan data maka kondisi penghapusan harus terdefenisi dengan baik, jika tidak maka kita akan kehilangan data.
Struktur umum penulisan perintah untuk menghapus data adalah sebagai berikut :
1.     DELETE FROM nama_table WHERE kondisi;
Kalau kita menggunakan cara yang ini, kita dapat Menghapus satu baris data.
Contoh :
Delete from customer where KdCustomer=’C-003’;
2.     DELETE FROM nama_tabel ;
Kalau kita menggunakan cara yang ini, kita dapat Menghapus semua data ( mengosongkan data yang ada pada tabel tertentu ).
Contoh :
DELETE FROM Customer ; ------> Kita akan mengosongkan data pada tabel Customer.
  
4.     SELECT
Sedangkan perintah SELECT kita gunakan untuk memunculkan data atau mengakses data.
A.   Menampilkan Data dalam satu tabel.

1.     Menampilkan semua data yang ada pada tabel Customer.
SELECT *From nama_table;
Contoh :
SELECT * FROM Customer;
2.     Perintah menampilkan beberapa bagian dari table
SELECT nama_kolom FROM nama_table;
Contoh :
SELECT NmCustomer,Kota FROM Customer;
3.     Perintah mengurutkan data
SELECT nama_kolom FROM nama_table ORDER BY nama_kolom ASC | DESC
Contoh :
SELECT KdCustomer,NmCustomer FROM Customer ORDER BY KdCustomer asc;
SELECT KdCustomer,NmCustomer FROM Customer ORDER BY KdCustomer desc;

B.   Menampilkan data lebih dari satu tabel.

1.     Menampilkan nama dan kota customer yang telah melakukan transaksi.
SELECT nama_kolom1,nama_kolom2
FROM nama_tabel1, nama_tabel2
WHERE nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key);
Contoh :
select nmcustomer,kota from customer c, penjualan p
where c.kdcustomer=p.kdcustomer;

 
2. Menampilkan kode barang serta jumlahnya yang telah di beli oleh PT.TOKO DELAPAN.
SELECT nama_kolom1,nama_kolom2
FROM nama_tabel1, nama_tabel2,nama_tabel3
WHERE (nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key)) and
(lower(kondition));
Contoh :
select kdbarang , jumlah from customer c, penjualan p, transaksi t
where (c.kdcustomer=p.kdcustomer) and
(p.nofaktur=t.nofaktur) and
(lower(nmcustomer)='toko delapan');
3. munculkan nama barang yang telah di beli oleh PT.MAJU TERUS
Contoh :
SELECT nama_kolom1
FROM nama_tabel1, nama_tabel2,nama_tabel3,nama_tabel4
WHERE (nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key)) and
(nama_tabel2.nama_kolom(primary key)=nama_tabel3(primary key)) and
(nama_tabel3.nama_kolom(primary key)=nama_tabel4(primary key))
(lower(kondition));
select nmbarang
     from customer c, penjualan p, transaksi t, barang b
     where (c.kdcustomer=p.kdcustomer) and
     (p.nofaktur=t.nofaktur) and
     (t.kdbarang=b.kdbarang) and
     lower(nmcustomer)='pt.maju terus';
4. Menampilkan nama barang dan nama customer yang memesan barang dengan menggunakan perintah JOIN
SELECT nama_kolom1,nama_kolom2
FROM nama_tabel1
JOIN nama_tabel2 ON (nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key))
JOIN nama_tabel3 ON (nama_tabel2.nama_kolom(primary key)=nama_tabel3(primary key))
JOIN nama_tabel4 ON (nama_tabel3.nama_kolom(primary key)=nama_tabel4(primary key));
Contoh :
select nmcustomer,nmbarang
     from customer c
     JOIN penjualan p ON(c.kdcustomer=p.kdcustomer)
     JOIN transaksi t ON(p.nofaktur=t.nofaktur)
     JOIN barang b ON(t.kdbarang=b.kdbarang);
5. Menampilkan Siapa sajakah yang memesan barang 'Memory 512'
SELECT nama_kolom1
FROM nama_tabel1
JOIN nama_tabel2 ON (nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key))
JOIN nama_tabel3 ON (nama_tabel2.nama_kolom(primary key)=nama_tabel3(primary key))
JOIN nama_tabel4 ON (nama_tabel3.nama_kolom(primary key)=nama_tabel4(primary key));
(lower WHERE kondition);
Contoh :
select nmcustomer
     from customer c
     JOIN penjualan p ON(c.kdcustomer=p.kdcustomer)
     JOIN transaksi t ON(p.nofaktur=t.nofaktur)
     JOIN barang b ON(t.kdbarang=b.kdbarang)
     where nmbarang='Memory 512';
6. Menampilkan nama barang yang terdapat ditabel barang tetapi tidak terdapat ditabel transaksi.
Contoh :
select nmbarang
     from barang MINUS select nmbarang
     from transaksi t JOIN barang b ON(t.kdbarang=b.kdbarang);
7. Menampilkan tanggal faktur dan jumlah barang yang terjual
SELECT nama_kolom1,nama_kolom2
FROM nama_tabel1
JOIN nama_tabel2 ON (nama_tabel1.nama_kolom(primary key)=nama_tabel2(primary key));
Contoh :
select tgfaktur, jumlah
     from penjualan p
     JOIN transaksi t ON(p.nofaktur=t.nofaktur)