SQL distinction between tables and collection-valued columns #91
-
from README.md What exactly is the SQL "distinction between tables and collection-valued columns"?
David |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In SQL, table and column expressions are in different namespaces. Expressions in the This means that there are essentially two languages in SQL (three if you note that the resolution rules are different in an aggregate query). The type system is not unified (e.g. a table does not have a datatype of 'multiset of record' or 'array of record', in fact it doesn't really have a datatype). There are operators and conventions to map between the two languages, for example:
There are plenty more examples. SQL's two-language approach is rather shocking from the perspective of language design, and in my experience users struggle with it. |
Beta Was this translation helpful? Give feedback.
In SQL, table and column expressions are in different namespaces. Expressions in the
FROM
clause see table expressions (e.g.catalog.schema.table
) whereas expressions in theSELECT
clause see column expressions (e.g.tableAlias.column.nestedColumn
).This means that there are essentially two languages in SQL (three if you note that the resolution rules are different in an aggregate query). The type system is not unified (e.g. a table does not have a datatype of 'multiset of record' or 'array of record', in fact it doesn't really have a datatype). There are operators and conventions to map between the two languages, for example: