• Introduction
  • 1. How to Retrieve Data From a Single Table
  • 2. How to Retrieve Data from Multiple Tables
  • 3. Using Functions
  • 4. How to Insert, Update, Delete Data in Tables
  • 5. Summary Queries and Aggregate Functions
  • 6. Working With Subqueries
  • 7. SQL Views
  • 8. SQL Indexes
  • Glossary
  • Index
  • Download
  • Translations
  • 5.6

    COUNT(column_name) and COUNT(*)

    How They Are Different

    COUNT(column_name) and COUNT(*)

    • COUNT(*) is the only aggregate function that counts rows with null values.
    • When you specify a count based on a specific column, null values will not be counted.

    Code Sample:

    USE bike;
    SELECT COUNT(phone), COUNT(*) 



    This content is provided to you freely by BYU-I Books.

    Access it online or download it at https://books.byui.edu/learning_mysql/the_difference_betwe.