Pagini

marți, 12 martie 2013

Section 3 Lesson 1: Review of SQL DML


Review of SQL DML

Section 1
   
  1.  When inserting a row into a table, the VALUES clause must include a value for every column of the table. True or False?  (1) Points
   
    True
    False (*)
   
  2.  What would be the result of the following statement: DELETE employees;  (1) Points
   
    Nothing, no data will be changed.
    All rows in the employees table will be deleted. (*)
    The statement will fail because it contains a syntax error.
    The row with EMPOYEE_ID=100 will be deleted.

  3.  Is it possible to insert more than one row at a time using an INSERT statement with a VALUES clause?  (1) Points
   
    No, you can only create one row at a time when using the VALUES clause. (*)
    Yes, you can list as many rows as you want, just remember to separate the rows with commas.
    No, there is no such thing as INSERT ... VALUES.
   
  4.  What is wrong with the following statement?
MERGE INTO emps e
USING new_emps ne
ON (e.employee_id = ne.employee_id)
WHEN MATCHED
THEN UPDATE SET ne.salary = e.salary
WHEN NOT MATCHED
THEN INSERT VALUES
(ne.employee_id, ne.first_name, ne.last_name, .... ne.salary, ....);
(1) Points
   
    The UPDATE clause must include the target table name: UPDATE emps SET ....
    The INSERT clause must include a column list as well as a list of column values.
    The SET clause is trying to update the source table from the target table. (*)
    Nothing is wrong, the statement will execute correctly.
   
  5.  You want to modify existing rows in a table. Which of the following are NOT needed in your SQL statement? (Choose two).  (1) Points
   
    A MODIFY clause.
    An UPDATE clause.
    The name of the table.
    The name of the column(s) you want to modify.
    A new value for the column you want to modify (this can be an expression or a subquery).
    A WHERE clause, (*)
   
  6.  What is wrong with the following statement?
DELETE from employees WHERE salary > (SELECT MAX(salary) FROM employees);
(1) Points
   
    You cannot code a subquery inside a DELETE statement.
    You cannot use inequality operators such as "<" and ">" inside a DELETE statement.
    Nothing is wrong, the statement will execute correctly. (*)
   
  7.  Look at this SQL statement:
MERGE INTO old_trans ot
USING new_trans nt
ON (ot.trans_id = nt.trans_id) .... ;

OLD_TRANS is the source table and NEW_TRANS is the target table. True or false?
(1) Points
   
    True
    False (*)
   
  8.  To modify an existing row in a table, you can use the ________ statement.  (1) Points
   
    MODIFY
    INSERT
    ALTER
    UPDATE (*)

Niciun comentariu:

Trimiteți un comentariu