count function in oracle SQL



The COUNT function in MySQL is used to return the number of rows that match a specific condition in a table. Here's an example of how to use COUNT in MySQL:

count function in oracle SQL

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:




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:


As you can see, the COUNT function is a powerful tool for counting the number of rows in a table that meets certain criteria.

Post a Comment

Previous Post Next Post