Yes, the Zen Cart admin Install SQL Patch tool does automatically insert the DB_PREFIX value correctly in simple SQL statements. Complex joins need to be rewritten to put join syntax on new lines so the parser can insert the prefix properly on joined table names. There are many examples of these in the upgrade .sql files in the zc_install/sql/ folder if you need such to follow.