Which DELETE statement is valid?

Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:

Which DELETE statement is valid?

Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:

Which DELETE statement is valid?

A.
DELETE FROM employees
WHERE employee_id = (SELECT employee_id
FROM employees);
‘=’ is use in the statement and sub query will return more than one row.
Error Ora-01427: single-row sub query returns more than one row.
SELECT *
FROM emp_dept_vu;

B.
DELETE * FROM employees
WHERE employee_id = (SELECT employee_id
FROM new_employees);
Incorrect DELETE statement
SELECT department_id, SUM(salary)
FROM emp_dept_vu
GROUP BY department_id;

C.
DELETE FROM employees
WHERE employee_id IN(SELECT employee_id
FROM new_employees
WHERE name = ‘Carrey’);
SELECT department_id, job_id, AVG(salary)
FROM emp_dept_vu
GROUP BY department_id, job_id;

D.
DELETE * FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE last_name = ‘Carrey’);
Incorrect DELETE statement
Refer: Introduction to Oracle9i: SQL, Oracle University Student Guide, Manipulating Data, p. 8-19
QUESTION 174
Examine the structure of the EMP_DEPT_VU view:

Which SQL statement produces an error?
SELECT job_id, SUM(salary)
FROM emp_dept_vu
WHERE department_id IN (10,20)
GROUP BY job_id
HAVING SUM(salary) > 20000;

A.
DELETE FROM employees
WHERE employee_id = (SELECT employee_id
FROM employees);
‘=’ is use in the statement and sub query will return more than one row.
Error Ora-01427: single-row sub query returns more than one row.
SELECT *
FROM emp_dept_vu;

B.
DELETE * FROM employees
WHERE employee_id = (SELECT employee_id
FROM new_employees);
Incorrect DELETE statement
SELECT department_id, SUM(salary)
FROM emp_dept_vu
GROUP BY department_id;

D.
DELETE * FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE last_name = ‘Carrey’);
Incorrect DELETE statement
Refer: Introduction to Oracle9i: SQL, Oracle University Student Guide, Manipulating Data, p. 8-19
QUESTION 174
Examine the structure of the EMP_DEPT_VU view:

Which SQL statement produces an error?
SELECT job_id, SUM(salary)
FROM emp_dept_vu
WHERE department_id IN (10,20)
GROUP BY job_id
HAVING SUM(salary) > 20000;

A.
DELETE FROM employees
WHERE employee_id = (SELECT employee_id
FROM employees);
‘=’ is use in the statement and sub query will return more than one row.
Error Ora-01427: single-row sub query returns more than one row.
SELECT *
FROM emp_dept_vu;

B.
DELETE * FROM employees
WHERE employee_id = (SELECT employee_id
FROM new_employees);
Incorrect DELETE statement
SELECT department_id, SUM(salary)
FROM emp_dept_vu
GROUP BY department_id;

C.
DELETE FROM employees
WHERE employee_id IN(SELECT employee_id
FROM new_employees
WHERE name = ‘Carrey’);
SELECT department_id, job_id, AVG(salary)
FROM emp_dept_vu
GROUP BY department_id, job_id;

D.
DELETE * FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE last_name = ‘Carrey’);
Incorrect DELETE statement
Refer: Introduction to Oracle9i: SQL, Oracle University Student Guide, Manipulating Data, p. 8-19
QUESTION 174
Examine the structure of the EMP_DEPT_VU view:

Which SQL statement produces an error?
SELECT job_id, SUM(salary)
FROM emp_dept_vu
WHERE department_id IN (10,20)
GROUP BY job_id
HAVING SUM(salary) > 20000;

E.
None of the statements produce an error; all are valid.

Explanation:

The correct syntax for DELETE statement
DELETE [ FROM ] table
[ WHERE condition ];
Incorrect Answers :

None of the statements produce an error.
Incorrect answer:
AStatement will not cause error

BStatement will not cause error
CStatement will not cause error
DStatement will not cause error



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Jason

Jason

what’s happen to this question ?

Gabriel K

Gabriel K

It was mistreated by its spouse and got sick…

Ramesh

Ramesh

Which DELETE statement is valid?

a)DELETE FROM employees
WHERE employee_id = (SELECT employee_id
FROM employees);

b) DELETE * FROM employees
WHERE employee_id = (SELECT employee_id
FROM new_employees);

c)DELETE FROM employees
WHERE employee_id IN(SELECT employee_id
FROM new_employees
WHERE name = ‘Carrey’);

d) DELETE * FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE last_name = ‘Carrey’);

answer is c

question Which SQL statement produces an error?

a)SELECT *
FROM emp_dept_vu

b)SELECT department_id, SUM(salary)
FROM emp_dept_vu
GROUP BY department_id;

c)SELECT department_id, job_id, AVG(salary)
FROM emp_dept_vu
GROUP BY department_id, job_id;

d)None of the statements produce an error; all are valid.

answer is d

Gabriel K

Gabriel K

Thanks!