← Back to context

Comment by remus

7 years ago

If the generated SQL was compatible across a variety of databases and the performance of the SQL was also passable you'd be on to a good thing.

This is a problem I've been thinking about for years. It's possible to write pure ANSI SQL and be compatible across a lot of databases, but to be optimized in different databases it would need to have a target platform to compile to.

I'm really interested in what other developers think about this.

A simple thing would be macros for subqueries

    A := select col_1, col_2, col_3 from table_1
    B := select col_4, col_5, col_6 from table_2 where 2*col_5 > col_4 + col_6
    $A left join $B on table_1.col_1 = table_2.col_5