Skip to content
Question 71 of 95

Q.In SQL, the aggregate function which will display the cardinality of the table is ____. (A) sum() (B) count() (C) avg() (D) sum()

Uttar Pradesh UpmspCBSE Class XII Board 2024MCQ· 1mImportance★★★★★
75% · 71/95 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The count(*) function returns the total number of rows in a table, which is its cardinality.

When we talk about the cardinality of a table in database terminology, we mean the number of rows (or tuples) it contains. It's a fundamental measure of the table's size — how many records exist in that relation. SQL provides a family of aggregate functions that perform calculations across multiple rows and return a single summary value, and understanding which one gives us cardinality is essential for querying databases effectively.

Aggregate functions operate on sets of values from a column (or columns) and collapse them into one result. The most common ones include:

  • sum() — adds up all the values in a numeric column
  • avg() — calculates the arithmetic mean of values in a numeric column
  • count() — counts rows or non-null values
  • max() and min() — find the largest or smallest value

The question asks specifically which function reveals how many rows are in the table. The count(*) function does exactly this: it counts every row in the table, regardless of whether individual columns contain null values or not. The asterisk * tells SQL to count all rows without filtering by any particular column's content. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.