Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.

The query Strings that are included in the docs, and are parsed and run by ObjectSelectParsedTest

tag::filterOrderLimit[]
from Artist where name like 'A%' order by dateOfBirth desc, name asc insensitive limit 10 offset 20
end::filterOrderLimit[]

tag::outerJoin[]
from Artist where paintings+ = null
end::outerJoin[]

tag::splitJoins[]
from Artist where paintings#p1.title = 'P1' and paintings#p2.title = 'P2'
end::splitJoins[]

tag::columns[]
select name, dateOfBirth from Artist order by name
end::columns[]

tag::column[]
select distinct gallery.name from Painting
end::column[]

tag::columnExpressions[]
select upper(name) as upperName, length(trim(name)) as nameLength from Artist
end::columnExpressions[]

tag::aggregates[]
select artist.name, sum(estimatedPrice), count(*)
from Painting
having sum(estimatedPrice) > $min
order by artist.name
end::aggregates[]

tag::self[]
select self, count(paintings+) from Artist order by count(paintings+) desc
end::self[]

tag::toOne[]
select title, artist, gallery from Painting
end::toOne[]

tag::toMany[]
select name, paintings from Artist
end::toMany[]

tag::exists[]
from Artist where exists (
    from Painting where artist = enclosing(self) and estimatedPrice > $price)
end::exists[]

tag::nestedSelects[]
tag::in[]
from Painting where artist.name in (select name from Artist where dateOfBirth < $date)
end::in[]

tag::all[]
from Painting where estimatedPrice > all (select estimatedPrice from Painting where title = 'P2')
end::all[]

tag::any[]
from Painting where estimatedPrice = any (select max(estimatedPrice) from Painting)
end::any[]
end::nestedSelects[]

tag::dbRoot[]
from db:ARTIST where NAME like 'A%' order by ID desc
end::dbRoot[]

tag::prefetch[]
from Artist where name = $name prefetch paintings joint, paintings.gallery
end::prefetch[]
