Counting the Rows in All Tables
The first example shows you how to edit your spool file to remove irrelevant lines in your generated code, thus allowing your SQL statement to run without being tarnished with syntax errors.
Note
Take note of the editing technique used in this example because we will not show the step in the rest of today's examples. We assume that you know the basic syntax of SQL statements by now. In addition, you may choose to edit your spool file in various ways.
Start by recalling the function to count all rows in a table: COUNT(*). You already know how to select a count on all rows in a single table—for example,
SELECT COUNT(*) FROM TBL1; COUNT(*) -------- 29
That technique is handy, but suppose you want to get a row count ...
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.