Mengenal lebih dekat MySQL Query

Standard

Here’s my situation there’s a form to query all instructor list based some criteria :
– class periode – program
– category
– class name
– Include Instructors not assigned to any classes

final result must have this format (name, home phone, email) what schema do we have ?
instructor has one address (instructor_addresses)
instructor has many contact (instructor_contact_infos)
instructor has many class (catalog_class_instructor)

class table = catalog_classes class has one periode (periode_id)
class has (program, category) join on table catalog_class_program_category

how i m gonna accomplish this using single query send from PHP ? after an hour or so here’s the final query

optimasi mysql query

0.08 second on my mac for 2k records? not bad

green commentd line : dynamicaly insert / remove before send to mysql