SóProvas


ID
943285
Banca
CESPE / CEBRASPE
Órgão
INPI
Ano
2013
Provas
Disciplina
Banco de Dados
Assuntos

A respeito das características gerais do MySql 5 e do Oracle 11g, julgue os itens que se seguem.

Caso a sintaxe INSERT INTO nome_da_views SELECT * FROM tabela1 fosse executada, seria gerado erro tanto no MySql quanto no Oracle, uma vez que é impossível realizar inserção de dados em views nesses dois SGBDs.

Alternativas
Comentários
  • Tanto no MySql quanto no Oracle é possível inserir dados em uma view, salvo algumas exceções que estão descritas aqui (http://dev.mysql.com/doc/refman/5.1/en/view-updatability.html) e aqui (http://docs.oracle.com/cd/E17952_01/refman-5.1-en/view-updatability.html)

  • A view is not updatable if it contains any of the following:

    Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)

    DISTINCT

    GROUP BY

    HAVING

    UNION or UNION ALL

    Subquery in the select list

    Certain joins (see additional join discussion later in this section)

    Nonupdatable view in the FROM clause

    A subquery in the WHERE clause that refers to a table in the FROM clause

    Refers only to literal values (in this case, there is no underlying table to update)

    Uses ALGORITHM = TEMPTABLE (use of a temporary table always makes a view nonupdatable)

    Multiple references to any column of a base table.

    With respect to insertability (being updatable with INSERT statements), an updatable view is insertable if it also satisfies these additional requirements for the view columns:

    There must be no duplicate view column names.

    The view must contain all columns in the base table that do not have a default value.

    The view columns must be simple column references and not derived columns. A derived column is one that is not a simple column reference but is derived from an expression.