Internship, Day 25 (24 May 2012)
Posted on May 25th, 2012 in computer, in English, in Thai, personal, PHP, programming, SQL | No Comments »

(Photo: Finally got this bun!)
วันนี้ผมก็ทำงานต่อจากเมื่อวานเฉยๆ ครับ ไม่ค่อยมีอะไรมาก แต่สิ่งที่เป็นปัญหาอย่างหนักในการทำงานคือฐานข้อมูลที่ไม่มี Foreign Key เลย แม้ว่าเราจะหาความสัมพันธ์ได้จาก query ต่างๆ ที่มี แต่เป็นเรื่องยากพอสมควรเมื่อเทียบกับการทำฐานข้อมูลให้ชัดเจนตั้งแต่แรก และไม่ทราบว่าตรงไหนเป็นบั๊กเพราะไม่ทราบตั้งแต่แรกว่าโปรแกรมควรจะทำงานอย่างไร ทำให้ผมได้แต่จัดการกับ error message ที่ขึ้นมาชัดๆ เท่านั้น (เปิดจาก log ก็ไม่ได้เพราะเซิร์ฟเวอร์ไม่มีการเก็บ error_log ไว้เลย)
I continued on yesterday’s work and not much else. The big problem exists here again because there are no foreign keys at all in the tables I work with. Even though it’s possible to infer from the other queries, it’s still harder than reading a documented or properly FK’d database. Additionally, I didn’t know which part is bugged because I didn’t know how the program is supposed to work, so I could only fix the real, visible errors. (No logs because the server doesn’t have error_log configured.)
Bonus
By the way, this:
SELECT x,y FROM A,B WHERE A.x = B.y;
is as fast as:
SELECT x,y FROM A INNER JOIN B ON A.x = B.y;
Reference: http://stackoverflow.com/questions/121631/inner-join-vs-where