Petra Barus

I don’t like explaining long story in Twitter, so here it is.

In some programming forum, some stranger sent a private message to me.

Tanya query, maaf klo udah sering nanya..


mau tanya dong tentang query :

misal di tabel A , ane ada data seperti ini :

id_dok, nik, nama, unit,tahun, bulan, status
1,111000,Andi, Unit A, 2011,12,Approve,
2,111001,Fajar,Unit B,2011,12,Approve,
3,111002,Andrie, Unit A, 2012,1,Approve,

terus di tabel B, ane punya data gini :

id,nik,nama
1,111000,Andi, Unit A,
2,111001,Fajar,Unit B,
3.111002,Andrie, Unit A,
4.111003,Fachri, Unit A

nah pingin query jika data yang di filter tu tahun,bulan,unit misal user isi inputan tahun = 2011, bulan=12, unit = Unit A maka akan tampil gini :

nik,nama,unit,tahun,bulan,status
111000,Andi, Unit A, 2011,12,Approve
111002,Andrie, Unit A, null,null,null
111003,Fachri, Unit A, null,null,null


nah misal jika user isi inputan tahun = 2012, bulan = 1, dan unit = Unit A,
maka yang akan tampil sbb:

nik ,nama,unit,tahun,bulan,status
111000,Andi, Unit A, null,null,null
111002,Andrie, Unit A, 2012, l, Approve
111003,Fachri, Unit A, null,null,null

gmana ya gan query nya ????
mohon pencerahannya gan …

Judging from the tables’ structures, this question, and all questions he/she had asked me before, I was quite sure this person was not that good (no offense). The tables’ structures were too redundant and the purpose of the redundancy was not clear either. And the query he/she asked was also too simple to answer.

And I told him/her to read about Database Normalization. And he/she replied

masalahnya di kantor saya kerja, databasenya gak normal mas „, jadi bingung juga„ kata atasan saya, database gpp gak normal, atau masih redudansi, alnya harddisk kan murah, jadi biar aja „,

tolong di balas dulu mas, gmana cara query yang saya tanya itu „, saya udah coba pake left join tapi tetap aja gak bisa „„

The reply was a little bit annoying. And I just replied back.

tanya aja sama atasannya kalo gitu

PS: If you are curious„ I blocked him/her right after that reply.


To Tumblr, Love Metalab