Tech Junkie Blog - Real World Tutorials, Happy Coding!: SQL: COUNT() Aggregate Function

Thursday, August 12, 2021

SQL: COUNT() Aggregate Function

The COUNT() function returns the number of rows in the specified table. There are two ways you can use COUNT(), which are the following:

  1. COUNT(*) count all the rows in the table including
  2. COUNT(column) return all the rows that contains value for the column, excluding the columns with null value

SELECT COUNT(*) AS NumberOfRows
FROM Customers











The query above returns the number of rows in the Customers table

SELECT COUNT(Region) AS NumberOfRows
FROM Customers

The query above counts the number of rows for the column "Region" that are not NULL






3 comments:


  1. Many online resources are available for learning new skills, making it easier for individuals to improve themselves at their own pace. These platforms often provide diverse courses that cater to different interests and expertise levels. For instance, you can find tutorials on various topics, from programming to art, which can be accessed anytime and anywhere. If you're interested in exploring more, visit [1] for additional information. Embracing these opportunities can significantly enhance personal and professional growth.

    ReplyDelete

Search This Blog