SQL-J Language Reference
Page 68 of 121

COUNT(*)

COUNT(*) is an aggregate function that counts the number of rows accessed. No NULLs or duplicates are eliminated. COUNT(*) does not operate on an expression.

Syntax

COUNT(*)

The resulting data type is LONGINT.

COUNT(*) Examples

-- Count the number of rows in the Flights table
SELECT COUNT(*)
FROM Flights

-- Evaluate an expression only if there are
-- rows in the HotelBookings table
SELECT *
FROM HotelAvailability
WHERE EXISTS
   (SELECT COUNT(*)
   FROM HotelBookings)