Help me optimize the following sqls.

Printable View