Home › GATE CSE › computerscience › Database Management Systems › In a 100-row `employees` table where 20 rows hav…
In a 100-row `employees` table where 20 rows have `salary` NULL,
ACOUNT(*) = 100 and COUNT(salary) = 80
BCOUNT(*) = 80 and COUNT(salary) = 100
CCOUNT(*) = 100 and COUNT(salary) = 100
Dboth return NULL because of the NULL salaries
Answer & Solution
Correct answer: A. COUNT(*) = 100 and COUNT(salary) = 80
COUNT(*) counts rows, regardless of NULL values inside them, so all 100 rows are counted. COUNT(salary) counts rows where the salary column is NOT NULL, so it skips the 20 NULL-salary rows and returns 80. This pair is a common GATE trap.
Related questions
The main reasons production DBMSs avoid shadow paging in favour of WAL are that shadow pagWhat is the purpose of a Compensation Log Record (CLR) in ARIES?ARIES recovery is structured as exactlyFuzzy checkpoints differ from naive checkpoints byIn standard log-based recovery, the order of operations isAfter a crash, with checkpointing, the recovery system scans the logA complete log record for a write operation includesPer WAL semantics, a transaction is officially committed at the moment