このコンテンツは選択した言語では利用できません。

14.7. The Select Clause


The select clause picks which objects and properties to return in the query result set. Consider the following:
select mate
from Cat as cat
    inner join cat.mate as mate
Copy to Clipboard Toggle word wrap
The query will select mates of other Cats. You can express this query more compactly as:
select cat.mate from Cat cat
Copy to Clipboard Toggle word wrap
Queries can return properties of any value type including properties of component type:
select cat.name from DomesticCat cat
where cat.name like 'fri%'
Copy to Clipboard Toggle word wrap
select cust.name.firstName from Customer as cust
Copy to Clipboard Toggle word wrap
Queries can return multiple objects and/or properties as an array of type Object[]:
select mother, offspr, mate.name
from DomesticCat as mother
    inner join mother.mate as mate
    left outer join mother.kittens as offspr
Copy to Clipboard Toggle word wrap
Or as a List:
select new list(mother, offspr, mate.name)
from DomesticCat as mother
    inner join mother.mate as mate
    left outer join mother.kittens as offspr
Copy to Clipboard Toggle word wrap
Or - assuming that the class Family has an appropriate constructor - as an actual typesafe Java object:
select new Family(mother, mate, offspr)
from DomesticCat as mother
    join mother.mate as mate
    left join mother.kittens as offspr
Copy to Clipboard Toggle word wrap
You can assign aliases to selected expressions using as:
select max(bodyWeight) as max, min(bodyWeight) as min, count(*) as n
from Cat cat
Copy to Clipboard Toggle word wrap
This is most useful when used together with select new map:
select new map( max(bodyWeight) as max, min(bodyWeight) as min, count(*) as n )
from Cat cat
Copy to Clipboard Toggle word wrap
This query returns a Map from aliases to selected values.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat