SóProvas


ID
2568103
Banca
FCC
Órgão
TRF - 5ª REGIÃO
Ano
2017
Provas
Disciplina
Banco de Dados
Assuntos

Após constatar que todos os dados em uma tabela estavam incorretos, foi solicitado ao Técnico em Informática para limpar os registros desta tabela mantendo sua estrutura, para que os dados corretos fossem posteriormente inseridos. Para realizar este trabalho o Técnico terá que utilizar a instrução SQL

Alternativas
Comentários
  • O comando TRUNCATE TABLE remove todas as linhas de uma tabela sem registrar as exclusões de linhas individuais.
    TRUNCATE TABLE é como a instrução DELETE, porém sem usar a cláusula WHERE. Portanto, é usada para apagar completamente o conteúdo de uma tabela no MySQL.
    Entretanto, TRUNCATE TABLE é mais rápida e utiliza menos recursos de sistema e log de transações.

  • é DELETE FROM e não DELETE TABLE, portanto só restou o comando TRUNCATE TABLE.

  • SQL TRUNCATE TABLE

    The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.

    Fonte: https://www.w3schools.com/sql/sql_drop_table.asp

    []'s

    Robgol

     

  • Delete All Records

    It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:

     

    DELETE FROM table_name;

    or:

    DELETE * FROM table_name;

  • Letra E

     

    The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.

    Syntax
    "TRUNCATE TABLE table_name";

    https://www.w3schools.com/sql/sql_drop_table.asp

     

    Delete All Records
    It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:
    "DELETE FROM table_name";
    or:
    "DELETE * FROM table_name";

    https://www.w3schools.com/sql/sql_delete.asp

  • O técnico deve manter a estrutura da tabela intacta, portanto, em teoria, utilizaria um comando DML. Contudo, há um comando DDL especial que tem um comportamento que pode até parecer com DML, mas não o é.

    O TRUNCATE TABLE irá remover todos os registros de uma tabela, assim como faria um DELETE FROM <tabela>. Esses dois comandos possuem algumas diferenças no seu funcionamento, mas, em geral, ambos atingem o objetivo de remover os registros sem alterar a estrutura do objeto.

    Dentre as alternativas postas, veja que somente a alternativa E diz respeito a um desses comandos, sendo assim a nossa resposta.

    Gabarito: E