Here are the links that contain in-depth coverage of the HTSQL query language. Using these reference guides, you can expand the complexity of the queries you write for your home automation projects:
Official HTSQL website: http://htsql.org/
HTSQL tutorial: http://htsql.org/doc/tutorial.html
HTSQL downloads: http://htsql.org/download/
HTSQL Python page: http://pypi.python.org/pypi/HTSQL
HTSQL mailing list: http://lists.htsql.org/mailman/listinfo/htsql-users