8 "aou".shortname AS "short_name"
10 actor.org_unit AS "aou"
11 INNER JOIN actor.org_unit_type AS "aout"
16 ------------------------------------------------------------
22 "aou".shortname AS "short_name"
24 actor.org_unit AS "aou"
25 INNER JOIN actor.org_unit_type AS "aout"
33 "aou".shortname AS "short_name"
35 actor.org_unit AS "aou"
36 INNER JOIN actor.org_unit_type AS "aout"
41 -----------------------------------------------------------
42 3: Simple query (to be used elsewhere as a subquery)
47 actor.org_unit AS "aou"
51 -------------------------------------------------------------
52 4: SELECTing a subquery
60 actor.org_unit AS "aou"
65 actor.org_unit_type AS "aout";
67 --------------------------------------------------------------
68 5: IN clause with a subquery
73 actor.org_unit_type AS "aout"
79 actor.org_unit AS "aou"
84 ---------------------------------------------------------------
85 6: Subquery in the FROM clause
94 actor.org_unit AS "aou"
99 ----------------------------------------------------------------
100 7: JOINing to a subquery
103 "aou".ou_type AS "goober"
110 actor.org_unit AS "aou"
114 ON "au".id = "aou".ou_type;
116 ----------------------------------------------------------------
122 actor.org_unit_type AS "aout"
128 actor.org_unit AS "aou"
133 ----------------------------------------------------------------
134 9: SELECTing a wild card
139 actor.org_unit AS "aou";
141 ------------------------------------------------------------------
146 "aou".parent_ou AS "parent",
147 "aou".shortname AS "short_name"
149 actor.org_unit AS "aou"
154 --------------------------------------------------------------------
155 11: Looking up table name in IDL
160 actor.org_unit AS "aou";
162 --------------------------------------------------------------------
163 12: numeric bind variable (also works if default value is available)
172 actor.org_unit AS "aou"
176 --------------------------------------------------------------------
177 13: string bind variable (using default value 'BRE' for :shortname)
186 actor.org_unit AS "aou"
188 "aou".shortname = 'BR3';
190 --------------------------------------------------------------------
191 14: IS NULL expression
196 actor.org_unit AS "aou"
198 "aou".parent_ou IS NULL;
200 --------------------------------------------------------------------
201 15: Series expression (chain of ORs)
206 actor.org_unit AS "aou"
208 "aou".parent_ou IS NULL
209 OR "aou".email IS NULL
210 OR "aou".holds_address IS NULL;
212 --------------------------------------------------------------------
218 actor.org_unit AS "aou"
220 "aou".parent_ou IN (1, 3, 6);
222 --------------------------------------------------------------------
227 "aou".name AS "name",
228 upper("aou".name) AS "name"
230 actor.org_unit AS "aou"
232 "aou".parent_ou IN (1, 3, 6);
234 --------------------------------------------------------------------
235 18: Function call with subfield
240 (actor.org_unit_ancestors("aou".id))."name" AS "root_name"
242 actor.org_unit AS "aou"
246 --------------------------------------------------------------------
247 19: BETWEEN expression
252 actor.org_unit AS "aou"
254 "aou".parent_ou BETWEEN 1 AND 4;
256 --------------------------------------------------------------------
257 20: EXTRACT and CURRENT_DATE functions
261 EXTRACT(DOW FROM "au".create_date) AS "create_day",
262 CURRENT_DATE AS "today"
266 --------------------------------------------------------------------
267 21: GROUP BY, with aggregate function last
270 "aou".parent_ou AS "parent",
271 COUNT(1) AS "how_many"
273 actor.org_unit AS "aou"
276 --------------------------------------------------------------------
277 22: GROUP BY, with aggregate function first
280 COUNT(1) AS "how_many",
281 "aou".parent_ou AS "parent"
283 actor.org_unit AS "aou"
286 --------------------------------------------------------------------
287 23: Function in the FROM clause
294 --------------------------------------------------------------------
306 END AS "Branch sequence"
308 actor.org_unit AS "aou";
310 --------------------------------------------------------------------
314 CAST ("aou".id AS TEXT) AS "cast_text"
316 actor.org_unit AS "aou";