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

Describe in Detail Essay▾

What is the advantage of specifying WITH GRANT OPTION in the GRANT command?

Edit

Explanation

Define GRANT Statement
  • WITH GRANT option allows the privilege receiver to in future grant the privileges to any other user.
  • It can be used in SQL GRANT command to SQL SQLECT, UPDATE, INSERT, DELETE and other privileges on tables or views.
  • The keyword PUBLIC allows granting SQL privileges to all local user.

Question 149

Describe in Detail Essay▾

What cursor type do you use to retrieve multiple record sets?

Edit

Explanation

Explicit cursor type do use to retrieve multiple record sets.

Explicit cursor:

  • An explicit cursor is defined in the declaration section of the PL/SQL Block.
  • It is created on a SELECT Statement, which returns more than one row.

    Syntax for creating cursor:

    CURSOR cursor_name IS select_statement;

  • cursor_name - A suitable name for the cursor.
  • select_statement - A select query that returns multiple rows.

Question 150

Describe in Detail Essay▾

What is the value of comm and sal after executing the following query if the initial value of sal is 10000?

UPDATE EMP SET SAL = SAL + 1000, COMM = SAL ⚹ 0.1.

Edit

Explanation

  • The select query returns:
    • Select ⚹ from emp where sal = 10000;
    • EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO GENDER
    • 7567 boss clerk 7766 23/02/1983 10000.00 10 FEMALE.
  • Now run update query
    • UPDATE EMP SET SAL = SAL + 1000, COMM = SAL ⚹ 0.1 2 where sal = 10000
  • 1 row updated, thus.
    • Select sal, comm from emp where empno = 7567

sal = 11000

comm = 1000