Database-MySQL [3i Infotech Placement]: Sample Questions 129 - 130 of 162

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 129

Edit

Describe in Detail

Essay▾

Will the outputs of the TRUNCATE TABLE EMP and DELETE FROM EMP two commands differ?

Explanation

  • Both will result in deleting all the rows in the table EMP.

TRUNCATE TABLE EMP:

Define Truncate Command
  • This is faster and uses lesser resources.
  • It does not delete the structure of the table.

Syntax:

TRUNCATE TABLE table_name;

DELETE FROM EMP

Define DELETEcommand
  • Delete statement is used to delete rows from a table.
  • To specify rows in the table use the WHERE condition.

Syntax

DELETE FROM table_name [WHERE condition] ;

Question 130

Edit

Describe in Detail

Essay▾

What is meant by query optimization?

Explanation

Process of Query Optimization
  • A query optimizer is a critical database management system (DBMS) component that is analyses Structured Query Language (SQL) queries for efficient execution mechanisms.
  • The query optimizer cannot be accessed directly: queries submitted to database server, and parsed by parser, are passed to the query optimizer.
  • Depending on circumstance, a query optimizer selects different query plans for the same query.
  • For example, when user runs a query that selects half of a table՚s data
    • The user runs the query when the server is heavily tasked.
    • The query optimizer may decide to use a query plan, the query plan calls on the created table indexes to satisfy the query- based on limited resources.
  • The same query run at another time with more resources, the query optimizer could determine that resource limitation is not an issue.
    • Table indexes would not be used- with full table loading to server memory.

Developed by: