I have a table as shown below
Col1 Col2 Col3
* $ *
$ * *
# * $
% * *
* * $
* @ $
I want a sql query to count the number of stars(*) present in the table.
one option is to write the query in the following manner.
select ((select count(*) from star_table where col1='*') +
(select count(*) from star_table where col2='*') +
(select count(*) from star_table where col3='*')) as count from dual.
I want to know if there is an alternative way of writing the query to get the same result.
UPDATE: If your columns contains on character length strings, you can:
You asked for this 🙂