If you're in search of a HTML5 / JavaScript Relational Database option as an alternative to SQLLite, look no further than SequelSphere
SequelSphere is a versatile Javascript library compatible with modern browsers and platforms, utilizing IndexedDB and LocalStorage for data storage based on browser support. It seamlessly integrates with various 3rd party RIA frameworks and includes "change trackers" for efficient data synchronization.
In response to your inquiry regarding complex SELECT capabilities, check out some highlights from SequelSphere's site at: Top 9 Cool SequelSphere Features
An outstanding feature of SequelSphere is its groundbreaking SQL parsing and execution engine. Beyond standard SELECT features and expressions, it excels in handling LEFT, RIGHT, and FULL outer joins. Not only does it manage unlimited nesting of Sub-queries, but also in major clauses like SELECT, FROM, WHERE, JOIN, ON, HAVING, and GROUP BY. Additionally, it supports grouping sets, rollup, cube, and grand-total grouping functions. It proficiently handles complex conditional expressions such as:
(a,b) not in ((1, 2), (3, 4), (select c, d from tab))
Furthermore, the ability to incorporate custom, user-defined functions and third-party tables dynamically adds to its exceptional SQL engine capabilities. Unlike any other, this SQL engine operates entirely in JavaScript across all major browsers and platforms, ensuring rapid speed in parsing, planning, and optimization within sub-milliseconds.
Just for transparency: I'm involved with SequelSphere, and I must say, the product is truly remarkable.