Which no normalized reading exists.

SIMULATION
You work for an organization that monitors seismic activity around volcanos. You have a table named GroundSensors. The table stored data collected from seismic sensors. It includes the columns describes in the following table:

The database also contains a scalar value function named NearestMountain that accepts a parameter of type geography and returns the name of the mountain that is nearest to the sensor.
You need to create a query that shows the average of the normalized readings from the sensors for each mountain. The query must meet the following requirements:
Return the average normalized readings named AverageReading.
Return the nearest mountain name named Mountain.
Do not return any other columns.
Exclude sensors for which no normalized reading exists.
Construct the query using the following guidelines:
Use one part names to reference tables, columns and functions. Do not use parentheses unless required.
Define column headings using the AS keyword.
Do not surround object names with square brackets.

Part of the correct Transact-SQL has been provided in the answer area below. Enter the code in the answer area that resolves the problem and meets the stated goals or requirements. You can add code within the code that has been provided as well as below it.

Use the Check Syntax button to verify your work. Any syntax or spelling errors will be reported by line and character position.
Your Response: type here
A. Please see explanation

microsoft-exams

4 thoughts on “Which no normalized reading exists.

  1. Correct answer:
    SELECT AVG(NormalizedReading) AS AverageReading, NearestMountain(Location) AS Mountain
    FROM GroundSensors GROUP BY NearestMountain(Location)
    WHERE NormalizedReading IS NOT NULL

    1. Wrong GROUP BY location. Here is correct version:
      SELECT AVG(NormalizedReading) AS AverageReading, NearestMountain(Location) AS Mountain
      FROM GroundSensors
      WHERE NormalizedReading IS NOT NULL
      GROUP BY NearestMountain(Location)

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.