Review of SQL DML
Review of SQL DML
Eine r ichtige Antwort wird mit einem Stern (*) markiert. Section 1 (Alle Fragen in diesem Abschnitt beantworten) 1. Is it possible to insert more than one row at a time us ing an INSERT statement with a VALUES clause? Zum Review markieren (1) Punkte 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 th e rows with commas. No, there is no such thing as INSERT ... VALUES.
Correct 2. _______ statement. (1) Punkte MODIFY INSERT ALTER UPDATE (*) To modify an existing row in a table, you can use the _ Zum Review markieren
Correct 3. What would be the result of the following statement: DE LETE employees; Zum Review markieren (1) Punkte 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.
Correct 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.sala ry, ....); Zum Review markieren (1) Punkte 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 tabl e. (*) Nothing is wrong, the statement will execute correctly.
Correct 5. When inserting a row into a table, the VALUES clause mu st include a value for every column of the table. True or False? Zum Rev iew markieren (1) Punkte Richtig Falsch (*)
DELETE from employees WHERE salary > (SELECT MAX(salary) FROM employees); Zum Review markieren (1) Punkte 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. (*)
Correct 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? Zum Review markieren (1) Punkte Richtig Falsch (*)
Correct 8. You want to modify existing rows in a table. Which of t he following are NOT needed in your SQL statement? (Choose two). Zum Rev iew markieren (1) Punkte (Alle richtigen Antworten whlen) 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. (*)