CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Database Management
A table EMP has 6 rows with salaries 20000, 30000, 30000, 40000, 50000 and NULL. Which of the following statements about the results is correct?
COUNT(*) returns 6 and COUNT(salary) returns 5. COUNT(*) counts every row including those with NULL, whereas COUNT on a column skips NULL values. COUNT(DISTINCT salary) would return 4 because duplicates and NULL are ignored.
- ACOUNT(*) returns 6 and COUNT(salary) returns 5Correct
- BCOUNT(*) returns 5 and COUNT(salary) returns 5
- CCOUNT(*) returns 6 and COUNT(salary) returns 6
- DCOUNT(DISTINCT salary) returns 5
Explanation
COUNT(*) counts all rows, giving 6. COUNT(salary) ignores NULLs, giving 5. COUNT(DISTINCT salary) ignores NULL and duplicates, giving 20000, 30000, 40000, 50000, which is 4, so the last option is wrong.
Did you get it right without looking?
One question tells you little. A timed set on Database Management shows your real accuracy, how long you take and where you lose marks.
More Database Management questions
- A bank's database administrator runs the statement GRANT SELECT ON customer TO audit_team. Which category of SQL sub-language does this stat…
- A DBA ensures that changing the way data files are stored on disk does not require rewriting the application programs that use the data. Thi…
- While designing a database for a company's statutory registers, a designer represents 'Director' as a rectangle and 'Director ID' as an oval…
- A Mumbai-based fintech firm stores customer records in a table where the PAN, name and city appear along with a column 'phone_numbers' holdi…
- A retail company in Pune copies sales, inventory and customer data from several operational systems into one central repository. The data is…
- In the ETL process used to populate a data warehouse, a bank standardises date formats, removes duplicate customer records and converts all …