Which SQL statement would you execute to accomplish the task?

View the exhibit and examine the descriptions of the DEPT and LOCATIONS tables.


You want to update the CITY column of the DEPT table for all the rows with the corresponding value in the CITY column of the LOCATIONS table for each department.
Which SQL statement would you execute to accomplish the task?
A. UPDATE dept d
SET city = ALL (SELECT city
FROM locations l
WHERE d.location_id = l.location_id);
B. UPDATE dept d
SET city = (SELECT city
FROM locations l)
WHERE d.location_id = l.location_id;
C. UPDATE dept d
SET city = ANY (SELECT city
FROM locations l)
D. UPDATE dept d
SET city = (SELECT city
FROM locations l
WHERE d.location_id = l.location_id);

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which SQL statement would you execute to accomplish the task?

  1. A. UPDATE dept d
    SET city = ALL (SELECT city
    FROM locations l
    WHERE d.location_id = l.location_id);
    (FALSE)We don’t use ALL or ANY on SET the UPDATE

    B. UPDATE dept d
    SET city = (SELECT city
    FROM locations l)
    WHERE d.location_id = l.location_id;
    (FALSE)The WHERE must be in inner of the “(“ in SELECT

    C. UPDATE dept d
    SET city = ANY (SELECT city
    FROM locations l)
    (FALSE)We don’t use ALL or ANY on SET the UPDATE

    D. UPDATE dept d
    SET city = (SELECT city
    FROM locations l
    WHERE d.location_id = l.location_id);
    (TRUE)Quando o location_id da tabela DEPT der MATCH no location_id da tabela LOCATION ele irá inserir a CITY na tabela DEPT correspondente a location_id da tabela LOCATION.

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.