Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCEEJBD
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
EJB Certification (OCEEJBD)
question about aggregate function
vitesse wei
Ranch Hand
Posts: 100
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
mock question:
Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int? A. SELECT ANY(r.chairs) FROM Room r B. SELECT NEW Integer(MAX(r.chairs)) FROM Room r C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs) D. SELECT c FROM Chair c WHERE LOCATE (c.type, 'lazyboy') > -1
I think A,D are wrong,given answer is B,why C is wrong?anyone help!
SCJP 5.0<br />SCWCD1.4<br />SCBCD5
Adam Tkaczyk
Greenhorn
Posts: 21
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
C) should be as follows
SELECT r, AVG(r.chairs) FROM Room r group by r having r.chairs > AVG(r.chairs)
You can't have aggregate function inside "where" clause
SCJP5
Let me tell you a story about a man named Jed. He made this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
what is wrong in following EJBQL??
Can you provide answers for some mock questions
question about EJB QL
HQL: How to count green eye kittens?
HFEJB - question page 428 - # 12.
More...