Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
<table primary> ::=
|
...
|
| <derived table> [ AS ] <correlation name>
|
[ <left paren> <derived column list> <right paren> ]
|
...
|
|
<derived column list> ::= <column name list>
|
|
<column name list> ::=
|
<column name> [ { <comma> <column name> }... ]
|
SQL Standard says that with the derived table name an optional list of column names used in this derived table can also be specified. This feature is not implemented in MariaDB.
The usage of this feature:
SELECT *
|
FROM
|
(
|
SELECT MAX(a), b
|
FROM t1
|
GROUP BY b
|
) AS tab(max_a, b);
|
The most interesting case of using this feature will be with the derived table defined with a table value constructor. In this example there is no possibility to come at 'tab' columns directly.
SELECT *
|
FROM
|
(
|
VALUES ((1,1),(2,2))
|
) AS tab;
|
Using the suggested feature it becomes possible:
SELECT *
|
FROM
|
(
|
VALUES ((1,1),(2,2))
|
) AS tab(a,b)
|
SELECT a FROM tab;
|