SQL - Aggregate FunctionsWhich SQL statement correctly computes the average cost from a table named Inventory?ASELECT AVERAGE(cost) FROM Inventory;BSELECT AVG(cost) FROM Inventory;CSELECT MEAN(cost) FROM Inventory;DSELECT SUM(cost)/COUNT(*) FROM Inventory;Check Answer
Step-by-Step SolutionSolution:Step 1: Identify correct functionSQL uses AVG() to calculate average values.Step 2: Check syntaxSELECT AVG(cost) FROM Inventory; is correct syntax.Step 3: Evaluate other optionsAVERAGE() and MEAN() are invalid SQL functions; SELECT SUM(cost)/COUNT(*) FROM Inventory; calculates average manually but is less efficient.Final Answer:SELECT AVG(cost) FROM Inventory; -> Option BQuick Check:AVG() is standard average function [OK]Quick Trick: Use AVG() to calculate average in SQL [OK]Common Mistakes:MISTAKESUsing non-existent functions like AVERAGE() or MEAN()Trying to manually calculate average instead of using AVG()Syntax errors in function usage
Master "Aggregate Functions" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Joins - Natural join and its risks - Quiz 10hard Advanced Joins - FULL OUTER JOIN behavior - Quiz 8hard Advanced Joins - Join order and performance impact - Quiz 10hard Aggregate Functions - COUNT(*) vs COUNT(column) difference - Quiz 6medium Aggregate Functions - MIN and MAX functions - Quiz 2easy INNER JOIN - Why joins are needed - Quiz 1easy LEFT and RIGHT JOIN - LEFT JOIN preserving all left rows - Quiz 2easy Table Constraints - FOREIGN KEY constraint - Quiz 11easy Table Constraints - UNIQUE constraint - Quiz 3easy Views - Why views are needed - Quiz 14medium