SQL Functions   «Prev 

SQL Numeric Functions - Exercise

Database: Oracle AI Database 26ai. Write your answer using the table and column names supplied below.

Aggregate functions

Objective: Calculate four summary values over a filtered set of rows.

Assume MyTable has Sales NUMBER and State VARCHAR2(2). Use these sample rows:

SalesState
10CA
20CA
NULLCA
100NY
  1. Write one query returning the minimum, maximum, total, and average Sales for rows whose State is CA.
  2. Use the exact output aliases Minimum, Maximum, Total, and Average.
  3. Predict the output. Explain how the NULL sale affects AVG and why the NY row is excluded.

How to submit: Enter your SQL and reasoning, then select Submit to compare with the model solution. This is a self-assessment: the website does not connect to a database or execute your SQL.