Issue Details (XML | Word | Printable)

Key: DERBY-2239
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jazarine Jamal
Reporter: Tomohito Nakayama
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Example of SelectExpression for GROUP BY clause is mistaken

Created: 13/Jan/07 10:36 AM   Updated: 27/Mar/08 09:36 AM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY2239-ref.diff 2008-01-30 10:34 AM Jazarine Jamal 0.9 kB
Zip Archive Licensed for inclusion in ASF works newref.zip 2008-01-30 10:34 AM Jazarine Jamal 799 kB
Environment: http://db.apache.org/derby/docs/dev/ref/rrefselectexpression.html

Issue & fix info: Patch Available
Resolution Date: 30/Jan/08 01:42 PM


 Description  « Hide
There is next example.

-- List head count of each department,
-- the department number (WORKDEPT), and the average departmental salary (SALARY)
-- for all departments in the EMPLOYEE table.
-- Arrange the result table in ascending order by average departmental salary.
SELECT WORKDEPT, AVG(SALARY)
     FROM EMPLOYEE
     GROUP BY WORKDEPT
     ORDER BY 1

Comment told that head count of each department is listed, but not exaxtly.
I think count(*) is needed here.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tomohito Nakayama added a comment - 13/Jan/07 10:40 AM
I think next description is not correct in the example ....

-- Arrange the result table in ascending order by average departmental salary.

1 is for WORKDEPT and not AVG(SALARY).

Jazarine Jamal added a comment - 28/Jan/08 03:52 PM
I just looked upon this documentation and reproduced it in ij...
I have this proposed changes:


SELECT COUNT(*),WORK_DEPT,AVG(SALARY)
FROM EMPLOYEE
GROUP BY WORK_DEPT
ORDER BY 3;

Please provide feedback on this.

Tomohito Nakayama added a comment - 28/Jan/08 04:08 PM
I think that change is right.

Jazarine Jamal added a comment - 30/Jan/08 10:34 AM
I have made changes to the file trunk/src/ref/rrefselectexpression.dita.

The following lines :

SELECT WORKDEPT, AVG(SALARY)
     FROM EMPLOYEE
     GROUP BY WORKDEPT
     ORDER BY 1

have been replaced with:

SELECT COUNT(*),WORK_DEPT,AVG(SALARY)
     FROM EMPLOYEE
     GROUP BY WORK_DEPT
     ORDER BY 3;

I build the new file with ant html and the resulting html page: rrefselectexpression.html contains the corrected code.

The file newref.zip contains the corrected page. Please have a look at it.

Tomohito Nakayama added a comment - 30/Jan/08 01:10 PM
I checked three kind output of singlepage,multi page and PDF.
There were no problem and I will commit it.


Tomohito Nakayama added a comment - 30/Jan/08 01:14 PM
I committed.

Sending src/ref/rrefselectexpression.dita
Transmitting file data .
Committed revision 616747.

Dyre Tjeldvoll added a comment - 27/Mar/08 09:36 AM
This issue has no fix version, but has been checked in to trunk after the 10.3 branch was cut, and has not been merged to the 10.3 branch (before the last release).
(Some have been checked into trunk after 10.4 was cut and then merged to 10.4).