Database-MySQL [3i Infotech Placement]: Sample Questions 103 - 105 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 103

Describe in Detail Essay▾

What command is used to create a table by copying the structure of another table?

Edit

Explanation

Define Create Table as Select
  • CREATE TABLE … . AS SELECT command creates a table by copying the structure of another table.
  • If WHERE clause of the SELECT command contains a FALSE statement- the statement only copies structure:

    CREATE TABLE NEWTABLE AS SELECT ⚹ FROM EXISTING TABLE WHERE 1 = 2;

  • The where condition is true, then all the rows satisfying the condition will be copied to the new table.
  • SQL SELECT statement retrieves data from a table in the database.
  • Query may retrieve information from specified columns or from all rows in the table.

Question 104

Write in Short Short Answer▾

What does the following query do?

SELECT SAL + NVL (COMM, 0) FROM EMP.

Edit

Explanation

  • This displays the total salary of all employees.
  • Null values in the commission column [NVL (COMM, 0) ] will replaced by 0 and added to salary.

Question 105

Write in Short Short Answer▾

What is a view? How it is related to data independence?

Edit

Explanation

  • A view may be thought of as a virtual table, that is, a table that does not really exist in its own right but is instead derived from one or more underlying base table.
  • In other words, there is no stored file that direct represents the view instead a definition of view is stored in data dictionary.
  • Growth and restructuring of base tables is not reflected in views.
  • Thus the view can insulate users from the effects of restructuring and growth in the database.
  • Hence accounts for logical data independence.