nerdexam
Oracle

1Z0-909 · Question #35

Examine the structure of the emp table: Examine the structure of the emp_vu1 view based on the emp table: Now, examine this statement: mysq1> INSERT INTO emp_vul VALUES ('Alice',20000); What is true…

The correct answer is A. It inserts a row in the emp table. Inserting into a simple, updatable view in MySQL actually writes the data to the underlying base table - in this case, emp - because views do not store data themselves; they are virtual representations of base table data. Option B is wrong because MySQL does allow DML…

SQL Fundamentals

Question

Examine the structure of the emp table:

Examine the structure of the emp_vu1 view based on the emp table:

Now, examine this statement:

mysq1> INSERT INTO emp_vul VALUES ('Alice',20000); What is true about executing the statement?

Exhibits

1Z0-909 question #35 exhibit 1
1Z0-909 question #35 exhibit 2

Options

  • AIt inserts a row in the emp table.
  • BIt returns an error because an insert operation is not allowed on views.
  • CIt inserts a row in the view only.
  • DIt returns an error because the PRIMARY ACCOUNT column is not selected for the view definition.

How the community answered

(25 responses)
  • A
    92% (23)
  • B
    4% (1)
  • D
    4% (1)

Explanation

Inserting into a simple, updatable view in MySQL actually writes the data to the underlying base table - in this case, emp - because views do not store data themselves; they are virtual representations of base table data. Option B is wrong because MySQL does allow DML operations (INSERT, UPDATE, DELETE) on views that meet certain conditions, such as being based on a single table without aggregates or DISTINCT. Option C is wrong because there is no separate storage in a view - any row "inserted" through a view physically lands in the base table. Option D is wrong because if the primary key column (e.g., an auto-increment emp_id) was omitted from the view definition, MySQL can still insert successfully by using the column's default or auto-generated value, so no error occurs.

Memory tip: Think of a view as a window into a table, not a copy - throwing something through the window puts it in the room (the base table), not on the glass.

Topics

#Views#Updatable Views#INSERT operations#DML on Views

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice