db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-2238) Example of ScalarSubquery in Derby Reference Manual is not ScalarSubquery
Date Mon, 12 Jan 2015 18:37:35 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14273912#comment-14273912
] 

Mamta A. Satoor commented on DERBY-2238:
----------------------------------------

There are two examples on the page mentioned by Tomohito. They are as follows
Examples
-- avg always returns a single value, so the subquery is
-- a scalarSubquery
SELECT NAME, COMM
  FROM STAFF
  WHERE EXISTS
    (SELECT AVG(BONUS + 800)
       FROM EMPLOYEE
       WHERE COMM < 5000
       AND EMPLOYEE.LASTNAME = UPPER(STAFF.NAME)
)
-- Introduce a way of "generating" new data values,
-- using a query which selects from a VALUES clause (which is an 
-- alternate form of a fullselect). 
-- This query shows how a table can be derived called "X" having 
-- 2 columns "R1" and "R2" and 1 row of data.
SELECT R1,R2 
	FROM (VALUES('GROUP 1','GROUP 2')) AS X(R1,R2)


Of this, I believe the first example is correct since that is an example of scalar subquery
being used in the WHERE clause. But Kim is correct about the second example being wrong as
it is not as example of scalar query and there is no subquery in that example. We should delete
the second example. Thanks.

> Example of ScalarSubquery in Derby Reference Manual is not ScalarSubquery 
> --------------------------------------------------------------------------
>
>                 Key: DERBY-2238
>                 URL: https://issues.apache.org/jira/browse/DERBY-2238
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 10.2.2.0
>         Environment: http://db.apache.org/derby/docs/dev/ref/rrefscalarsubquery.html
>            Reporter: Tomohito Nakayama
>              Labels: derby_triage10_11
>
> In the page, I found next example.
> -- Introduce a way of "generating" new data values,
> -- using a query which selects from a VALUES clause (which is an
> -- alternate form of a fullselect).
> -- This query shows how a table can be derived called "X" having
> -- 2 columns "R1" and "R2" and 1 row of data.
> SELECT R1,R2
> FROM (VALUES('GROUP 1','GROUP 2')) AS X(R1,R2)
> I think this is not ScalarSubquery because the result have two columns.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message