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 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:
Include the average normalized readings and nearest mountain name.
Exclude sensors for which no normalized reading exists.
Exclude those sensors with value of zero for tremor.
Construct the query using the following guidelines:
Use one part names to reference tables, columns and functions. Do not use parentheses unless required.
Do not use aliases for column names and table names.
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

6 thoughts on “Which no normalized reading exists.

  1. Correct answer:
    SELECT AVG(NormalizedReadings), NearestMountain(SensorID)
    FROM GroundSensors
    WHERE NormalizedReadings IS NOT NULL AND Tremor0
    GROUP BY NearestMountain(SensorID)

    1. 1. … AND Tremor0 …
      should be: AND Tremor = 0
      2. … NormalizedReadings IS NOT NULL …
      I am not sure but maybe this is wrong. AVG function ignores NULLs anyway. We need to give average readings for “each mountain”, so for some mountains we should allow average readings to be NULL.

  2. Correct Answer:

    SELECT AVG(NormalizedReading), NearestMountain(SensorID)
    FROM GroundSensors
    WHERE TREMOR IS 0 AND NormalizedReading IS NOT NULL
    GROUP BY NearestMountain(SensorID)

Leave a Reply

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


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