Which clause in the following program is incorrect? proc sql; select sex,mean(weight) as avgweight from company.employees company.health where employees.id=health.id group by sex;

  1. SELECT

  2. FROM

  3. WHERE

  4. GROUP BY


Correct Option: B

AI Explanation

To answer this question, we need to understand the structure and syntax of a SQL query. Let's go through each clause in the given program to identify the incorrect clause:

A. SELECT - This clause is used to specify the columns that you want to retrieve from the database. In the given program, the SELECT clause is correctly used to select the columns "sex" and "mean(weight) as avgweight".

B. FROM - This clause is used to specify the table or tables from which you want to retrieve data. In the given program, the FROM clause is used to specify the tables "company.employees" and "company.health".

C. WHERE - This clause is used to specify the conditions that must be met for the rows to be included in the result set. In the given program, there is no issue with the WHERE clause.

D. GROUP BY - This clause is used to group the rows in the result set based on one or more columns. In the given program, the GROUP BY clause is correctly used to group the rows by the "sex" column.

Based on the analysis, the incorrect clause in the given program is the FROM clause (option B). The correct answer is B.

Find more quizzes: