Suppose you have a table named students with the following data:
To count the number of rows in the students table, you can use the following query:
SELECT COUNT(*) AS total_students
FROM students;
The COUNT(*) function will return the total number of rows in the students table. The result of this query would be:
YOU MAY ALSO LIKE:- TRANSLATE function in Oracle SQL with example
To count the number of male students, you can use the following query:
SELECT COUNT(*) AS male_students
FROM students
WHERE gender = 'Male';
The COUNT(*) function will return the number of rows where the gender column is 'Male'. The result of this query would be:
Tags:
ORACLE SQL