Which statement about views are true?

  1. A view can be created as read only.

  2. A view cannot have an ORDER BY clause in the SELECT statement.

  3. A view cannot be created with a GROUP BY clause in the SELECT statement.

  4. A view must have aliases defined for the column names in the SELECT statement.


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A view can be created as read-only - This option is correct. A view can be created with the READ ONLY clause, which restricts any modifications to the underlying data. Users can only query the view and cannot perform any DML (Data Manipulation Language) operations on it.

Option B) A view cannot have an ORDER BY clause in the SELECT statement - This option is incorrect. A view can have an ORDER BY clause in the SELECT statement. The ORDER BY clause is used to sort the result set returned by the view.

Option C) A view cannot be created with a GROUP BY clause in the SELECT statement - This option is incorrect. A view can be created with a GROUP BY clause in the SELECT statement. The GROUP BY clause is used to group rows based on specified columns and perform aggregate functions on each group.

Option D) A view must have aliases defined for the column names in the SELECT statement - This option is incorrect. While it is a good practice to provide aliases for column names in a view, it is not mandatory. If aliases are not provided, the column names in the view will inherit the column names from the underlying tables.

The correct answer is Option A) A view can be created as read-only. This option is correct because a view can be explicitly created as read-only, preventing any modifications to the underlying data.

Find more quizzes: