Kirill Simonov avatar Kirill Simonov committed b98278c

Added another scalar example; removed an example
with a scalar filter in an aggregate expression.

Comments (0)

Files changed (1)

     ORDER BY 1;
 
 
+The number of schools with programs
+-----------------------------------
+
+HTSQL::
+
+    /count(school?exists(program))
+
+SQL::
+
+    SELECT COUNT(TRUE)
+    FROM ad.school AS s
+    WHERE EXISTS(SELECT TRUE
+                 FROM ad.program AS p
+                 WHERE (s.code = p.school));
+
+
 For each school, the number of programs and the number of departments
 ---------------------------------------------------------------------
 
 HTSQL::
 
-    /school{name,count(program),count(department)}
+    /school{name, count(program), count(department)}
 
 SQL::
 
     ORDER BY s.code;
 
 
-For the astronomy department, the number of courses from 100 to 300
--------------------------------------------------------------------
-
-HTSQL::
-
-    /department{name, count(course?number>=100&number<300)}?code='astro'
-
-SQL::
-
-    SELECT d.name, COALESCE(c.cnt, 0)
-    FROM ad.department AS d
-    LEFT OUTER JOIN
-         (SELECT COUNT(TRUE) AS cnt, c.department
-          FROM ad.course AS c
-          WHERE (c.number >= 100) AND (c.number < 300)
-          GROUP BY 2) AS c ON (d.code = c.department)
-    WHERE d.code = 'astro'
-    ORDER BY d.code;
-
-
 For each school, the average number of courses offered by the departments
 -------------------------------------------------------------------------
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.