Just one comment on number 10
Elegant SQL often boils down to the same query plan as awkward-looking SQL. Don't be fooled into believing you can make SQL queries run faster by making them more elegant. There is a lot of syntactic sugar in SQL recipes.
Elegant SQL queries might not run faster, but can be debugged faster. Please, format the code.
Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?
How to post data/code on a forum to get the best help: Option 1 / Option 2