> I would have described SQL as statically typed because columns are given a type when created.
Both statically and dynamically is a misnomer because it's akin to something more in-between - like a dynamic language which can create, say, an empty list and declare it can only contain integers.
Just quickly though - I believe static typing helps productivity, because you don't have wait for some edge case in your program (in this case infrequently invoked query, since SQL is often embedded in other language) to fail. There are other benefits, like Quickcheck.
I think better term (which would explain the distinction between schema creation and query compilation) would be static typechecking of queries against the schema.
> The issue arises with multiple tables
In general, SQL is quite adhoc in what it lets you do, and anything more complicated you need to resolve with code generation (for example running same query over different tables). It's very hard to reuse SQL code. That's ugly, and functional languages offer a better solution - high-order functions. I think what I really want is to deal with schema (and other things, such as result set) as first-class types.
I think the language should be functional, but also total (every function will finish, no recursion allowed), to make it easy for compilers (query engines).