If you ever want to conditionally count the number of times a particular condition occurs in SQL, you can do it in Oracle using the case and count functions. Here's a simple example which counts the number of males/females stored in PS_PERSONAL_DATA.