Exam Preparation Quiz

Question 26 of 75

Complete the T-SQL Statement to Show Student Counts by Registration Type

You work for MDFT Pro, a well-known training agency. You have been asked to analyze the student Registration data in your Microsoft Fabric workspace that contains a warehouse named TrainingWarehouse. The warehouse contains the following data:

Table nameColumn nameData type
StudentStudentIDInt
StudentStudentNameVarchar(128)
RegistrationStudentIDInt
RegistrationRegistrationTypeVarchar(64)
RegistrationStartDateDatetime2

You need to create a T-SQL statement that will denormalize the tables and includes the RegistrationType attribute in the results. The solution must meet the following requirement:

You have the following T-SQL query:

WITH result AS(
    SELECT 
        s.StudentID,
        s.StudentName,
        r.RegistrationType
    FROM Student AS s
    LEFT OUTER JOIN Registration AS r ON r.StudentID = s.StudentID
)
SELECT COUNT(DISTINCT StudentID) AS TotalStudents, RegistrationType
FROM result
GROUP BY RegistrationType
_____________ COUNT(DISTINCT StudentID) > 2

How should you complete the statement?

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about filtering groups in T-SQL:
T-SQL Group Filtering
Next Question